From 4c74c7d11a9219044acd155816e4c496f0cc0cf8 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 1 Nov 2023 08:34:35 +0200 Subject: [PATCH] [macOS] Improve ANGLE support detection. Try opening EGL display when checking if ANGLE is supported. --- drivers/egl/egl_manager.cpp | 9 +++++++++ drivers/egl/egl_manager.h | 1 + platform/macos/display_server_macos.mm | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/egl/egl_manager.cpp b/drivers/egl/egl_manager.cpp index c92cfea9af1..10c2119260d 100644 --- a/drivers/egl/egl_manager.cpp +++ b/drivers/egl/egl_manager.cpp @@ -173,6 +173,15 @@ Error EGLManager::_gldisplay_create_context(GLDisplay &p_gldisplay) { return OK; } +Error EGLManager::open_display(void *p_display) { + int gldisplay_id = _get_gldisplay_id(p_display); + if (gldisplay_id < 0) { + return ERR_CANT_CREATE; + } else { + return OK; + } +} + int EGLManager::display_get_native_visual_id(void *p_display) { int gldisplay_id = _get_gldisplay_id(p_display); ERR_FAIL_COND_V(gldisplay_id < 0, ERR_CANT_CREATE); diff --git a/drivers/egl/egl_manager.h b/drivers/egl/egl_manager.h index 5814cb98267..c3a749cd196 100644 --- a/drivers/egl/egl_manager.h +++ b/drivers/egl/egl_manager.h @@ -92,6 +92,7 @@ private: public: int display_get_native_visual_id(void *p_display); + Error open_display(void *p_display); Error window_create(DisplayServer::WindowID p_window_id, void *p_display, void *p_native_window, int p_width, int p_height); void window_destroy(DisplayServer::WindowID p_window_id); diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 09df60bf062..6015aa96cd7 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -4501,7 +4501,7 @@ DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowM #if defined(GLES3_ENABLED) if (rendering_driver == "opengl3_angle") { gl_manager_angle = memnew(GLManagerANGLE_MacOS); - if (gl_manager_angle->initialize() != OK) { + if (gl_manager_angle->initialize() != OK || gl_manager_angle->open_display(nullptr) != OK) { memdelete(gl_manager_angle); gl_manager_angle = nullptr; bool fallback = GLOBAL_GET("rendering/gl_compatibility/fallback_to_native");