summaryrefslogtreecommitdiff
path: root/tests/spec/glx_oml_sync_control
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2014-04-18 11:39:31 -0700
committerEric Anholt <eric@anholt.net>2014-10-10 17:26:53 +0200
commita5d33065cb99562f60cf46436a950bf08c73d0af (patch)
tree0bd08f27821339894743a13a73e800a788a16e43 /tests/spec/glx_oml_sync_control
parentfff28f4c7d7e7c4c959f918078473bff92efaf70 (diff)
Simplify piglit_glx_get_all_proc_addresses API.
I couldn't stand the number of ways this API could be misused and the amount of code duplication it forced--two closely related issues. This also fixes a bug: The "Failed to get function pointer" test could never have triggered unless the caller passed incorrect arguments, which is not the kind of error it was intended to be testing for. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'tests/spec/glx_oml_sync_control')
-rw-r--r--tests/spec/glx_oml_sync_control/common.c30
-rw-r--r--tests/spec/glx_oml_sync_control/common.h10
2 files changed, 16 insertions, 24 deletions
diff --git a/tests/spec/glx_oml_sync_control/common.c b/tests/spec/glx_oml_sync_control/common.c
index 58c25c7cb..2b2f5a10e 100644
--- a/tests/spec/glx_oml_sync_control/common.c
+++ b/tests/spec/glx_oml_sync_control/common.c
@@ -39,6 +39,16 @@ PFNGLXGETMSCRATEOMLPROC __piglit_glXGetMscRateOML;
PFNGLXSWAPBUFFERSMSCOMLPROC __piglit_glXSwapBuffersMscOML;
PFNGLXWAITFORMSCOMLPROC __piglit_glXWaitForMscOML;
PFNGLXWAITFORSBCOMLPROC __piglit_glXWaitForSbcOML;
+
+#define ADD_FUNC(name) PIGLIT_GLX_PROC(__piglit_##name, name)
+static const struct piglit_glx_proc_reference procs[] = {
+ ADD_FUNC(glXGetSyncValuesOML),
+ ADD_FUNC(glXGetMscRateOML),
+ ADD_FUNC(glXSwapBuffersMscOML),
+ ADD_FUNC(glXWaitForMscOML),
+ ADD_FUNC(glXWaitForSbcOML),
+};
+
Window win;
XVisualInfo *visinfo;
@@ -47,24 +57,6 @@ piglit_oml_sync_control_test_run(enum piglit_result (*draw)(Display *dpy))
{
Display *dpy;
GLXContext ctx;
- const int proc_count = 5;
- __GLXextFuncPtr *procs[proc_count];
- const char *names[proc_count];
- int i;
-
-#define ADD_FUNC(name) \
- do { \
- procs[i] = (__GLXextFuncPtr *)&(__piglit_##name); \
- names[i] = #name; \
- i++; \
- } while (0)
-
- i = 0;
- ADD_FUNC(glXGetSyncValuesOML);
- ADD_FUNC(glXGetMscRateOML);
- ADD_FUNC(glXSwapBuffersMscOML);
- ADD_FUNC(glXWaitForMscOML);
- ADD_FUNC(glXWaitForSbcOML);
dpy = XOpenDisplay(NULL);
if (dpy == NULL) {
@@ -73,7 +65,7 @@ piglit_oml_sync_control_test_run(enum piglit_result (*draw)(Display *dpy))
}
piglit_require_glx_extension(dpy, "GLX_OML_sync_control");
- piglit_glx_get_all_proc_addresses(procs, names, ARRAY_SIZE(procs));
+ piglit_glx_get_all_proc_addresses(procs, ARRAY_SIZE(procs));
visinfo = piglit_get_glx_visual(dpy);
win = piglit_get_glx_window(dpy, visinfo);
diff --git a/tests/spec/glx_oml_sync_control/common.h b/tests/spec/glx_oml_sync_control/common.h
index c06bdd7b8..40ef4a3e9 100644
--- a/tests/spec/glx_oml_sync_control/common.h
+++ b/tests/spec/glx_oml_sync_control/common.h
@@ -1,8 +1,8 @@
-#define glXGetSyncValuesOML __piglit_glXGetSyncValuesOML
-#define glXGetMscRateOML __piglit_glXGetMscRateOML
-#define glXSwapBuffersMscOML __piglit_glXSwapBuffersMscOML
-#define glXWaitForMscOML __piglit_glXWaitForMscOML
-#define glXWaitForSbcOML __piglit_glXWaitForSbcOML
+#define glXGetSyncValuesOML(dpy, drawable, ust, msc, sbc) __piglit_glXGetSyncValuesOML(dpy, drawable, ust, msc, sbc)
+#define glXGetMscRateOML(dpy, drawable, numerator, denominator) __piglit_glXGetMscRateOML(dpy, drawable, numerator, denominator)
+#define glXSwapBuffersMscOML(dpy, drawable, target_msc, divisor, remainder) __piglit_glXSwapBuffersMscOML(dpy, drawable, target_msc, divisor, remainder)
+#define glXWaitForMscOML(dpy, drawable, target_msc, divisor, remainder, ust, msc, sbc) __piglit_glXWaitForMscOML(dpy, drawable, target_msc, divisor, remainder, ust, msc, sbc)
+#define glXWaitForSbcOML(dpy, drawable, target_sbc, ust, msc, sbc) __piglit_glXWaitForSbcOML(dpy, drawable, target_sbc, ust, msc, sbc)
extern PFNGLXGETSYNCVALUESOMLPROC __piglit_glXGetSyncValuesOML;
extern PFNGLXGETMSCRATEOMLPROC __piglit_glXGetMscRateOML;