]> git.cworth.org Git - apitrace/commitdiff
Enable framebuffer dump during replay for EGL.
authorTianpu Han <hantempo@gmail.com>
Thu, 19 Jan 2012 13:22:02 +0000 (14:22 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 14 Mar 2012 20:29:37 +0000 (20:29 +0000)
Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
glstate.cpp

index d54764ce7bf5e8b6c9b8db59bc420e88bebfa5a0..ccbc9102277126710b709c5b2b8964fe2eb7782e 100644 (file)
@@ -695,7 +695,31 @@ dumpTextures(JSONWriter &json)
 
 static bool
 getDrawableBounds(GLint *width, GLint *height) {
-#if defined(_WIN32)
+#if defined(TRACE_EGL)
+
+    EGLContext currentContext = eglGetCurrentContext();
+    if (currentContext == EGL_NO_CONTEXT) {
+        return false;
+    }
+
+    EGLSurface currentSurface = eglGetCurrentSurface(EGL_DRAW);
+    if (currentSurface == EGL_NO_SURFACE) {
+        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;
+    }
+
+    return true;
+
+#elif defined(_WIN32)
 
     HDC hDC = wglGetCurrentDC();
     if (!hDC) {
@@ -735,10 +759,10 @@ getDrawableBounds(GLint *width, GLint *height) {
 
     *width = rect.size.width;
     *height = rect.size.height;
+    return true;
 
-#else
+#elif defined(HAVE_X11)
 
-#if !TRACE_EGL
     Display *display;
     Drawable drawable;
     Window root;
@@ -761,13 +785,13 @@ getDrawableBounds(GLint *width, GLint *height) {
 
     *width = w;
     *height = h;
+    return true;
+
 #else
+
     return false;
-#endif
 
 #endif
-
-    return true;
 }