mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Added fallback_to_opengl3
This commit is contained in:
parent
84dcdde908
commit
3b839347df
@ -2795,6 +2795,10 @@
|
|||||||
If [code]true[/code], the forward renderer will fall back to Direct3D 12 if Vulkan is not supported.
|
If [code]true[/code], the forward renderer will fall back to Direct3D 12 if Vulkan is not supported.
|
||||||
[b]Note:[/b] This setting is implemented only on Windows.
|
[b]Note:[/b] This setting is implemented only on Windows.
|
||||||
</member>
|
</member>
|
||||||
|
<member name="rendering/rendering_device/fallback_to_opengl3" type="bool" setter="" getter="" default="true">
|
||||||
|
If [code]true[/code], the forward renderer will fall back to OpenGL 3 if both Direct3D 12, Metal and Vulkan are not supported.
|
||||||
|
[b]Note:[/b] This setting is implemented only on Windows, Android, macOS, iOS, and Linux/X11.
|
||||||
|
</member>
|
||||||
<member name="rendering/rendering_device/fallback_to_vulkan" type="bool" setter="" getter="" default="true">
|
<member name="rendering/rendering_device/fallback_to_vulkan" type="bool" setter="" getter="" default="true">
|
||||||
If [code]true[/code], the forward renderer will fall back to Vulkan if Direct3D 12 is not supported.
|
If [code]true[/code], the forward renderer will fall back to Vulkan if Direct3D 12 is not supported.
|
||||||
[b]Note:[/b] This setting is implemented only on Windows.
|
[b]Note:[/b] This setting is implemented only on Windows.
|
||||||
|
@ -1977,6 +1977,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||||||
|
|
||||||
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_vulkan", true);
|
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_vulkan", true);
|
||||||
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_d3d12", true);
|
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_d3d12", true);
|
||||||
|
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_opengl3", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -607,12 +607,20 @@ DisplayServerAndroid::DisplayServerAndroid(const String &p_rendering_driver, Dis
|
|||||||
|
|
||||||
if (rendering_context) {
|
if (rendering_context) {
|
||||||
if (rendering_context->initialize() != OK) {
|
if (rendering_context->initialize() != OK) {
|
||||||
ERR_PRINT(vformat("Failed to initialize %s context", rendering_driver));
|
|
||||||
memdelete(rendering_context);
|
memdelete(rendering_context);
|
||||||
rendering_context = nullptr;
|
rendering_context = nullptr;
|
||||||
|
bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3");
|
||||||
|
if (fallback_to_opengl3 && rendering_driver != "opengl3") {
|
||||||
|
WARN_PRINT("Your device seem not to support Vulkan, 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 {
|
||||||
|
ERR_PRINT(vformat("Failed to initialize %s context", rendering_driver));
|
||||||
r_error = ERR_UNAVAILABLE;
|
r_error = ERR_UNAVAILABLE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
union {
|
union {
|
||||||
#ifdef VULKAN_ENABLED
|
#ifdef VULKAN_ENABLED
|
||||||
|
@ -107,12 +107,20 @@ DisplayServerIOS::DisplayServerIOS(const String &p_rendering_driver, WindowMode
|
|||||||
#endif
|
#endif
|
||||||
if (rendering_context) {
|
if (rendering_context) {
|
||||||
if (rendering_context->initialize() != OK) {
|
if (rendering_context->initialize() != OK) {
|
||||||
ERR_PRINT(vformat("Failed to initialize %s context", rendering_driver));
|
|
||||||
memdelete(rendering_context);
|
memdelete(rendering_context);
|
||||||
rendering_context = nullptr;
|
rendering_context = nullptr;
|
||||||
|
bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3");
|
||||||
|
if (fallback_to_opengl3 && rendering_driver != "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_method("gl_compatibility");
|
||||||
|
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
|
||||||
|
} else {
|
||||||
|
ERR_PRINT(vformat("Failed to initialize %s context", rendering_driver));
|
||||||
r_error = ERR_UNAVAILABLE;
|
r_error = ERR_UNAVAILABLE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rendering_context->window_create(MAIN_WINDOW_ID, &wpd) != OK) {
|
if (rendering_context->window_create(MAIN_WINDOW_ID, &wpd) != OK) {
|
||||||
ERR_PRINT(vformat("Failed to create %s window.", rendering_driver));
|
ERR_PRINT(vformat("Failed to create %s window.", rendering_driver));
|
||||||
|
@ -6160,6 +6160,13 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
|
|||||||
if (rendering_context->initialize() != OK) {
|
if (rendering_context->initialize() != OK) {
|
||||||
memdelete(rendering_context);
|
memdelete(rendering_context);
|
||||||
rendering_context = nullptr;
|
rendering_context = nullptr;
|
||||||
|
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;
|
r_error = ERR_CANT_CREATE;
|
||||||
|
|
||||||
if (p_rendering_driver == "vulkan") {
|
if (p_rendering_driver == "vulkan") {
|
||||||
@ -6175,6 +6182,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
|
|||||||
|
|
||||||
ERR_FAIL_MSG(vformat("Could not initialize %s", rendering_driver));
|
ERR_FAIL_MSG(vformat("Could not initialize %s", rendering_driver));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
driver_found = true;
|
driver_found = true;
|
||||||
}
|
}
|
||||||
#endif // RD_ENABLED
|
#endif // RD_ENABLED
|
||||||
|
@ -3649,10 +3649,18 @@ DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowM
|
|||||||
if (rendering_context->initialize() != OK) {
|
if (rendering_context->initialize() != OK) {
|
||||||
memdelete(rendering_context);
|
memdelete(rendering_context);
|
||||||
rendering_context = nullptr;
|
rendering_context = nullptr;
|
||||||
|
bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3");
|
||||||
|
if (fallback_to_opengl3 && rendering_driver != "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_method("gl_compatibility");
|
||||||
|
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
|
||||||
|
} else {
|
||||||
r_error = ERR_CANT_CREATE;
|
r_error = ERR_CANT_CREATE;
|
||||||
ERR_FAIL_MSG("Could not initialize " + rendering_driver);
|
ERR_FAIL_MSG("Could not initialize " + rendering_driver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Point2i window_position;
|
Point2i window_position;
|
||||||
|
@ -6177,6 +6177,17 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3");
|
||||||
|
if (failed && fallback_to_opengl3 && rendering_driver != "opengl3") {
|
||||||
|
memdelete(rendering_context);
|
||||||
|
rendering_context = nullptr;
|
||||||
|
tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
|
||||||
|
WARN_PRINT("Your video card drivers seem not to support Direct3D 12 or Vulkan, 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);
|
||||||
|
failed = false;
|
||||||
|
}
|
||||||
if (failed) {
|
if (failed) {
|
||||||
memdelete(rendering_context);
|
memdelete(rendering_context);
|
||||||
rendering_context = nullptr;
|
rendering_context = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user