From afc32ba8ccfcd9b5f457d2588b8a79ba0a9aeb3d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 30 Mar 2012 00:18:16 +0100 Subject: [PATCH] Drop TRACE_EGL. Also unnecessary. --- CMakeLists.txt | 7 ------- glproc.py | 10 +++++++--- glstate_images.cpp | 44 +++++++++++++++++++++++++------------------- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c637b4..412dd41 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -506,12 +506,6 @@ if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE) add_dependencies (egltrace glproc) - set_property ( - TARGET egltrace - APPEND - PROPERTY COMPILE_DEFINITIONS "TRACE_EGL" - ) - set_target_properties (egltrace PROPERTIES # avoid the default "lib" prefix PREFIX "" @@ -628,7 +622,6 @@ if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE) TARGET eglretrace APPEND PROPERTY COMPILE_DEFINITIONS "RETRACE" - PROPERTY COMPILE_DEFINITIONS "TRACE_EGL" ) target_link_libraries (eglretrace diff --git a/glproc.py b/glproc.py index 95ab80f..0f03d8d 100644 --- a/glproc.py +++ b/glproc.py @@ -515,20 +515,24 @@ if __name__ == '__main__': print '#include "glimports.hpp"' print '#include "os.hpp"' print - print dispatcher = GlDispatcher() + print dispatcher.header() - print '#if defined(TRACE_EGL)' print dispatcher.dispatch_api(eglapi) - print '#elif defined(_WIN32)' + print + print '#if defined(_WIN32)' print dispatcher.dispatch_api(wglapi) + print print '#elif defined(__APPLE__)' + print dispatcher.dispatch_api(cglapi) + print print '#else' print dispatcher.dispatch_api(glxapi) + print print '#endif' print dispatcher.dispatch_api(glapi) diff --git a/glstate_images.cpp b/glstate_images.cpp index 2c4d933..2c7c66b 100644 --- a/glstate_images.cpp +++ b/glstate_images.cpp @@ -37,6 +37,10 @@ #include "glstate_internal.hpp" +#ifdef __linux__ +#include +#endif + #ifdef __APPLE__ #include @@ -443,31 +447,33 @@ dumpTextures(JSONWriter &json, Context &context) static bool getDrawableBounds(GLint *width, GLint *height) { -#if defined(TRACE_EGL) +#if defined(__linux__) + if (dlsym(RTLD_DEFAULT, "eglGetCurrentContext")) { + EGLContext currentContext = eglGetCurrentContext(); + if (currentContext == EGL_NO_CONTEXT) { + return false; + } - EGLContext currentContext = eglGetCurrentContext(); - if (currentContext == EGL_NO_CONTEXT) { - return false; - } + 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; } +#endif - return true; - -#elif defined(_WIN32) +#if defined(_WIN32) HDC hDC = wglGetCurrentDC(); if (!hDC) { -- 2.43.0