Merge pull request #95934 from bruvzg/win_ang_fb
Enable fallback from ANGLE to native and improve ANGLE error messages.
This commit is contained in:
commit
28a72fa434
|
@ -2526,8 +2526,8 @@
|
|||
[b]Note:[/b] This setting is implemented only on Linux/X11.
|
||||
</member>
|
||||
<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.
|
||||
[b]Note:[/b] This setting is implemented only on macOS.
|
||||
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 on macOS and Windows.
|
||||
</member>
|
||||
<member name="rendering/gl_compatibility/force_angle_on_devices" type="Array" setter="" getter="">
|
||||
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
|
||||
// initialize everything else.
|
||||
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;
|
||||
|
@ -387,7 +387,7 @@ Error EGLManager::initialize(void *p_native_display) {
|
|||
int version = gladLoaderLoadEGL(tmp_display);
|
||||
if (!version) {
|
||||
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);
|
||||
|
|
|
@ -3609,7 +3609,11 @@ DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowM
|
|||
gl_manager_angle = nullptr;
|
||||
bool fallback = GLOBAL_GET("rendering/gl_compatibility/fallback_to_native");
|
||||
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";
|
||||
} else {
|
||||
r_error = ERR_UNAVAILABLE;
|
||||
|
|
|
@ -6183,10 +6183,12 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
#endif
|
||||
}
|
||||
|
||||
bool gl_supported = true;
|
||||
if (fallback && (rendering_driver == "opengl3")) {
|
||||
Dictionary gl_info = detect_wgl();
|
||||
|
||||
bool force_angle = false;
|
||||
gl_supported = gl_info["version"].operator int() >= 30003;
|
||||
|
||||
Vector2i device_id = _get_device_ids(gl_info["name"]);
|
||||
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)) {
|
||||
tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
|
||||
if (show_warning) {
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
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") {
|
||||
gl_manager_native = memnew(GLManagerNative_Windows);
|
||||
tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
|
||||
|
@ -6224,26 +6251,17 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
memdelete(gl_manager_native);
|
||||
gl_manager_native = nullptr;
|
||||
r_error = ERR_UNAVAILABLE;
|
||||
return;
|
||||
ERR_FAIL_MSG("Could not initialize native OpenGL.");
|
||||
}
|
||||
}
|
||||
|
||||
if (rendering_driver == "opengl3") {
|
||||
RasterizerGLES3::make_current(true);
|
||||
}
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
String appname;
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
appname = "Godot.GodotEditor." + String(VERSION_FULL_CONFIG);
|
||||
|
|
Loading…
Reference in New Issue