X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=glstate_images.cpp;h=2c7c66b407dae4192199b09f72bb05d51e8e98f4;hb=afc32ba8ccfcd9b5f457d2588b8a79ba0a9aeb3d;hp=2c4d933c430e3dabd13e6dfa89fb4dd1caf718c4;hpb=127e4e0b5a6509046ee77f691f690fdce1c84079;p=apitrace 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) {