[Piglit] [PATCH 04/14] util: Add piglit_is_glx_extension_supported
Ian Romanick
idr at freedesktop.org
Thu Dec 8 15:41:51 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 | 14 ++++++++++++--
tests/util/piglit-glx-util.h | 1 +
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index e9d7977..6bd512f 100644
--- a/tests/util/piglit-glx-util.c
+++ b/tests/util/piglit-glx-util.c
@@ -135,8 +135,8 @@ piglit_get_glx_window(Display *dpy, XVisualInfo *visinfo)
return _piglit_get_glx_window(dpy, visinfo, true);
}
-void
-piglit_require_glx_extension(Display *dpy, const char *name)
+bool
+piglit_is_glx_extension_supported(Display *dpy, const char *name)
{
const char *glx_extension_list;
int screen = DefaultScreen(dpy);
@@ -146,6 +146,16 @@ piglit_require_glx_extension(Display *dpy, const char *name)
*/
glx_extension_list = glXQueryExtensionsString(dpy, screen);
if (strstr(glx_extension_list, name) == NULL) {
+ return false;
+ }
+
+ return true;
+}
+
+void
+piglit_require_glx_extension(Display *dpy, const char *name)
+{
+ if (!piglit_is_glx_extension_supported(dpy, name)) {
fprintf(stderr, "Test requires %s\n", name);
piglit_report_result(PIGLIT_SKIP);
}
diff --git a/tests/util/piglit-glx-util.h b/tests/util/piglit-glx-util.h
index 356131a..0e6e898 100644
--- a/tests/util/piglit-glx-util.h
+++ b/tests/util/piglit-glx-util.h
@@ -37,6 +37,7 @@ GLXContext piglit_get_glx_context(Display *dpy, XVisualInfo *visinfo);
GLXContext piglit_get_glx_context_share(Display *dpy, XVisualInfo *visinfo, GLXContext share);
Window piglit_get_glx_window(Display *dpy, XVisualInfo *visinfo);
Window piglit_get_glx_window_unmapped(Display *dpy, XVisualInfo *visinfo);
+bool piglit_is_glx_extension_supported(Display *dpy, const char *name);
void piglit_require_glx_extension(Display *dpy, const char *name);
void piglit_require_glx_version(Display *dpy, int major, int minor);
void piglit_glx_event_loop(Display *dpy,
--
1.7.6.4
More information about the Piglit
mailing list