-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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: Respect integrated GPU preference in Windows Settings #93985
Conversation
fe8387e
to
a61f675
Compare
Using Sysinternals Process Monitor I can observe that However, I neglected that Windows Settings also allows selecting the preference for a packaged app, and the current change doesn't handle this case. It is slightly more annoying to test but implementation should be trivial (using |
This is now implemented, and I've verified that it works by hijacking another packaged app. |
3bae236
to
9ab19fd
Compare
} | ||
|
||
DWORD size = 0; | ||
result = RegGetValueW(hkey, nullptr, value_name, RRF_RT_REG_SZ, nullptr, nullptr, &size); |
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.
Reg. key name size is limited to 16K chars, I wounder what would happen if you try to set GPU preferences for app with longer path (will it truncate it or won't set it at all).
Probably not relevant in practice, Godot won't handle long paths without #91902, and CreateProcess
can't handle long current directory paths, so it's unlikely will ever be over 260.
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.
Interesting point to consider. Though things are really whacky even when I make the Godot exe path just 256 chars -- it crashes when using the NVIDIA GPU and explorer.exe; even if I set it to use the Intel GPU (OpenGL selection is handled by the system) it still crashed explorer.exe (though it did run the project manager).
I think I am comfortable with leaving the code like this. It is obviously not a supported scenario (unless MS decides to raise the limit of the value name, which I doubt would ever happen) and RegOpenKeyExW
should just return an error and the function returns false.
9ab19fd
to
88581a7
Compare
Thanks! |
Tested locally with Vulkan.
Fixes #81870
Related to #58430