-
-
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
Add vulkan gpu selection in the project settings #81752
Conversation
# Conflicts: # core/config/engine.cpp
This will apply to the exported project as well, and Vulkan GPU indices are not portable across systems. This means that if you export a project with this setting set to a non-default value, the exported project may use a suboptimal GPU by default (or worse, software emulation). I think this should be an editor setting, so that it only applies when running the project from the editor. |
core/config/engine.cpp
Outdated
//check for cmd argument override, otherwise get index by config | ||
if (gpu_idx != -1) | ||
return gpu_idx; | ||
else { | ||
int gpu_index_from_config = GLOBAL_GET("rendering/rendering_device/gpu_index"); | ||
if (gpu_index_from_config == -1) | ||
return gpu_idx; | ||
else | ||
return gpu_index_from_config; | ||
} |
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.
Please check the Code style guidelines 🙂
I recommend setting up clang-format locally as described on that page.
Can godot change config values in game code? (sorry im new to godot). I think ability to change gpu with config in final build will be nice also (if it can ofk), the main reason I add this because my system have 2 gpus (6700xt and 1070 specificly) and all vulkan applications chose 1070 for some "vulkan" reason. But anyway I agree that description must say explicitly not touch this if you dont know what it change |
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Yes, but most project setting changes are only effective after the project restarts. In exported projects, this makes for an awkward situation as you must find a way to set the value before the project even starts. The only way to achieve this is by writing a project settings override file (see the Overriding section of the description). A complete implementation that works with in-game settings without a project settings override requires godotengine/godot-proposals#6423 to be implemented. |
Ok, so I guess I need move this parameter to editor settings anyway if GPU selection will be build in game |
Oh no... EditorSettings not existing when function get_gpu_index called... |
Should we open issue or this is intended behavior? |
The editor settings are read after the renderer is initialized, so I'm afraid this can't be done. Alternatively, you'd have to open the editor settings using ConfigFile and read it, but this is a giant hack that probably won't be accepted 🙂 |
well, at least I tried |
also, there is another problem with gpu selection, even if I add cmd argument to specific gpu it will be set until new godot process open or restart, so there is no way currently to explicitly select gpu for editor |
Lines 859 to 887 in e3e2528
To apply it permanently, create a desktop shortcut with the option added in the shortcut's properties. We could read an environment variable that you can set user-wide or system-wide, but I feel adding another nonstandard way to define your preferred GPU isn't ideal 🙁 |
ah it was fixed, I tested it on 4.1 stable and that not worked |
The best way for this I only see is separate reading config variables from objects, or add specific type/object/macro to read them, but anyway cmd line property now fixed, so thanks for that |
Add ability to select Vulkan GPU from project settings in Rendering/Rendering Device category