summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jose.r.fonseca@gmail.com>2013-04-28 22:32:27 +0100
committerJosé Fonseca <jose.r.fonseca@gmail.com>2013-04-28 22:32:37 +0100
commit3941d9f80df99d47579b2619d36b61f8cc7ec3c3 (patch)
tree4cbbb6512535faa9a05001ee7b942c441360a9a4
parent5ad7df843373b6311d2a37c4431c8c8e31cf1243 (diff)
glstate: Fallback to GLX when there is no current EGL context (issue #124).
-rw-r--r--retrace/glstate_images.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/retrace/glstate_images.cpp b/retrace/glstate_images.cpp
index ad60486b..b95b8cc2 100644
--- a/retrace/glstate_images.cpp
+++ b/retrace/glstate_images.cpp
@@ -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