EGL: use eglGetPlatformDisplay if available (#865)

POSIX Ports: When acquiring an EGL context, try calling the client-specific eglGetPlatformDisplay() before falling back to the more generic eglGetDisplay(). Hopefully fixes #864.
This commit is contained in:
Max Fedotov 2024-11-13 09:50:35 +03:00 committed by GitHub
parent 2c7fac57ff
commit 1192bf6f2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 2 deletions

View File

@ -45,8 +45,18 @@ static bool __egl_initOpenGL(const int requestedAPI, const int requestedProfile,
EGLint eglMajorVersion;
EGLint eglMinorVersion;
currDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
EGLAttrib displayAttr[] = {EGL_NONE};
currDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, EGL_DEFAULT_DISPLAY, displayAttr);
if(currDisplay == EGL_NO_DISPLAY)
currDisplay = eglGetPlatformDisplay(EGL_PLATFORM_XCB_EXT, EGL_DEFAULT_DISPLAY, displayAttr);
if(currDisplay == EGL_NO_DISPLAY)
currDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if(currDisplay == EGL_NO_DISPLAY)
{
puts("EGL: failed to obtain display handle");
return false;
}
if (eglInitialize(currDisplay, &eglMajorVersion, &eglMinorVersion) == EGL_FALSE)
{
puts("EGL: eglInitialize failed");