summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/egl_common.c7
-rw-r--r--test/glx_common.c2
-rw-r--r--test/glx_common.h2
-rw-r--r--test/glx_glxgetprocaddress_nocontext.c3
-rw-r--r--test/glx_public_api_core.c25
5 files changed, 23 insertions, 16 deletions
diff --git a/test/egl_common.c b/test/egl_common.c
index 4cc0409..d2f11a3 100644
--- a/test/egl_common.c
+++ b/test/egl_common.c
@@ -23,6 +23,7 @@
#include <err.h>
#include <epoxy/egl.h>
+#include "egl_common.h"
/**
* Do whatever it takes to get us an EGL display for the system.
@@ -34,15 +35,17 @@ get_egl_display_or_skip(void)
{
Display *dpy = XOpenDisplay(NULL);
EGLint major, minor;
+ EGLDisplay *edpy;
+ bool ok;
if (!dpy)
errx(77, "couldn't open display\n");
- EGLDisplay *edpy = eglGetDisplay(dpy);
+ edpy = eglGetDisplay(dpy);
if (!edpy)
errx(1, "Couldn't get EGL display for X11 Display.\n");
- bool ok = eglInitialize(edpy, &major, &minor);
+ ok = eglInitialize(edpy, &major, &minor);
if (!ok)
errx(1, "eglInitialize() failed\n");
diff --git a/test/glx_common.c b/test/glx_common.c
index 4a1d460..fda1602 100644
--- a/test/glx_common.c
+++ b/test/glx_common.c
@@ -24,7 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
-#include "epoxy/glx.h"
+#include "glx_common.h"
Display *
get_display_or_skip(void)
diff --git a/test/glx_common.h b/test/glx_common.h
index 3a2e41d..8b6c263 100644
--- a/test/glx_common.h
+++ b/test/glx_common.h
@@ -26,7 +26,7 @@
Display *
get_display_or_skip(void);
-GLXContext
+void
make_glx_context_current_or_skip(Display *dpy);
GLXFBConfig
diff --git a/test/glx_glxgetprocaddress_nocontext.c b/test/glx_glxgetprocaddress_nocontext.c
index fc81894..2182215 100644
--- a/test/glx_glxgetprocaddress_nocontext.c
+++ b/test/glx_glxgetprocaddress_nocontext.c
@@ -43,12 +43,13 @@ int
main(int argc, char **argv)
{
bool pass = true;
+ void *func;
dpy = get_display_or_skip();
if (epoxy_glx_version(dpy, 0) < 14)
errx(77, "GLX version 1.4 required for glXGetProcAddress().\n");
- void *func = glXGetProcAddress((const GLubyte *)"glGetString");
+ func = glXGetProcAddress((const GLubyte *)"glGetString");
if (!func)
errx(1, "glXGetProcAddress() returned NULL\n");
diff --git a/test/glx_public_api_core.c b/test/glx_public_api_core.c
index c130d86..29252ec 100644
--- a/test/glx_public_api_core.c
+++ b/test/glx_public_api_core.c
@@ -134,15 +134,9 @@ int
main(int argc, char **argv)
{
bool pass = true;
-
- dpy = get_display_or_skip();
-
- if (!epoxy_has_glx_extension(dpy, 0, "GLX_ARB_create_context_profile"))
- errx(77, "Test requires GLX_ARB_create_context_profile");
-
- XVisualInfo *visinfo = get_glx_visual(dpy);
- Window win = get_glx_window(dpy, visinfo, false);
- GLXFBConfig config = get_fbconfig_for_visinfo(dpy, visinfo);
+ XVisualInfo *visinfo;
+ Window win;
+ GLXFBConfig config;
static const int attribs[] = {
GLX_CONTEXT_PROFILE_MASK_ARB,
GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
@@ -152,8 +146,17 @@ main(int argc, char **argv)
2,
None
};
- GLXContext ctx = glXCreateContextAttribsARB(dpy, config, NULL, True,
- attribs);
+ GLXContext ctx;
+
+ dpy = get_display_or_skip();
+
+ if (!epoxy_has_glx_extension(dpy, 0, "GLX_ARB_create_context_profile"))
+ errx(77, "Test requires GLX_ARB_create_context_profile");
+
+ visinfo = get_glx_visual(dpy);
+ win = get_glx_window(dpy, visinfo, false);
+ config = get_fbconfig_for_visinfo(dpy, visinfo);
+ ctx = glXCreateContextAttribsARB(dpy, config, NULL, True, attribs);
if (ctx == None)
errx(77, "glXCreateContext failed");