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

Run window launch options #34630

Closed
mintyleaf opened this issue Dec 27, 2019 · 12 comments · Fixed by #35992
Closed

Run window launch options #34630

mintyleaf opened this issue Dec 27, 2019 · 12 comments · Fixed by #35992

Comments

@mintyleaf
Copy link

mintyleaf commented Dec 27, 2019

Hello there
It would be very useful to have an ability to change the preview launch command
For scenario like running Godot on Intel gpu for powersaving and launching the preview on Nvidia/AMD gpu on the notebooks with two gpus
(exporting env variable, launching prime run script e.t.c.)

@rafaelgdp
Copy link

I think you should elaborate more on what you are proposing. From what I know, Godot does not get to pick which GPU the game process is allowed to use. It is the job of the OS to do such thing.

@KoBeWi
Copy link
Member

KoBeWi commented Dec 27, 2019

I think you should elaborate more on what you are proposing.

I think this is about providing custom launch arguments when running from editor. This sounds like candidate for https://github.com/godotengine/godot-proposals/issues

@Calinou
Copy link
Member

Calinou commented Dec 27, 2019

I think this is about providing custom launch arguments when running from editor.

This already exists (Editor > Main Run Args in the Project Settings). However, there's no CLI argument for choosing the GPU to use.

@KoBeWi
Copy link
Member

KoBeWi commented Dec 27, 2019

there's no CLI argument for choosing the GPU to use.

Then unless there's system command to do that, it's impossible.

@mintyleaf
Copy link
Author

I think this is about providing custom launch arguments when running from editor.

This already exists (Editor > Main Run Args in the Project Settings). However, there's no CLI argument for choosing the GPU to use.

yes, that is almost what is needed, but for doing gpu switching we need to put something in the begining of cmd)
did i understand right that when godot editor launches the preview it is simply launches another godot instance with path to project and debug server address?

if i'm right, then it needs to just put "prime-run " run cmd.

@Calinou
Copy link
Member

Calinou commented Dec 28, 2019

yes, that is almost what is needed, but for doing gpu switching we need to put something in the begining of cmd)

I guess we could reuse Steam's %command% syntax here:

prime-run %command% --some-other-argument

did i understand right that when godot editor launches the preview it is simply launches another godot instance with path to project and debug server address?

Yes, exactly 🙂

if i'm right, then it needs to just put "prime-run " run cmd.

I think this is supposed to happen automatically in the first place, but it's not implemented for NVIDIA graphics cards on Linux yet. See #23463.

@mintyleaf
Copy link
Author

I think this is supposed to happen automatically in the first place, but it's not implemented for NVIDIA graphics cards on Linux yet. See #23463.

No!)
Prime Offloading is working well for me for switching between intel 620 and mx150, so it can be implemented through the adding "prime-run " before the run cmd of preview

The prime-run is simply exporting some needed variables and launches the comand:
__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@"

@Calinou
Copy link
Member

Calinou commented Dec 28, 2019

@mintyleaf Maybe we can export those variables by default to get the same behavior as Mesa drivers?

cc @akien-mga

@mintyleaf
Copy link
Author

@mintyleaf Maybe we can export those variables by default to get the same behavior as Mesa drivers?

cc @akien-mga

Well I need to read about Mesa drivers behaviour, cause I didn't understand about what you talking
I want to launch the editor on powersaving gpu, but preview on powerful gpu
By now I'm successfully launching Godot with prime run on Nvidia card and don't see any performance issues)

@akien-mga
Copy link
Member

This is Linux specific, Windows doesn't let you select the GPU with a command wrapper like prime-run or primusrun or an environment variable.

AFAIK prime-run and the env variables mentioned above are even further Ubuntu-specific (might also be available in other distros derived from Ubuntu). Furthermore they are specific to proprietary Nvidia drivers.

AMD dGPU use the open source Mesa implementation which supports reverse prime offloading out of the box, and can be enabled by DRI_PRIME=1. Godot enables it by default if it detects such a GPU.

So adding an option to redefine the launch command with a substitution like Steam's %command% could be done, but it's to cater to a relatively niche use case here. There might be other uses which could make it useful though.

But eventually, it might be better to simply wait for Vulkan support which lets you select the GPU you want to use via Vulkan itself, so we could properly implement a way to use different GPUs in the editor and in the running game.

@mintyleaf
Copy link
Author

mintyleaf commented Jan 10, 2020

There might be other uses which could make it useful though.

Exactly! I thought that such abilities like customizing the preview launch can be useful in many other ways)

AFAIK prime-run and the env variables mentioned above are even further Ubuntu-specific (might also be available in other distros derived from Ubuntu). Furthermore they are specific to proprietary Nvidia drivers.

wiki.archlinux.org/index.php/PRIME#PRIME_render_offload

@akien-mga
Copy link
Member

AFAIK prime-run and the env variables mentioned above are even further Ubuntu-specific (might also be available in other distros derived from Ubuntu). Furthermore they are specific to proprietary Nvidia drivers.

wiki.archlinux.org/index.php/PRIME#PRIME_render_offload

My bad, I mistook it for https://code.launchpad.net/ubuntu/+source/nvidia-prime
The comment still stands though, prime-run is an Arch script, which is not necessarily available on other distros (Ubuntu's nvidia-prime for example doesn't offer a prime-run, but other prime-* tools: https://git.launchpad.net/ubuntu/+source/nvidia-prime/tree/

Other distros rely on Bumblebee with its optirun, and when using the Primus backend primusrun.

In short: there is no standardized support for Nvidia PRIME on Linux, beyond DRI_PRIME=1 when using nouveau (which in its current state would not be recommended for gaming).

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

Successfully merging a pull request may close this issue.

5 participants