-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[Windows] Disable G-SYNC in windowed mode #93737
[Windows] Disable G-SYNC in windowed mode #93737
Conversation
G-SYNC (NVIDIA's VRR) is known to be buggy on windowed mode in Windows. While the driver only enables G-SYNC for full screen mode by default, users can toggle it on for windowed mode too, resulting in unstable refresh rates during Editor usage. This patch extends Godot's NVIDIA profile to force the default full screen mode only G-SYNC with Godot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am affected by the VRR problem on GSync, can test.
If this is equivalent to the Nvidia profile to disable GSync it would be good to me.
@fire this modifies the NVIDIA profile to only enable G-SYNC in full screen mode (if G-SYNC is enabled globally), not to always disable it. Since the editor runs in windowed mode it won't trigger G-SYNC, but games entering full screen mode will still use G-SYNC if it's enabled in the NVIDIA Control Panel. Worth noting: this affects all Godot-based applications, not only the editor. Games won't be able to enter G-SYNC mode while windowed after this change. Given windowed G-SYNC is known to misbehave in Windows I'd say this is probably a sensible default, but I wanted to clarify this before moving forward. |
If this is going to affect non-editor builds there should be an option to disable it, at least at compile time IMO |
This should be toggleable with a project setting if possible, but I don't know if this can be done given how the NVIDIA app profile is created. Is it shared among all Godot processes, or is it split into its own profile when you export a project? (I'd prefer that to happen if possible.) |
NVIDIA profiles are identified by their name, and executables (not full paths, just the file name) are linked to them. In Godot the project name ( For example, in the case of the editor, If On having a per-project toggle, I've never added new settings to Godot, but can look into that. What are we looking at exposing here?
|
I think this would be preferable, considering I can't see any use case for disabling G-Sync in both fullscreen and windowed. NVIDIA has defined a few profile overrides for this, but they all seem to be related to engine-specific issues, not quirks that are specific to a project. The setting should default to |
Things can never be too easy 😅 Checking if exported games with no project name default to I didn't figure this out earlier because the editor is always covered: the project manager always renders using OpenGL, thus always creates the profile. And while the editor itself can be using a different renderer, its binary name has already been linked to the profile by the project manager. Since VRR applies to all renderers, the NVIDIA profile creation should be moved elsewhere, maybe into the Windows display server which is the immediate predecessor to the GL manager? Also important to note is that once a NVIDIA profile is linked to a binary, to the NVIDIA driver this is now a game and will be targeted by the GeForce overlay if it's enabled. This is alright for games, but can result in undesired overlays contaminating application UIs (#85111 is an example on how it's impacting the editor). There is no officially supported way to signal to the NVIDIA driver an application is not a game and shouldn't be targeted by overlays. There is an unsupported setting, but it requires admin privileges to be added to the profile. Some tools (e.g. Unity, Unreal) come with that setting pre-applied by the NVIDIA driver, but even if we wanted to follow that path it wouldn't be easy: Godot's binary doesn't have a fixed name (e.g. In short, if we want to offer the toggle for windowed VRR, we need to move NVIDIA profile creation to a spot where it applies to all renderers, and by doing so we are exposing more applications to the potential "overlay invasion" bug. How do we want to proceed? |
Maybe we should start doing that? Most people only have a single executable installed or use a version manager like Godots, which could put each version in its own folder. (In fact, you must do that for C# builds.) |
As I was discussing in #85111 (comment), there might be a simpler path forward after all. NVIDIA has started distributing its new beta NVIDIA App. This new app aims at replacing GeForce Experience and NVIDIA Control Panel with a single tool. What makes this very interesting for Godot is how the overlay indicators are implemented: unlike GeForce Experience that adds the indicators to every window (in Godot's case, that is every menu, tooltip, etc), NVIDIA App shows a single indicator for the whole screen, solving our issue without any change on Godot's side. NVIDIA App will replace GeForce Experience when it leaves beta, and they will coexist until then. Since the app is already available in beta, we can maybe document its usage as the preferred workaround for now? |
Sounds good to me. I've already been maining the NVIDIA app since it debuted beta and it works very well for me 🙂 |
With NVIDIA App as the proposed workaround, should I go ahead and work on enabling the profile for all renderers to solve the VRR issue? An alternative is to only disable windowed VRR for the editor for now (creating a separate profile for the editor, which I think makes sense in any case), and revisit extending to any application when NVIDIA App has become the default and we are confident we aren't triggering the indicators-everywhere issue for non-game apps. |
Would this disable windowed VRR in all Godot projects, including exported ones? I'd prefer we avoid doing that. Windowed VRR is usually fine for games that always redraw. |
I propose starting only with the editor to reduce risk:
Thoughts on this approach? |
Seems good to me, although it might be better to wait for others' opinion as well. |
Sounds good to me too. |
Is this really needed? Exported projects with no name use With this PR in its current state, the only quirk is that projects run from the editor will no longer have VRR enabled when windowed, but I don't think this is a dealbreaker. Exported projects that use a RenderingDevice-based rendering method will also not define the profile at all (since the OpenGL context manager will never be called), but this is usually fine as most exported projects that use RenderingDevice-based rendering methods redraw continuously anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally on Windows 11 23H2 and NVIDIA 555.85, it works as expected.
Using my LG C2's VRR display information (press the green button 7 times on the remote). G-Sync is enabled system-wide on both videos, on both fullscreen and windowed apps. The profile successfully prevents Godot from using VRR in windowed mode, leading to smoother mouse cursor movement:
Before
before_vrr.mp4
After
after_no_vrr.mp4
This may be worth considering for a 4.2 cherrypick, although there's some risk of unforeseen regressions. We might want to wait for 4.3 to be released to get some feedback before cherry-picking this.
Thanks! |
Are we sure that is the case? Based on godot/platform/windows/gl_manager_windows_native.cpp Lines 175 to 179 in 293c0f7
Godot Engine , which would bundle them with the editor for Nvidia profile purposes.
I can't test it until later this weekend (away from any Windows + Nvidia machine). Also, just out of curiosity: why doesn't the editor set a project name (I guess |
I see. We have a lot of logic scattered around in various places as a fallback for projects with an empty name string. Some places use
I don't remember why exactly, but it makes sense to set its name to |
I've finally been able to test what NVIDIA profile name is used for unnamed projects. I've exported an anonymous Compatibility project (since only OpenGL projects are hitting the NVIDIA profile code path today), and as I expected the NVIDIA profile is created as I'm not sure how big a blast radius that might be, but it's definitely worth considering in case we want to roll the change back before the next release. |
@aitorciki Godot stopped compiling in
|
@patwork I can reproduce the issue. Removing the initialization results in a correct compilation, I'll create a PR tomorrow to fix it after checking it's not affecting the NVIDIA functionality. |
In response to #93155
G-SYNC (NVIDIA's VRR) is known to be buggy on windowed mode in Windows. While the driver only enables G-SYNC for full screen mode by default, users can toggle it on for windowed mode too, resulting in unstable refresh rates during Editor usage.
This patch extends Godot's NVIDIA profile to force the default full screen mode only G-SYNC with Godot.
Production edit: