From 71c32f408cace48a7e3754523ea3f37c64be545a Mon Sep 17 00:00:00 2001 From: thesource Date: Tue, 12 Nov 2024 10:23:21 +0300 Subject: [PATCH] EGL: use eglGetPlatformDisplay if available --- desmume/src/frontend/posix/shared/egl_3Demu.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/desmume/src/frontend/posix/shared/egl_3Demu.cpp b/desmume/src/frontend/posix/shared/egl_3Demu.cpp index 7ca1cb3db..e344568bf 100644 --- a/desmume/src/frontend/posix/shared/egl_3Demu.cpp +++ b/desmume/src/frontend/posix/shared/egl_3Demu.cpp @@ -45,8 +45,20 @@ static bool __egl_initOpenGL(const int requestedAPI, const int requestedProfile, EGLint eglMajorVersion; EGLint eglMinorVersion; - + +#ifdef EGL_VERSION_1_5 + EGLAttrib attr[] = {EGL_NONE}; + currDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, EGL_DEFAULT_DISPLAY, attr); + if(currDisplay == EGL_NO_DISPLAY) + currDisplay = eglGetPlatformDisplay(EGL_PLATFORM_XCB_EXT, EGL_DEFAULT_DISPLAY, attr); +#else currDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); +#endif + 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");