Fallback to eglGetDisplay() when eglGetPlatformDisplayEXT() returns EGL_NO_DISPLAY

This commit is contained in:
Kovid Goyal 2025-08-16 08:13:40 +05:30
parent 5ca22d660e
commit 363afac8af
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

6
glfw/egl_context.c vendored
View file

@ -388,6 +388,7 @@ bool _glfwInitEGL(void)
} }
_glfw.egl.platform = _glfwPlatformGetEGLPlatform(&attribs); _glfw.egl.platform = _glfwPlatformGetEGLPlatform(&attribs);
_glfw.egl.display = EGL_NO_DISPLAY;
if (_glfw.egl.platform) if (_glfw.egl.platform)
{ {
_glfw.egl.display = _glfw.egl.display =
@ -395,10 +396,11 @@ bool _glfwInitEGL(void)
_glfwPlatformGetEGLNativeDisplay(), _glfwPlatformGetEGLNativeDisplay(),
attribs); attribs);
} }
else free(attribs);
if (_glfw.egl.display == EGL_NO_DISPLAY)
_glfw.egl.display = eglGetDisplay(_glfwPlatformGetEGLNativeDisplay()); _glfw.egl.display = eglGetDisplay(_glfwPlatformGetEGLNativeDisplay());
free(attribs);
EGLint egl_err; EGLint egl_err;
if (_glfw.egl.display == EGL_NO_DISPLAY && (egl_err = eglGetError()) != EGL_SUCCESS) if (_glfw.egl.display == EGL_NO_DISPLAY && (egl_err = eglGetError()) != EGL_SUCCESS)