Skip to content

Commit c4e4810

Browse files
committed
Fallback to OpenGL 3 if Vulkan isn't available on Wayland
1 parent 621cadc commit c4e4810

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

platform/linuxbsd/wayland/display_server_wayland.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,20 +1344,28 @@ DisplayServerWayland::DisplayServerWayland(const String &p_rendering_driver, Win
13441344
if (rendering_context->initialize() != OK) {
13451345
memdelete(rendering_context);
13461346
rendering_context = nullptr;
1347-
r_error = ERR_CANT_CREATE;
1347+
bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3");
1348+
if (fallback_to_opengl3 && rendering_driver != "opengl3") {
1349+
WARN_PRINT("Your video card drivers seem not to support the required Vulkan version, switching to OpenGL 3.");
1350+
rendering_driver = "opengl3";
1351+
OS::get_singleton()->set_current_rendering_method("gl_compatibility");
1352+
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
1353+
} else {
1354+
r_error = ERR_CANT_CREATE;
13481355

1349-
if (p_rendering_driver == "vulkan") {
1350-
OS::get_singleton()->alert(
1351-
vformat("Your video card drivers seem not to support the required Vulkan version.\n\n"
1352-
"If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n"
1353-
"You can enable the OpenGL 3 driver by starting the engine from the\n"
1354-
"command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n"
1355-
"If you recently updated your video card drivers, try rebooting.",
1356-
executable_name),
1357-
"Unable to initialize Vulkan video driver");
1358-
}
1356+
if (p_rendering_driver == "vulkan") {
1357+
OS::get_singleton()->alert(
1358+
vformat("Your video card drivers seem not to support the required Vulkan version.\n\n"
1359+
"If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n"
1360+
"You can enable the OpenGL 3 driver by starting the engine from the\n"
1361+
"command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n"
1362+
"If you recently updated your video card drivers, try rebooting.",
1363+
executable_name),
1364+
"Unable to initialize Vulkan video driver");
1365+
}
13591366

1360-
ERR_FAIL_MSG(vformat("Could not initialize %s", rendering_driver));
1367+
ERR_FAIL_MSG(vformat("Could not initialize %s", rendering_driver));
1368+
}
13611369
}
13621370

13631371
driver_found = true;

0 commit comments

Comments
 (0)