summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd/wayland/display_server_wayland.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-09-21 11:50:59 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-21 11:50:59 +0200
commit0df4a851292c2a5f455cc87e0ab8c59ab215f13e (patch)
tree162cb98bdc7fd98a69605396decfe3423afaeb10 /platform/linuxbsd/wayland/display_server_wayland.cpp
parent1ef1c4ee0f9918479005e2eab7a399cae00c3806 (diff)
parentc4e4810e93b29068a90486f14fbb215f4a9eacc0 (diff)
downloadredot-engine-0df4a851292c2a5f455cc87e0ab8c59ab215f13e.tar.gz
Merge pull request #97268 from MonterraByte/wayland-opengl3-fallback
Fallback to OpenGL 3 if Vulkan isn't available on Wayland
Diffstat (limited to 'platform/linuxbsd/wayland/display_server_wayland.cpp')
-rw-r--r--platform/linuxbsd/wayland/display_server_wayland.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/platform/linuxbsd/wayland/display_server_wayland.cpp b/platform/linuxbsd/wayland/display_server_wayland.cpp
index a36748efc1..3fbbc263a0 100644
--- a/platform/linuxbsd/wayland/display_server_wayland.cpp
+++ b/platform/linuxbsd/wayland/display_server_wayland.cpp
@@ -1344,20 +1344,28 @@ DisplayServerWayland::DisplayServerWayland(const String &p_rendering_driver, Win
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;