diff options
author | José Fonseca <jose.r.fonseca@gmail.com> | 2013-04-28 22:32:27 +0100 |
---|---|---|
committer | José Fonseca <jose.r.fonseca@gmail.com> | 2013-04-28 22:32:37 +0100 |
commit | 3941d9f80df99d47579b2619d36b61f8cc7ec3c3 (patch) | |
tree | 4cbbb6512535faa9a05001ee7b942c441360a9a4 | |
parent | 5ad7df843373b6311d2a37c4431c8c8e31cf1243 (diff) |
glstate: Fallback to GLX when there is no current EGL context (issue #124).
-rw-r--r-- | retrace/glstate_images.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/retrace/glstate_images.cpp b/retrace/glstate_images.cpp index ad60486b..b95b8cc2 100644 --- a/retrace/glstate_images.cpp +++ b/retrace/glstate_images.cpp @@ -518,26 +518,24 @@ getDrawableBounds(GLint *width, GLint *height) { #if defined(__linux__) if (dlsym(RTLD_DEFAULT, "eglGetCurrentContext")) { EGLContext currentContext = eglGetCurrentContext(); - if (currentContext == EGL_NO_CONTEXT) { - return false; - } + if (currentContext != EGL_NO_CONTEXT) { + EGLSurface currentSurface = eglGetCurrentSurface(EGL_DRAW); + if (currentSurface == EGL_NO_SURFACE) { + return false; + } - EGLSurface currentSurface = eglGetCurrentSurface(EGL_DRAW); - if (currentSurface == EGL_NO_SURFACE) { - return false; - } + EGLDisplay currentDisplay = eglGetCurrentDisplay(); + if (currentDisplay == EGL_NO_DISPLAY) { + return false; + } - EGLDisplay currentDisplay = eglGetCurrentDisplay(); - if (currentDisplay == EGL_NO_DISPLAY) { - return false; - } + if (!eglQuerySurface(currentDisplay, currentSurface, EGL_WIDTH, width) || + !eglQuerySurface(currentDisplay, currentSurface, EGL_HEIGHT, height)) { + return false; + } - if (!eglQuerySurface(currentDisplay, currentSurface, EGL_WIDTH, width) || - !eglQuerySurface(currentDisplay, currentSurface, EGL_HEIGHT, height)) { - return false; + return true; } - - return true; } #endif |