diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-20 16:06:35 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-20 16:06:35 +0200 |
commit | c2564f42aac63f7045572cfbaf0fefe6792788f3 (patch) | |
tree | b1b35b91baee99b7c7c73e68725d4368e9ec1ee0 /platform/linuxbsd | |
parent | 330cb45c5a9846a2a4ae1affaf7a5741dcb97a97 (diff) | |
parent | 3b839347df1714cab08d373a551da2602e1a7cdf (diff) | |
download | redot-engine-c2564f42aac63f7045572cfbaf0fefe6792788f3.tar.gz |
Merge pull request #97142 from SheepYhangCN/master
Fallback to OpenGL 3 if other rendering drivers are not supported
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r-- | platform/linuxbsd/x11/display_server_x11.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index a12c935273..7949f80f24 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -6160,20 +6160,28 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode if (rendering_context->initialize() != OK) { memdelete(rendering_context); rendering_context = nullptr; - r_error = ERR_CANT_CREATE; + bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3"); + if (fallback_to_opengl3 && rendering_driver != "opengl3") { + WARN_PRINT("Your video card drivers seem not to support the required Vulkan version, switching to OpenGL 3."); + rendering_driver = "opengl3"; + OS::get_singleton()->set_current_rendering_method("gl_compatibility"); + OS::get_singleton()->set_current_rendering_driver_name(rendering_driver); + } else { + r_error = ERR_CANT_CREATE; + + if (p_rendering_driver == "vulkan") { + OS::get_singleton()->alert( + vformat("Your video card drivers seem not to support the required Vulkan version.\n\n" + "If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n" + "You can enable the OpenGL 3 driver by starting the engine from the\n" + "command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n" + "If you recently updated your video card drivers, try rebooting.", + executable_name), + "Unable to initialize Vulkan video driver"); + } - if (p_rendering_driver == "vulkan") { - OS::get_singleton()->alert( - vformat("Your video card drivers seem not to support the required Vulkan version.\n\n" - "If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n" - "You can enable the OpenGL 3 driver by starting the engine from the\n" - "command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n" - "If you recently updated your video card drivers, try rebooting.", - executable_name), - "Unable to initialize Vulkan video driver"); + ERR_FAIL_MSG(vformat("Could not initialize %s", rendering_driver)); } - - ERR_FAIL_MSG(vformat("Could not initialize %s", rendering_driver)); } driver_found = true; } |