Try to make a gpu selector in Godot

Godot Version

4.7

Question

Hello i am making an FPS game and i want to make a gpu selector directly in the game , if it is possible. I try to find in internet or the docs but i found nothing so someone know how to make it without doing commands please.

What problem are you trying to solve with this?

As far as I know, you cannot dynamically change which GPU to use during runtime, and I think, there’s no native way to list the available video adapters. On windows and Linux you might be able to use OS.execute to query them.

Also what does it mean to do it without commands?

what i mean with commands is that i saw people trying to solve the problem with this commands : --gpu-index N and --verbose but thanks for awnsering

GPU switching is handled mostly by the OS, and Godot is generally pretty good at picking the best available GPU anyway. I think trying to implement this is a bit of a waste, as it might not even work correctly, or just straight up crash the game. So unless you have a specific problem you are trying to solve with this, I’d say you don’t need it. But if you do want to do it, you have to query the OS for that info, and as far as I know, giving the game the index of the video adapter is the only way.

Thanks for the awnser but i was thinking that godot has already a function to change GPU device.

It does not, since the rendered must be initialised at the start. Swapping the active GPU would require a full restart of the game.