diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 405ea9bf694f..08b77ea5930f 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -2797,7 +2797,7 @@
If [code]true[/code], the forward renderer will fall back to OpenGL 3 if both Direct3D 12 and Vulkan are not supported.
- [b]Note:[/b] This setting is implemented only on Windows, Android and Linux/X11.
+ [b]Note:[/b] This setting is implemented only on Windows, Android, macOS, iOS and Linux/X11.
If [code]true[/code], the forward renderer will fall back to Vulkan if Direct3D 12 is not supported.
diff --git a/platform/ios/display_server_ios.mm b/platform/ios/display_server_ios.mm
index 5a027e019649..0272b97f4c3c 100644
--- a/platform/ios/display_server_ios.mm
+++ b/platform/ios/display_server_ios.mm
@@ -107,11 +107,20 @@
#endif
if (rendering_context) {
if (rendering_context->initialize() != OK) {
- ERR_PRINT(vformat("Failed to initialize %s context", rendering_driver));
memdelete(rendering_context);
rendering_context = nullptr;
- r_error = ERR_UNAVAILABLE;
- return;
+ bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3");
+ if (fallback_to_opengl3 && rendering_driver != "opengl3") {
+ tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
+ WARN_PRINT("Your device seem not to support MoltenVK or Metal, switching to OpenGL 3.");
+ rendering_driver = "opengl3";
+ OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
+ failed = false;
+ } else {
+ ERR_PRINT(vformat("Failed to initialize %s context", rendering_driver));
+ r_error = ERR_UNAVAILABLE;
+ return;
+ }
}
if (rendering_context->window_create(MAIN_WINDOW_ID, &wpd) != OK) {
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index 52dc51bc960d..2f7569ae66c1 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -3649,8 +3649,17 @@
if (rendering_context->initialize() != OK) {
memdelete(rendering_context);
rendering_context = nullptr;
- r_error = ERR_CANT_CREATE;
- ERR_FAIL_MSG("Could not initialize " + rendering_driver);
+ bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3");
+ if (fallback_to_opengl3 && rendering_driver != "opengl3") {
+ tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
+ WARN_PRINT("Your device seem not to support MoltenVK or Metal, switching to OpenGL 3.");
+ rendering_driver = "opengl3";
+ OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
+ failed = false;
+ } else {
+ r_error = ERR_CANT_CREATE;
+ ERR_FAIL_MSG("Could not initialize " + rendering_driver);
+ }
}
}
#endif