summaryrefslogtreecommitdiff
path: root/test/egl_without_glx.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2016-12-07 14:45:14 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2016-12-07 14:45:14 +0000
commit8dead45cb366bf5c08539bef2ccaa36b80eb1483 (patch)
tree25bdc2041b9d00d0e2e1e46ece0f96b8aaca0527 /test/egl_without_glx.c
parent0aa9d1bc831683bfe93980eb3cffa1f0c2f058fb (diff)
downloadlibepoxy-8dead45cb366bf5c08539bef2ccaa36b80eb1483.tar.gz
Revert all changes since 8bbc0d40
Most of the changes that happened after commit 8bbc0d40 broke epoxy pretty much irreparably because of the CMake build and the attempt at making libepoxy a static library that can be copy-pasted into another project without generating files. Since all the commits are entangled, and are full of unrelated changes, we cannot simply do a localized set of reverts; instead, we need to hit the reset button. From this point forward, we're going to improve libepoxy's build while attempting to keep the existing build system working. This may mean reinstating the CMake build system at a later date.
Diffstat (limited to 'test/egl_without_glx.c')
-rw-r--r--test/egl_without_glx.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/test/egl_without_glx.c b/test/egl_without_glx.c
index 3ba2825..9326b5a 100644
--- a/test/egl_without_glx.c
+++ b/test/egl_without_glx.c
@@ -43,6 +43,34 @@
#include "egl_common.h"
+/**
+ * Wraps the system dlopen(), which libepoxy will end up calling when
+ * it tries to dlopen() the API libraries, and errors out the
+ * libraries we're trying to simulate not being installed on the
+ * system.
+ */
+void *
+dlopen(const char *filename, int flag)
+{
+ void * (*dlopen_unwrapped)(const char *filename, int flag);
+
+ if (!strcmp(filename, "libGL.so.1"))
+ return NULL;
+#if GLES_VERSION == 2
+ if (!strcmp(filename, "libGLESv1_CM.so.1"))
+ return NULL;
+#else
+ if (!strcmp(filename, "libGLESv2.so.2"))
+ return NULL;
+#endif
+
+ dlopen_unwrapped = dlsym(RTLD_NEXT, "dlopen");
+ assert(dlopen_unwrapped);
+
+ return dlopen_unwrapped(filename, flag);
+}
+
+
static EGLenum last_api;
static EGLenum extra_error = EGL_SUCCESS;
@@ -87,10 +115,11 @@ override_eglGetError(void)
return real_eglGetError();
}
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
- EGLDisplay dpy = get_egl_display_or_skip();
+ EGLDisplay *dpy = get_egl_display_or_skip();
EGLint context_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, GLES_VERSION,
EGL_NONE
@@ -101,11 +130,7 @@ int main(void)
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
-#if GLES_VERSION == 2
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
-#else
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
-#endif
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE
};
EGLint count;