[Piglit] [PATCH 03/14] util: Add piglit_glx_get_all_proc_addresses to get a group of function addresses
Ian Romanick
idr at freedesktop.org
Thu Dec 8 15:41:50 PST 2011
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
tests/util/piglit-glx-util.c | 26 ++++++++++++++++++++++++++
tests/util/piglit-glx-util.h | 5 +++++
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index 0900788..e9d7977 100644
--- a/tests/util/piglit-glx-util.c
+++ b/tests/util/piglit-glx-util.c
@@ -385,6 +385,32 @@ piglit_glx_error_string(int err)
}
}
+/**
+ * Get the procedure adddresses for a group of function names
+ *
+ * \note
+ * If any call to \c glXGetProcAddress fails, this function will call
+ * \c piglit_report_result with \c PIGLIT_FAIL.
+ */
+void
+piglit_glx_get_all_proc_addresses(__GLXextFuncPtr **procedures,
+ const char *const *names,
+ unsigned num)
+{
+ unsigned i;
+
+ for (i = 0; i < num; i++) {
+ *(procedures[i]) =
+ glXGetProcAddress((const GLubyte *) names[i]);
+ if (procedures[i] == NULL) {
+ fprintf(stderr,
+ "Failed to get function pointer for %s.\n",
+ names[i]);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+ }
+}
+
/* Creates a GLX context for rendering into an FBO */
void
piglit_framework_fbo_init_glx()
diff --git a/tests/util/piglit-glx-util.h b/tests/util/piglit-glx-util.h
index e05688c..356131a 100644
--- a/tests/util/piglit-glx-util.h
+++ b/tests/util/piglit-glx-util.h
@@ -55,3 +55,8 @@ piglit_glx_get_error(Display *dpy, XErrorEvent *err);
const char *
piglit_glx_error_string(int err);
+
+void
+piglit_glx_get_all_proc_addresses(__GLXextFuncPtr **procedures,
+ const char *const *names,
+ unsigned num);
--
1.7.6.4
More information about the Piglit
mailing list