From 0582a6dfacf0f4be1b266390e6b43910d13f5bf4 Mon Sep 17 00:00:00 2001 From: Tianpu Han Date: Thu, 19 Jan 2012 14:22:02 +0100 Subject: [PATCH] Enable framebuffer dump during replay for EGL. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: José Fonseca --- glstate.cpp | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/glstate.cpp b/glstate.cpp index d54764c..ccbc910 100644 --- a/glstate.cpp +++ b/glstate.cpp @@ -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; } -- 2.45.2