mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 06:03:09 +00:00
Enable fallback from ANGLE to native and improve ANGLE error messages.
This commit is contained in:
parent
e3550cb20f
commit
f8a6c0e8ab
@ -2526,8 +2526,8 @@
|
|||||||
[b]Note:[/b] This setting is implemented only on Linux/X11.
|
[b]Note:[/b] This setting is implemented only on Linux/X11.
|
||||||
</member>
|
</member>
|
||||||
<member name="rendering/gl_compatibility/fallback_to_native" type="bool" setter="" getter="" default="true">
|
<member name="rendering/gl_compatibility/fallback_to_native" type="bool" setter="" getter="" default="true">
|
||||||
If [code]true[/code], the compatibility renderer will fall back to native OpenGL if ANGLE over Metal is not supported.
|
If [code]true[/code], the compatibility renderer will fall back to native OpenGL if ANGLE is not supported, or ANGLE dynamic libraries aren't found.
|
||||||
[b]Note:[/b] This setting is implemented only on macOS.
|
[b]Note:[/b] This setting is implemented on macOS and Windows.
|
||||||
</member>
|
</member>
|
||||||
<member name="rendering/gl_compatibility/force_angle_on_devices" type="Array" setter="" getter="">
|
<member name="rendering/gl_compatibility/force_angle_on_devices" type="Array" setter="" getter="">
|
||||||
An [Array] of devices which should always use the ANGLE renderer.
|
An [Array] of devices which should always use the ANGLE renderer.
|
||||||
|
@ -357,7 +357,7 @@ Error EGLManager::initialize(void *p_native_display) {
|
|||||||
// have to temporarily get a proper display and reload EGL once again to
|
// have to temporarily get a proper display and reload EGL once again to
|
||||||
// initialize everything else.
|
// initialize everything else.
|
||||||
if (!gladLoaderLoadEGL(EGL_NO_DISPLAY)) {
|
if (!gladLoaderLoadEGL(EGL_NO_DISPLAY)) {
|
||||||
ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Can't load EGL.");
|
ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Can't load EGL dynamic library.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLDisplay tmp_display = EGL_NO_DISPLAY;
|
EGLDisplay tmp_display = EGL_NO_DISPLAY;
|
||||||
@ -387,7 +387,7 @@ Error EGLManager::initialize(void *p_native_display) {
|
|||||||
int version = gladLoaderLoadEGL(tmp_display);
|
int version = gladLoaderLoadEGL(tmp_display);
|
||||||
if (!version) {
|
if (!version) {
|
||||||
eglTerminate(tmp_display);
|
eglTerminate(tmp_display);
|
||||||
ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Can't load EGL.");
|
ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Can't load EGL dynamic library.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int major = GLAD_VERSION_MAJOR(version);
|
int major = GLAD_VERSION_MAJOR(version);
|
||||||
|
@ -3609,7 +3609,11 @@ DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowM
|
|||||||
gl_manager_angle = nullptr;
|
gl_manager_angle = nullptr;
|
||||||
bool fallback = GLOBAL_GET("rendering/gl_compatibility/fallback_to_native");
|
bool fallback = GLOBAL_GET("rendering/gl_compatibility/fallback_to_native");
|
||||||
if (fallback) {
|
if (fallback) {
|
||||||
WARN_PRINT("Your video card drivers seem not to support the required Metal version, switching to native OpenGL.");
|
#ifdef EGL_STATIC
|
||||||
|
WARN_PRINT("Your video card drivers seem not to support GLES3 / ANGLE, switching to native OpenGL.");
|
||||||
|
#else
|
||||||
|
WARN_PRINT("Your video card drivers seem not to support GLES3 / ANGLE or ANGLE dynamic libraries (libEGL.dylib and libGLESv2.dylib) are missing, switching to native OpenGL.");
|
||||||
|
#endif
|
||||||
rendering_driver = "opengl3";
|
rendering_driver = "opengl3";
|
||||||
} else {
|
} else {
|
||||||
r_error = ERR_UNAVAILABLE;
|
r_error = ERR_UNAVAILABLE;
|
||||||
|
@ -6183,10 +6183,12 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool gl_supported = true;
|
||||||
if (fallback && (rendering_driver == "opengl3")) {
|
if (fallback && (rendering_driver == "opengl3")) {
|
||||||
Dictionary gl_info = detect_wgl();
|
Dictionary gl_info = detect_wgl();
|
||||||
|
|
||||||
bool force_angle = false;
|
bool force_angle = false;
|
||||||
|
gl_supported = gl_info["version"].operator int() >= 30003;
|
||||||
|
|
||||||
Vector2i device_id = _get_device_ids(gl_info["name"]);
|
Vector2i device_id = _get_device_ids(gl_info["name"]);
|
||||||
Array device_list = GLOBAL_GET("rendering/gl_compatibility/force_angle_on_devices");
|
Array device_list = GLOBAL_GET("rendering/gl_compatibility/force_angle_on_devices");
|
||||||
@ -6210,12 +6212,37 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||||||
if (force_angle || (gl_info["version"].operator int() < 30003)) {
|
if (force_angle || (gl_info["version"].operator int() < 30003)) {
|
||||||
tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
|
tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
|
||||||
if (show_warning) {
|
if (show_warning) {
|
||||||
WARN_PRINT("Your video card drivers seem not to support the required OpenGL 3.3 version, switching to ANGLE.");
|
if (gl_info["version"].operator int() < 30003) {
|
||||||
|
WARN_PRINT("Your video card drivers seem not to support the required OpenGL 3.3 version, switching to ANGLE.");
|
||||||
|
} else {
|
||||||
|
WARN_PRINT("Your video card drivers are known to have low quality OpenGL 3.3 support, switching to ANGLE.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rendering_driver = "opengl3_angle";
|
rendering_driver = "opengl3_angle";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rendering_driver == "opengl3_angle") {
|
||||||
|
gl_manager_angle = memnew(GLManagerANGLE_Windows);
|
||||||
|
tested_drivers.set_flag(DRIVER_ID_COMPAT_ANGLE_D3D11);
|
||||||
|
|
||||||
|
if (gl_manager_angle->initialize() != OK) {
|
||||||
|
memdelete(gl_manager_angle);
|
||||||
|
gl_manager_angle = nullptr;
|
||||||
|
bool fallback_to_native = GLOBAL_GET("rendering/gl_compatibility/fallback_to_native");
|
||||||
|
if (fallback_to_native && gl_supported) {
|
||||||
|
#ifdef EGL_STATIC
|
||||||
|
WARN_PRINT("Your video card drivers seem not to support GLES3 / ANGLE, switching to native OpenGL.");
|
||||||
|
#else
|
||||||
|
WARN_PRINT("Your video card drivers seem not to support GLES3 / ANGLE or ANGLE dynamic libraries (libEGL.dll and libGLESv2.dll) are missing, switching to native OpenGL.");
|
||||||
|
#endif
|
||||||
|
rendering_driver = "opengl3";
|
||||||
|
} else {
|
||||||
|
r_error = ERR_UNAVAILABLE;
|
||||||
|
ERR_FAIL_MSG("Could not initialize ANGLE OpenGL.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (rendering_driver == "opengl3") {
|
if (rendering_driver == "opengl3") {
|
||||||
gl_manager_native = memnew(GLManagerNative_Windows);
|
gl_manager_native = memnew(GLManagerNative_Windows);
|
||||||
tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
|
tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
|
||||||
@ -6224,26 +6251,17 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||||||
memdelete(gl_manager_native);
|
memdelete(gl_manager_native);
|
||||||
gl_manager_native = nullptr;
|
gl_manager_native = nullptr;
|
||||||
r_error = ERR_UNAVAILABLE;
|
r_error = ERR_UNAVAILABLE;
|
||||||
return;
|
ERR_FAIL_MSG("Could not initialize native OpenGL.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rendering_driver == "opengl3") {
|
||||||
RasterizerGLES3::make_current(true);
|
RasterizerGLES3::make_current(true);
|
||||||
}
|
}
|
||||||
if (rendering_driver == "opengl3_angle") {
|
if (rendering_driver == "opengl3_angle") {
|
||||||
gl_manager_angle = memnew(GLManagerANGLE_Windows);
|
|
||||||
tested_drivers.set_flag(DRIVER_ID_COMPAT_ANGLE_D3D11);
|
|
||||||
|
|
||||||
if (gl_manager_angle->initialize() != OK) {
|
|
||||||
memdelete(gl_manager_angle);
|
|
||||||
gl_manager_angle = nullptr;
|
|
||||||
r_error = ERR_UNAVAILABLE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RasterizerGLES3::make_current(false);
|
RasterizerGLES3::make_current(false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String appname;
|
String appname;
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
appname = "Godot.GodotEditor." + String(VERSION_FULL_CONFIG);
|
appname = "Godot.GodotEditor." + String(VERSION_FULL_CONFIG);
|
||||||
|
Loading…
Reference in New Issue
Block a user