Godot won't let you change rendering backends in runtime. Thus, I'd suggest to create a launcher where the player can choose before running the actual game.
In Godot 3, you cannot change the rendering of the exported game. Thus, we might be talking of separate downloads.
I suppose you might be able to reuse PCKs. See Exporting packs, patches, and mods.
The options you have are, of course, GLES2 and GLES3. With GLES2 being intended to be compatible with more devices, while GLES3 does not care and goes for features (Consequently many old smartphones that support GLES3 did get black screens with Godot GLES3 exports because it was not implemented for compatibility, so it required some extensions without fallback if they weren't available).
In Godot 4 you can use command line arguments to change rendering.
You can get the valid options using --help
. These are the options (at least on Windows 10):
No Display
--display-driver headless
Forward+ (Intended for modern desktop GPUs)
--rendering-method forward_plus --rendering-driver vulkan
Mobile (Optimized for mobile GPUs)
--rendering-method mobile --rendering-driver vulkan
Compatibility (Intended for old GPUs that do not support Vulkan)
--rendering-method gl_compatiblity --rendering-driver opengl3
Notes:
- There is an
--rendering-driver dummy
which is automatically selected when you use --display-driver headless
.
- If you do not specify
--display-driver headless
, then --display-driver windows
is assumed.
- To have display, you need to specify a working combination of
--rendering-method
and --rendering-driver
or Godot will halt with an error message.
- The OpenGL rendering backend is not feature complete at the time of writing.
- You should be able to use Metal on macOS, but I don't have the means to test it at the time of writing.
- There might be other options added in the future (including DirectX support, for which the development is being financed by W4 Games), but it is not available in official builds at the time of writing.