Skip to content

Commit

Permalink
Merge pull request godotengine#97268 from MonterraByte/wayland-opengl…
Browse files Browse the repository at this point in the history
…3-fallback

Fallback to OpenGL 3 if Vulkan isn't available on Wayland
  • Loading branch information
akien-mga committed Sep 21, 2024
2 parents 1ef1c4e + c4e4810 commit 0df4a85
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions platform/linuxbsd/wayland/display_server_wayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0df4a85

Please sign in to comment.