-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Disable NVIDIA's threaded OpenGL optimization on Windows #71472
Disable NVIDIA's threaded OpenGL optimization on Windows #71472
Conversation
e3ddbe3
to
711b0ce
Compare
711b0ce
to
8bc071e
Compare
@bruvzg Should be OK now, I also added a fallback profile name for use in the Project Manager |
8bc071e
to
7dd4110
Compare
Seems like a shame to add 25,000 lines of code to disable a driver setting only on one brand of GPUs, but looking at the build artifacts, overall size has changed by less than 1 mb (the size for windows build artifacts in this PR are reported at the same size as master) so maybe it isn't a big deal |
Why does disabling a driver setting require 25k lines of third-party code? |
ask nvidia, although we could just copy some nvidia types over and use only those |
@EIREXE would it be possible (aka without too much trouble) to trim everything that isn't the threaded optimization part from the thirdparty code or is it too jumbled up for that? I can't imagine that most big graphics programs just import this huge gigantic 25k lines header for this idiotic problem, it's silly. I swear most weird graphics problems we stumble upon here are NVIDIA's fault. Edit: obv I misread your comment and you already commented it as a possibility, sorry. Obviously try doing this if it's humanly feasible, knowing nvidia I wouldn't be surprised if it were a jumbled mess. |
7dd4110
to
2d4270b
Compare
I've done just that, seems to work fine. |
@EIREXE I guess you can remove the original NVAPI file right? |
oh my b, I forgot to remove it |
2d4270b
to
c1fabd4
Compare
0dad4ec
to
947e562
Compare
0c72d3a
to
3fba270
Compare
Sorry for the many mess-ups, should be fine now I hope. |
3fba270
to
938a837
Compare
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.
Looks great!
Thanks! |
For context, this is not necessary on Linux as threaded optimizations are disabled by default there. |
An NVIDIA profile is applied to the current executable to disable threaded OpenGL optimizations on Windows (see godotengine#71472). But because the application is only added to the profile upon the profile creation, newer executables won't be added to the profile (e.g. if the profile is created on first launch of Godot_v4.1-stable_win64.exe, when users update the editor and launch Godot_v4.2-stable_win64.exe, the profile will never be applied to this new executable). This patch fixes that scenario by splitting creating the profile (if it doesn't exist) and adding the application (if it doesn't have a profile applied) into two separate steps. Applications that have been manually added to a different profile aren't overriden to avoid confusing users who know what they're doing.
An NVIDIA profile is applied to the current executable to disable threaded OpenGL optimizations on Windows (see godotengine#71472). But because the application is only added to the profile upon the profile creation, newer executables won't be added to the profile (e.g. if the profile is created on first launch of Godot_v4.1-stable_win64.exe, when users update the editor and launch Godot_v4.2-stable_win64.exe, the profile will never be applied to this new executable). This patch fixes that scenario by splitting creating the profile (if it doesn't exist) and adding the application (if it doesn't have a profile applied) into two separate steps. Applications that have been manually added to a different profile aren't overriden to avoid confusing users who know what they're doing.
An NVIDIA profile is applied to the current executable to disable threaded OpenGL optimizations on Windows (see godotengine#71472). But because the application is only added to the profile upon the profile creation, newer executables won't be added to the profile (e.g. if the profile is created on first launch of Godot_v4.1-stable_win64.exe, when users update the editor and launch Godot_v4.2-stable_win64.exe, the profile will never be applied to this new executable). This patch fixes that scenario by splitting creating the profile (if it doesn't exist) and adding the application (if it doesn't have a profile applied) into two separate steps. Applications that have been manually added to a different profile aren't overriden to avoid confusing users who know what they're doing. (cherry picked from commit 6263774)
} | ||
|
||
// On windows we have to disable threaded optimization when using NVIDIA graphics cards | ||
// to avoid stuttering, see https://github.com/microsoft/vscode-cpptools/issues/6592 |
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.
The link to vscode's issue seems irrelevant, am I understand it wrong?
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 stupid indeed, the correct link should be https://stackoverflow.com/questions/36959508/nvidia-graphics-driver-causing-noticeable-frame-stuttering/37632948
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.
Thanks ! I will take a look, Can I help you make a pr correct this ?
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'm very busy lately, so I would be very thankful if you could do it for me
setting.isCurrentPredefined = 0; | ||
setting.isPredefinedValid = 0; | ||
int thread_control_val = OGL_THREAD_CONTROL_DISABLE; | ||
if (!GLOBAL_GET("rendering/gl_compatibility/nvidia_disable_threaded_optimization")) { |
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.
Can we check nvidia_disable_threaded_optimization
at the beginning of the function to avoid crash in #84880 ?
Disables NVIDIA's threaded optimization which causes random stuttering on Windows with NVIDIA GPUs, virtually all performant OpenGL programs (like ryujinx) disable this to prevent stuttering and it's a well documented issue.
Should fix #33969