Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking issue: GLFW patch for improved fullscreen compatibility #19

Open
comp500 opened this issue Dec 4, 2021 · 51 comments
Open

Tracking issue: GLFW patch for improved fullscreen compatibility #19

comp500 opened this issue Dec 4, 2021 · 51 comments

Comments

@comp500
Copy link
Owner

comp500 commented Dec 4, 2021

I'm working on a patch to GLFW that will improve borderless fullscreen compatibility using different window flags. I've been looking into the issues with current fullscreen methods Borderless Mining (and similar mods) uses, and I hope that these changes will fix some of the issues people have with the mod currently (including #1 #2 #3 #9).

These patches will only have effect on Windows - if you're experiencing issues on other operating systems, please report them separately.

As I am rather busy currently, I have no timeline or guarantee for these changes to be implemented; but please subscribe to this issue (using the button on the right) for updates and test builds.

@comp500 comp500 pinned this issue Dec 4, 2021
comp500 added a commit that referenced this issue Dec 18, 2021
Requires glfw3.dll in assets/borderlessmining to build;
from comp500/glfw@08b3a9e
See #19 for more details.
@comp500
Copy link
Owner Author

comp500 commented Dec 18, 2021

The GLFW replacement test 1 build is now available! Get it for Fabric 1.18: borderless-mining-2.0.0-alpha-dev.0d42a0d+1.18.jar.zip (in a zip because GitHub restricts the file type)

Since fullscreen behaviour on Windows is often affected by driver heuristics and multi-monitor quirks, I don't know how all configurations will behave with these changes. Hence, please test this build and let me know your experience! I'm curious to know if any of the following break/occur with your configuration:

  • Overlays (e.g. Xbox Game Bar, NVIDIA Share, Discord, Steam)
  • Input Method Editors (IMEs, e.g. for Chinese input)
  • Screenshots from external applications
  • Excessive tearing (worse than standard fullscreen with VSync)
  • Game minimises when you click in another monitor
  • Taskbar displays on top of the game, when the game is selected
  • Windows cannot be placed on top of the game
  • Framerate forced to VSync/display framerate when VSync is disabled (please check if this does not occur in exclusive fullscreen without VSync first)

If you encounter any issues with these builds, please test to see if you can reproduce the issues with the following changes:

I ask that you do not distribute this build (and future test builds) in public modpacks; as the changes are experimental and the current build crashes on any OS other than Windows!

Source: 0d42a0d
Source for glfw3.dll: comp500/glfw@08b3a9e

(cc: @cpm9 @kosma @NeusFear @ZenoMetal @fortemfiducia @juliand665)

@comp500
Copy link
Owner Author

comp500 commented Dec 18, 2021

Oh, and one more thing to note: this build completely removes all of the Borderless Mining interface, instead replacing the standard fullscreen option with borderless fullscreen! I may add some of or all the previous features back, depending on what works best for different configurations (but no guarantees).

@kosma
Copy link

kosma commented Dec 19, 2021

Tested under the following setup:

  • Win10, GTX 1660S, roughly recent drivers
  • Fabric 1.18.1, heavily modded (including Sodium/Indium/Iris/Continuity)
  • Single monitor but with 125% text scaling
  • Tried Discord and Geforce overlays + Win-Shift-S screenshots at the same time

Found no issues. I wish I could compare to non-patched 1.18.1 so I could look for the tearing a bit harder

I will use my friends as guinea pigs for testing this - private modpack, ca. 10-15 users.

PS. I love the removal of GUI, and just flat out replacing the fullscreen functionality - minimalistic but fully functional (and also I think playing nicely with the Video Settings GUI modifications done by Sodium).

@Arcensoth
Copy link

Just discovered this mod today, looking for a solution to the curious fact that my FPS drops dramatically with the vanilla true fullscreen enabled.

The current stable release kept my FPS stable in borderless fullscreen mode, but caused significant screen tearing as described in #1. Looks like I stumbled across this mod and the test build at the perfect time!

Relevant specs:

  • Windows 10, build 19043
  • GeForce GTX 1060 6GB, driver version 456.71
  • Java 17.0.1 64bit, 2GB allocated
  • Single ultrawide display (2560x1080)
  • Fabric 1.18, client modded (Sodium, Phosphor, Lithium, Iris, BSL shaders)
  • VSync enabled, render distance 8-12

Things I've noticed:

  • No drop in FPS compared to bordered windowed mode (same as current stable release)
  • Windows screenshot and gamebar overlays work well
  • No excessive tearing (if any at all), as opposed to the current stable release where it is abundant
  • Game does not minimize when taskbar is selected - as expected
  • Taskbar does not display on top of the game, when the game is selected - as expected
  • Windows can be placed on top of the game - as expected

Awesome work! I haven't been able to play in ultrawide fullscreen without sacrificing some visual component (render distance, shaders, etc) in some time, and I'm hyped to longer have to make a choice. :)

@kosma
Copy link

kosma commented Dec 20, 2021

Did extra testing:

  • MSI Afterburner overlay - works
  • Multi-monitor - works
  • SEUS shaders - works
  • No noticeable performance difference with and without the mod

@kosma
Copy link

kosma commented Dec 27, 2021

Side note, probably obvious - crashes on macOS because it can't locate the DLL file.

@he3als
Copy link

he3als commented Jan 4, 2022

I have had no issues previously with borderless mining. Here I will compare fullscreen exclusive and this test of Borderless Mining on 1.18.1.

Relevant specs & info:

  • Windows 10 21H2 (OS Build 19044.1288)
  • NVIDIA GeForce GTX 970 - 497.29 DCH (installed with NVCleanstall)
  • GraalVM Community Edition 17 - 21.3.0 - Java Arguments (some are added by MultiMC)
  • MultiMC development branch - 0.6.14-develop-3122
  • Two monitors - 240hz and 75hz (both 1080p)
  • Fabric 1.18.1 - Mods list
  • V-Sync disabled in-game, render distance 8 and simulation distance 6
  • CapFrameX used to benchmark
  • Windows Game Mode is on
  • Shaders turned off

Benchmarking Results

In each benchmark, I opened a world and walked 25 blocks to the exact same point and then waited for the capture to end in CapFrameX (20 seconds). I did each benchmark fairly and started and stopped at the same place each time.
image

Averages (mean)

Fullscreen Exclusive (FSE)
  • Average FPS: 681.5 FPS
  • 1% percentile FPS: 335.366666667 FPS
  • 0.1% percentile FPS: 245.533333333 FPS
  • Score (adding them all up): 1262.4
Borderless Mining (BM)
  • Average FPS: 583.3 FPS
  • 1% percentile FPS: 312.7 FPS
  • 0.1% percentile FPS: 236.966666667 FPS
  • Score (adding them all up): 1132.96666667

Things I've noticed:

  • ShareX screenshot previews work (in the bottom right corner), so overlays work
  • I do not notice any tearing, even if V-Sync is disabled everywhere
  • Game does not minimize when the taskbar or another application is clicked/focused - as expected
  • Taskbar does not display on top of the game, when the game is selected - as expected
  • Windows can be placed on top of the game - as expected

@SleepyCatten
Copy link

Thank you soooo much for producing this version. I've tested this now for several hours without any issues 🥰 My setup is as follows:

RTX 2070 Super (511.23 drivers)
Windows 10 Pro 64-bit (21H2 - build 19044.1348)
Ryzen 7 5800X
Fabric loader (installer version 0.10.2)
Minecraft 1.18.1

I have not done any benchmarks, but I've noticed no noticeable slowdown between this mode and regular windowed mode.

@Azim
Copy link

Azim commented Feb 26, 2022

This fixed my tearing issues. My setup:

Minecraft 1.18.1 with sodium, lithium, and etc optimization mods
2 monitors with Minecraft being on the main monitor, no UI scaling
GeForce GTX 1060 6GB
Intel Core i5-4570 @3.20GHz
Windows 10 Pro 64-bit (10.0, build 18362)

Havent noticed any big change in performance.
Win+Shift+S captures things fine

Repository owner deleted a comment from Azim Mar 6, 2022
@comp500
Copy link
Owner Author

comp500 commented Mar 6, 2022

@Azim That looks like a driver crash in texture uploading (deleted your comment as the game arguments contain your authentication token), not something related to Borderless Mining? I can't seem to replicate the crash on my NVIDIA GPU, it may be a driver issue or a problem with the other mods you're using.

@he3als
Copy link

he3als commented Mar 6, 2022

Try re-installing/updating your graphics card drivers.

@Azim
Copy link

Azim commented Mar 6, 2022

@Azim That looks like a driver crash in texture uploading (deleted your comment as the game arguments contain your authentication token), not something related to Borderless Mining? I can't seem to replicate the crash on my NVIDIA GPU, it may be a driver issue or a problem with the other mods you're using.

just tried updating graphics driver, but confirmed that the game doesnt crash when i remove the Borderless Mining mod
upd: even with updated driver it still crashes when mod is installed

@comp500
Copy link
Owner Author

comp500 commented Mar 6, 2022

Does the same crash still occur with only Borderless Mining installed? I'm really not sure what would cause this, it could be a conflict with another mod.

@Azim
Copy link

Azim commented Mar 7, 2022

Seems to be conflicting with this one:
https://www.curseforge.com/minecraft/mc-mods/distant-horizons/files/3651470

now instead of crash log, it gives me this message:
image

@Felix14-v2
Copy link
Contributor

Felix14-v2 commented Apr 23, 2022

I tested the experimental version 2.0.0, everything works perfectly for me.
But one of my friends (Windows 10) has a problem – OBS can't detect the game window in fullscreen mode during his streams (or simply can't capture the video, I don't know more precisely). It is noteworthy that the old version (1.1.2) did not show this problem.

@comp500, what additional information might you need? I will try to get the log and crash report and send it here.

@comp500
Copy link
Owner Author

comp500 commented Apr 23, 2022

The main thing I need to know is what graphics drivers they're using (Intel/AMD/NVIDIA, hybrid/laptop graphics?); and if it still occurs using Minecraft's fullscreen option? #19 (comment) also has a good list of things to test.

@Felix14-v2
Copy link
Contributor

Felix14-v2 commented Apr 23, 2022

what graphics drivers they're using

Nvidia, RTX 2070 if i'm not mistaken.
Other things are good (at least, no other problems were noticed). Vanilla's fullscreen was also broken after the graphics driver update, but Borderless Mining 1.1.2 fixes this.

@comp500
Copy link
Owner Author

comp500 commented Apr 24, 2022

I don't think there is anything I can do about that; they could try using a different source (Game Capture or Window Capture?) or a different capture method in Window/Display capture. I'm curious to see if this behaviour is specific to OpenGL applications though, does the same happen with a DirectX (ideally DirectX 11/12) application in Borderless Windowed mode?

@Felix14-v2
Copy link
Contributor

Felix14-v2 commented Apr 29, 2022

I just noticed that it is no longer possible to minimize the game window properly using the keyboard shortcut (Win+D in my case). The window minimizes, but when focusing on any other window, it immediately expands again, sometimes the taskbar disappears: [Demo]
After several tests, the game window generally began to behave in an unexpected way: [Demo]

This may be the result of a recent Windows update. If so, I wouldn’t be surprised at all, because there has never been a time that it didn’t break something.

latest.log
crash-2022-04-30_01.25.03-client.txt

Tested it without other mods, the result was the same.

@comp500
Copy link
Owner Author

comp500 commented Oct 21, 2022

Compatibility issue should be fixed, I needed to include LWJGL's patches to GLFW (comp500/glfw@942fe81), get the fix here: borderless-mining-2.0.0-alpha.2-dev.b9c3c6c+1.19.2.jar.zip

Maybe add a little toggle for the DirectX interop as well?

I've made it switchable in game, no restart required :)

@Scarlaid
Copy link

Works fine with Better Taskbar but instant crash with PuzzleGUI
The lastest.log: latest.log

Crash log:

@comp500
Copy link
Owner Author

comp500 commented Oct 23, 2022

I can't really do much about the Puzzle crash, it's trying to use parts of Borderless Mining (the configuration) that aren't present in this version, since I removed all configuration. Easiest fix for now would probably be to change the mod ID in fabric.mod.json to something other than borderlessmining so Puzzle doesn't try to access it.

@SleepyCatten
Copy link

Is there a 1.19.3 test version out with the GLFW patch? 💟

@Stonley890
Copy link

Stonley890 commented Dec 28, 2022

Been looking for a solution to full-screen issues and this solves them! Here is a video comparing before and after:
https://youtu.be/l-w2_HCctQw

I've tried to figure out why using Minecraft (and some other games) in fullscreen changes the display settings but I couldn't find any answers online describing the same problem. Minecraft works way better than vanilla fullscreen with this patch.

OS: Windows 11 Home Single Language
Version: 22H2 Build 22621.963
Display: 1920x1080
Graphics: NVIDIA GeForce RTX 3060

Minecraft: 1.19.2
Mod Loader: Quilt Loader 0.17.7

@Jack-Works
Copy link

Tried with Windows 11 22H2 22623.1095, 3840x2160, NVIDIA GeForce RTX3060 Ti, Farbic loader, Iris&Sodium, works good. Tested with PresentMon it is always "Copy with GPU GDI" in the game or out of the game.

@Felix14-v2
Copy link
Contributor

Felix14-v2 commented Feb 14, 2023

Is there a 1.19.3 test version out with the GLFW patch?

You can just use 1.19.2 version, it works fine

Except for the flickering when unfocusing Minecraft running with integrated graphics :(

https://user-images.githubusercontent.com/75726196/218817514-cbce676a-4ac1-41d5-aad3-a3c1469bd5dc.mp4
(sorry, OBS can't record Minecraft in fullscreen for some reason)

@SleepyCatten
Copy link

Hi @comp500 💟 Has this been merged into the main commit yet by any chance? No worries if not, as I greatly appreciate the work you put into this as it is. I was only thinking that it would be cool to have this patch incorporated into the official latest version, especially for any future 1.20 updates or beyond.

@comp500
Copy link
Owner Author

comp500 commented Jun 14, 2023

No, I'm still working on finding a more general solution to the problem that works on non-NVIDIA systems. I can probably integrate this fix for the next release, but it'd have to coexist with the current implementation until the D3D interop system is ready.

@SleepyCatten
Copy link

No, I'm still working on finding a more general solution to the problem that works on non-NVIDIA systems. I can probably integrate this fix for the next release, but it'd have to coexist with the current implementation until the D3D interop system is ready.

Thank you so much again for this 💟 I'd be happy to see two release versions (maybe one as stable & one as alpha for Nvidia cards only), but ultimately I'll defer to whatever is best for you 💟

@WubTheGame
Copy link

WubTheGame commented Jul 13, 2023

No, I'm still working on finding a more general solution to the problem that works on non-NVIDIA systems. I can probably integrate this fix for the next release, but it'd have to coexist with the current implementation until the D3D interop system is ready.

In case it helps, I'd like to inform you that the 1.18.2 version of this mod (and the test build linked here) does nothing for me while the 1.18 version works fine. I'm on a 7900xt, 3900x, Win10 updated two days ago, three displays with varying resolutions (max is 1440p 144hz, the game's monitor), latest graphics driver, using Quilt 0.18.10 on Minecraft 1.18.2.

That said, I'm wondering if there is/will be any particular reason, technical or practical, to update when there's a new usable version for me? I expect not due to the simple scope of the mod, but just curious.

@IdrisQe
Copy link

IdrisQe commented Aug 10, 2023

I'm assuming this is what's causing some of my issues?

When I try to use Printscreen in Windows 10 to take a screenshot, for some reason it always gives me an "outdated" frame - for example I took this one after a few minutes of playing, yet it just shows the world loading screen as if that was when I took the printscreen (it wasn't).
image

Edit: It seems whatever gets printscreened is whatever frame was shown when I last alt-tabbed back into the game.

On a similar issue, when using the program ScreenToGif with Borderless Mining, it captures a still image regardless of how much I move my camera while recording.

I might try 2.0.0 alpha in a few and report back based on my findings.

Edit: Yes, it does fix my issues! Though performance seems more stuttery now... Hm... Maybe something to do with the DirectX Interop from what I've been reading here? Admittedly my knowledge of rendering is... near-zero so I may be misunderstanding.

I've made it switchable in game, no restart required :)

Is this in the latest 2.0.0 alpha linked here? I can't seem to find it to try toggling it. Mod Menu integration also isn't working in that version (and the config file doesn't seem to have anything about it anyways)

@comp500
Copy link
Owner Author

comp500 commented Aug 10, 2023

The currently released builds don't use the DirectX interop code, so they only work on NVIDIA and can impact performance. When the DirectX interop version is ready, I'll make a separate issue and link it from here - this one is rather cluttered.

@Josh65-2201
Copy link

Has there been any work on this recently?

@mse-k
Copy link

mse-k commented Dec 25, 2023

Could there be a build for 1.20.2? I was trying to setup an AutoHotkey script and realized this was the issue lol

@Enderteck
Copy link

Could this kind of patch be done for the Linux libglfw ?

Right now this mod doesn't work on Wayland with this patched version:

BoyOrigin/glfw-wayland

If someone would tell me how to have both work together that would be nice !

@craftercis
Copy link

craftercis commented Mar 2, 2024

Hey @comp500. Really nice mod! Im now using a external tool "Borderless Gaming" because the GLFW fix isn't out for 1.20.1 yet. And this fixes my hdr bug within Minecraft. If you have the time, could you please update the fix to 1.20.1?

Edit #1: When I watch a youtube video higher than 720p and open the inventory menu the video is buffering sometimes
Edit #2: It works fine for 1.20.1 for some reason lol. But the buffering is still there. I try to make a video from it
Edit #3: The stuttering is because of graphics acceleration in the browser. Turned that off and its working fine now. Maybe you can look into that?

@Felix14-v2
Copy link
Contributor

Im now using a external tool "Borderless Gaming" because the GLFW fix isn't out for 1.20.1 yet. And this fixes my hdr bug within Minecraft. If you have the time, could you please update the fix to 1.20.1?

If you use Sodium, then there's a chance of getting this feature with one of its further updates:
CaffeineMC/sodium#2359

@craftercis
Copy link

Im now using a external tool "Borderless Gaming" because the GLFW fix isn't out for 1.20.1 yet. And this fixes my hdr bug within Minecraft. If you have the time, could you please update the fix to 1.20.1?

If you use Sodium, then there's a chance of getting this feature with one of its further updates: CaffeineMC/sodium-fabric#2359

That would be nice. However, The fix comp500 made here works fine for me know on 1.20.1

@mirh
Copy link

mirh commented Oct 17, 2024

You want to check the last comments in glfw/glfw#1907

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests