]> git.cworth.org Git - apitrace/commitdiff
glstate: Fallback to GLX when there is no current EGL context (issue #124).
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 28 Apr 2013 21:32:27 +0000 (22:32 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 28 Apr 2013 21:32:37 +0000 (22:32 +0100)
retrace/glstate_images.cpp

index ad60486b5b2891619b339fbe7bc8c59c35f72a09..b95b8cc2411e0f97ed19ad1d5c795588fc10e947 100644 (file)
@@ -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