summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYaron Cohen-Tal <yaronct@gmail.com>2015-07-19 20:55:36 +0300
committerYaron Cohen-Tal <yaronct@gmail.com>2015-08-24 12:36:35 +0300
commit540952010bc2707bedfbbfe89c77d1a1640e76ae (patch)
tree296a85f508220d0c5877d0c803a6cd47e7d788b1 /test
parent4c4a6e49ca6a5d0d4ff103ecbd4e70617805afce (diff)
downloadlibepoxy-540952010bc2707bedfbbfe89c77d1a1640e76ae.tar.gz
Fix tests to work with some OpenGL ES / EGL implementations.
Diffstat (limited to 'test')
-rw-r--r--test/egl_and_glx_different_pointers.c10
-rw-r--r--test/egl_common.c10
-rw-r--r--test/egl_common.h2
-rw-r--r--test/egl_gl.c8
-rw-r--r--test/egl_has_extension_nocontext.c2
-rw-r--r--test/egl_without_glx.c36
6 files changed, 22 insertions, 46 deletions
diff --git a/test/egl_and_glx_different_pointers.c b/test/egl_and_glx_different_pointers.c
index 2a2ff3c..9d95f3a 100644
--- a/test/egl_and_glx_different_pointers.c
+++ b/test/egl_and_glx_different_pointers.c
@@ -136,7 +136,7 @@ init_glx(Display **out_dpy, GLXContext *out_ctx, Drawable *out_draw)
#ifdef USE_EGL
static bool
-make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
+make_egl_current_and_test(EGLDisplay dpy, EGLContext ctx)
{
const char *string;
GLuint shader;
@@ -171,15 +171,15 @@ make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
}
static void
-init_egl(EGLDisplay **out_dpy, EGLContext *out_ctx)
+init_egl(EGLDisplay *out_dpy, EGLContext *out_ctx)
{
- EGLDisplay *dpy = get_egl_display_or_skip();
+ EGLDisplay dpy = get_egl_display_or_skip();
static const EGLint config_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
static const EGLint context_attribs[] = {
@@ -212,7 +212,7 @@ main(int argc, char **argv)
{
bool pass = true;
#ifdef USE_EGL
- EGLDisplay *egl_dpy;
+ EGLDisplay egl_dpy;
EGLContext egl_ctx;
#endif
#ifdef USE_GLX
diff --git a/test/egl_common.c b/test/egl_common.c
index d2f11a3..b1ca06f 100644
--- a/test/egl_common.c
+++ b/test/egl_common.c
@@ -24,25 +24,25 @@
#include <err.h>
#include <epoxy/egl.h>
#include "egl_common.h"
+#include <X11/Xlib.h>
/**
* Do whatever it takes to get us an EGL display for the system.
*
* This needs to be ported to other window systems.
*/
-EGLDisplay *
+EGLDisplay
get_egl_display_or_skip(void)
{
Display *dpy = XOpenDisplay(NULL);
EGLint major, minor;
- EGLDisplay *edpy;
+ EGLDisplay edpy;
bool ok;
if (!dpy)
errx(77, "couldn't open display\n");
-
- edpy = eglGetDisplay(dpy);
- if (!edpy)
+ edpy = eglGetDisplay((EGLNativeDisplayType)dpy);
+ if (edpy == EGL_NO_DISPLAY)
errx(1, "Couldn't get EGL display for X11 Display.\n");
ok = eglInitialize(edpy, &major, &minor);
diff --git a/test/egl_common.h b/test/egl_common.h
index 1c5963b..93571dc 100644
--- a/test/egl_common.h
+++ b/test/egl_common.h
@@ -21,5 +21,5 @@
* IN THE SOFTWARE.
*/
-EGLDisplay *
+EGLDisplay
get_egl_display_or_skip(void);
diff --git a/test/egl_gl.c b/test/egl_gl.c
index c3fb3c2..99576d3 100644
--- a/test/egl_gl.c
+++ b/test/egl_gl.c
@@ -44,7 +44,7 @@
#include "dlwrap.h"
static bool
-make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
+make_egl_current_and_test(EGLDisplay dpy, EGLContext ctx)
{
const char *string;
GLuint shader;
@@ -73,9 +73,9 @@ make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
}
static void
-init_egl(EGLDisplay **out_dpy, EGLContext *out_ctx)
+init_egl(EGLDisplay *out_dpy, EGLContext *out_ctx)
{
- EGLDisplay *dpy = get_egl_display_or_skip();
+ EGLDisplay dpy = get_egl_display_or_skip();
static const EGLint config_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
@@ -113,7 +113,7 @@ int
main(int argc, char **argv)
{
bool pass = true;
- EGLDisplay *egl_dpy;
+ EGLDisplay egl_dpy;
EGLContext egl_ctx;
/* Force epoxy to have loaded both EGL and GLX libs already -- we
diff --git a/test/egl_has_extension_nocontext.c b/test/egl_has_extension_nocontext.c
index 94a7faa..e8c76a8 100644
--- a/test/egl_has_extension_nocontext.c
+++ b/test/egl_has_extension_nocontext.c
@@ -43,7 +43,7 @@ main(int argc, char **argv)
{
bool pass = true;
- EGLDisplay *dpy = get_egl_display_or_skip();
+ EGLDisplay dpy = get_egl_display_or_skip();
const char *extensions = eglQueryString(dpy, EGL_EXTENSIONS);
char *first_space;
char *an_extension;
diff --git a/test/egl_without_glx.c b/test/egl_without_glx.c
index 9326b5a..c3dcc22 100644
--- a/test/egl_without_glx.c
+++ b/test/egl_without_glx.c
@@ -43,34 +43,6 @@
#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;
@@ -119,7 +91,7 @@ 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
@@ -130,7 +102,11 @@ main(int argc, char **argv)
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
+#if GLES_VERSION == 2
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+#else
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
+#endif
EGL_NONE
};
EGLint count;