Skip to content

Commit

Permalink
EGL: use eglGetPlatformDisplay if available (#865)
Browse files Browse the repository at this point in the history
POSIX Ports: When acquiring an EGL context, try calling the client-specific eglGetPlatformDisplay() before falling back to the more generic eglGetDisplay(). Hopefully fixes #864.
  • Loading branch information
thesourcehim authored Nov 13, 2024
1 parent 2c7fac5 commit 1192bf6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions desmume/src/frontend/posix/shared/egl_3Demu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 1192bf6

Please sign in to comment.