[Piglit] [PATCH 03/15] Stop using glewIsSupported

Paul Berry stereotype441 at gmail.com
Sat Mar 3 10:01:33 PST 2012


Several tests were using the function glewIsSupported() to check for
extensions and GL versions.  This patch changes the tests to use
piglit_get_gl_version() and piglit_is_extension_supported(), which
provide the same functionality in a way that is not dependent on GLEW.

Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

v2: Follow piglit convention of including "GL_" in the string passed
to piglit_is_extension_supported().
---
 tests/general/gl30basic.c         |    7 +------
 tests/general/primitive-restart.c |    8 ++------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/tests/general/gl30basic.c b/tests/general/gl30basic.c
index 4ad7ac5..3cb5485 100644
--- a/tests/general/gl30basic.c
+++ b/tests/general/gl30basic.c
@@ -49,12 +49,7 @@ test_version(void)
    GLuint iversion;
    GLint major, minor, k;
 
-#ifdef GL_VERSION_3_0
-   if (!glewIsSupported("GL_VERSION_3_0"))
-      return PIGLIT_SKIP;
-#else
-   return PIGLIT_SKIP;
-#endif
+   piglit_require_gl_version(30);
 
    major = version[0] - '0';
    minor = version[2] - '0';
diff --git a/tests/general/primitive-restart.c b/tests/general/primitive-restart.c
index 541b83e..ceb9d6e 100644
--- a/tests/general/primitive-restart.c
+++ b/tests/general/primitive-restart.c
@@ -473,12 +473,8 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-   Have_NV = glewIsSupported("GL_NV_primitive_restart");
-#ifdef GL_VERSION_3_1
-   Have_31 = glewIsSupported("GL_VERSION_3_1");
-#else
-   Have_31 = GL_FALSE;
-#endif
+   Have_NV = piglit_is_extension_supported("GL_NV_primitive_restart");
+   Have_31 = piglit_get_gl_version() >= 31;
 
    /* Debug */
    /* NOTE!  glew 1.5.2's OpenGL 3.1 detection is broken.  You'll need
-- 
1.7.7.6



More information about the Piglit mailing list