[Piglit] [PATCH 04/14] tests: Remove glutExtensionSupported

Chad Versace chad.versace at linux.intel.com
Mon May 21 23:15:12 PDT 2012


Replace it with piglit_is_extension_supported or piglit_require_extension,
as appropriate.

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/asmparsertest/asmparsertest.c             |    9 +--------
 tests/bugs/crash-texparameter-before-teximage.c |    4 ++--
 tests/bugs/tex1d-2dborder.c                     |    2 +-
 tests/fbo/fbo-3d.c                              |    2 +-
 tests/fbo/fbo-formats.h                         |    2 +-
 tests/fbo/fbo-storage-completeness.c            |    6 +++---
 tests/fbo/fbo-storage-formats.c                 |    6 +++---
 tests/general/framebuffer-srgb.c                |    2 +-
 tests/general/isbufferobj.c                     |    2 +-
 tests/general/texunits.c                        |    6 +++---
 tests/shaders/vp-address-02.c                   |    2 +-
 tests/shaders/vp-address-04.c                   |    2 +-
 tests/texturing/array-texture.c                 |    2 +-
 tests/texturing/crossbar.c                      |   10 +++++-----
 tests/texturing/tex-srgb.c                      |    2 +-
 tests/texturing/texdepth.c                      |    6 +++---
 16 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/tests/asmparsertest/asmparsertest.c b/tests/asmparsertest/asmparsertest.c
index 4c36aa0..728ea56 100644
--- a/tests/asmparsertest/asmparsertest.c
+++ b/tests/asmparsertest/asmparsertest.c
@@ -139,14 +139,7 @@ compile(const char *filename, GLenum target, int use_ARB)
 			}
 
 			extension[i] = '\0';
-
-			if (!glutExtensionSupported(extension)) {
-				printf("Test requires %s\n", extension);
-				piglit_report_result(PIGLIT_SKIP);
-
-				free(buf);
-				return;
-			}
+			piglit_require_extension(extension);
 		}
 	}
 
diff --git a/tests/bugs/crash-texparameter-before-teximage.c b/tests/bugs/crash-texparameter-before-teximage.c
index d35f348..485f2af 100644
--- a/tests/bugs/crash-texparameter-before-teximage.c
+++ b/tests/bugs/crash-texparameter-before-teximage.c
@@ -26,9 +26,9 @@ piglit_init(int argc, char **argv)
 
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
-	if (glutExtensionSupported("GL_ARB_shadow"))
+	if (piglit_is_extension_supported("GL_ARB_shadow"))
 		glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA);
-	if (glutExtensionSupported("GL_ARB_shadow_ambient"))
+	if (piglit_is_extension_supported("GL_ARB_shadow_ambient"))
 		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, 0.1);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
diff --git a/tests/bugs/tex1d-2dborder.c b/tests/bugs/tex1d-2dborder.c
index 5a05279..881ab47 100644
--- a/tests/bugs/tex1d-2dborder.c
+++ b/tests/bugs/tex1d-2dborder.c
@@ -90,7 +90,7 @@ piglit_display(void)
 	pass &= test(GL_CLAMP_TO_EDGE, 2, 0);
 	pass &= test(GL_CLAMP_TO_BORDER, 3, 0);
 	pass &= test(GL_MIRRORED_REPEAT, 0, 1);
-	if (glutExtensionSupported("GL_EXT_texture_mirror_clamp")) {
+	if (piglit_is_extension_supported("GL_EXT_texture_mirror_clamp")) {
 		pass &= test(GL_MIRROR_CLAMP_EXT, 1, 1);
 		pass &= test(GL_MIRROR_CLAMP_TO_EDGE_EXT, 2, 1);
 		pass &= test(GL_MIRROR_CLAMP_TO_BORDER_EXT, 3, 1);
diff --git a/tests/fbo/fbo-3d.c b/tests/fbo/fbo-3d.c
index c5287e2..5cfa882 100644
--- a/tests/fbo/fbo-3d.c
+++ b/tests/fbo/fbo-3d.c
@@ -58,7 +58,7 @@ create_3d_fbo(void)
 	GLuint tex, fb;
 	GLenum status;
 	int depth;
-	pot_depth = glutExtensionSupported("GL_ARB_texture_non_power_of_two") ?
+	pot_depth = piglit_is_extension_supported("GL_ARB_texture_non_power_of_two") ?
 		NUM_DEPTHS: POT_DEPTHS;
 
 	glGenTextures(1, &tex);
diff --git a/tests/fbo/fbo-formats.h b/tests/fbo/fbo-formats.h
index 9f5d911..cadf30d 100644
--- a/tests/fbo/fbo-formats.h
+++ b/tests/fbo/fbo-formats.h
@@ -468,7 +468,7 @@ supported(const struct test_desc *test)
 
 	for (i = 0; i < 3; i++) {
 		if (test->ext[i]) {
-			if (!glutExtensionSupported(test->ext[i])) {
+			if (!piglit_is_extension_supported(test->ext[i])) {
 				return GL_FALSE;
 			}
 		}
diff --git a/tests/fbo/fbo-storage-completeness.c b/tests/fbo/fbo-storage-completeness.c
index 8c099cd..59aceef 100644
--- a/tests/fbo/fbo-storage-completeness.c
+++ b/tests/fbo/fbo-storage-completeness.c
@@ -237,9 +237,9 @@ piglit_init(int argc, char**argv)
    piglit_require_extension("GL_EXT_framebuffer_object");
 
    HaveExtension[0] = GL_TRUE;
-   HaveExtension[EXT_packed_depth_stencil] = glutExtensionSupported("GL_EXT_packed_depth_stencil");
-   HaveExtension[ARB_framebuffer_object] = glutExtensionSupported("GL_ARB_framebuffer_object");
-   HaveExtension[ARB_texture_rg] = glutExtensionSupported("GL_ARB_texture_rg");
+   HaveExtension[EXT_packed_depth_stencil] = piglit_is_extension_supported("GL_EXT_packed_depth_stencil");
+   HaveExtension[ARB_framebuffer_object] = piglit_is_extension_supported("GL_ARB_framebuffer_object");
+   HaveExtension[ARB_texture_rg] = piglit_is_extension_supported("GL_ARB_texture_rg");
 
    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
diff --git a/tests/fbo/fbo-storage-formats.c b/tests/fbo/fbo-storage-formats.c
index 71bfc45..4a2b38f 100644
--- a/tests/fbo/fbo-storage-formats.c
+++ b/tests/fbo/fbo-storage-formats.c
@@ -242,9 +242,9 @@ piglit_init(int argc, char**argv)
    piglit_require_extension("GL_EXT_framebuffer_object");
 
    HaveExtension[0] = GL_TRUE;
-   HaveExtension[EXT_packed_depth_stencil] = glutExtensionSupported("GL_EXT_packed_depth_stencil");
-   HaveExtension[ARB_framebuffer_object] = glutExtensionSupported("GL_ARB_framebuffer_object");
-   HaveExtension[ARB_texture_rg] = glutExtensionSupported("GL_ARB_texture_rg");
+   HaveExtension[EXT_packed_depth_stencil] = piglit_is_extension_supported("GL_EXT_packed_depth_stencil");
+   HaveExtension[ARB_framebuffer_object] = piglit_is_extension_supported("GL_ARB_framebuffer_object");
+   HaveExtension[ARB_texture_rg] = piglit_is_extension_supported("GL_ARB_texture_rg");
 
    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
diff --git a/tests/general/framebuffer-srgb.c b/tests/general/framebuffer-srgb.c
index a7226dc..c741ac6 100644
--- a/tests/general/framebuffer-srgb.c
+++ b/tests/general/framebuffer-srgb.c
@@ -336,7 +336,7 @@ piglit_display(void)
 	GLboolean pass = GL_TRUE;
 	GLboolean have_srgb_ext = GL_FALSE;
 
-	if (glutExtensionSupported("GL_EXT_framebuffer_sRGB"))
+	if (piglit_is_extension_supported("GL_EXT_framebuffer_sRGB"))
 		have_srgb_ext = GL_TRUE;
 
 	if (!have_srgb_ext) {
diff --git a/tests/general/isbufferobj.c b/tests/general/isbufferobj.c
index 4f7141a..bb369a9 100644
--- a/tests/general/isbufferobj.c
+++ b/tests/general/isbufferobj.c
@@ -60,7 +60,7 @@ test(void)
       return PIGLIT_FAIL;
    }
 
-   if (glutExtensionSupported("GL_EXT_pixel_buffer_object")) {
+   if (piglit_is_extension_supported("GL_EXT_pixel_buffer_object")) {
       glBindBuffer(GL_PIXEL_PACK_BUFFER_EXT, buffers[0]);
       if (glGetError()) {
          printf("%s: glBindBuffer failed\n", TestName);
diff --git a/tests/general/texunits.c b/tests/general/texunits.c
index c2f5bb5..667a7b4 100644
--- a/tests/general/texunits.c
+++ b/tests/general/texunits.c
@@ -349,14 +349,14 @@ piglit_display(void)
 static void
 init(void)
 {
-   if (glutExtensionSupported("GL_ARB_vertex_shader")) {
+   if (piglit_is_extension_supported("GL_ARB_vertex_shader")) {
       glGetIntegerv(GL_MAX_TEXTURE_COORDS, &MaxTextureCoordUnits);
       glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &MaxTextureImageUnits);
       glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &MaxTextureVertexUnits);
       glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &MaxTextureCombinedUnits);
    }
-   else if (glutExtensionSupported("GL_ARB_fragment_shader") ||
-            glutExtensionSupported("GL_ARB_fragment_program")) {
+   else if (piglit_is_extension_supported("GL_ARB_fragment_shader") ||
+            piglit_is_extension_supported("GL_ARB_fragment_program")) {
       glGetIntegerv(GL_MAX_TEXTURE_COORDS, &MaxTextureCoordUnits);
       glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &MaxTextureImageUnits);
       MaxTextureVertexUnits = 0;
diff --git a/tests/shaders/vp-address-02.c b/tests/shaders/vp-address-02.c
index 28a6917..eb75257 100644
--- a/tests/shaders/vp-address-02.c
+++ b/tests/shaders/vp-address-02.c
@@ -147,7 +147,7 @@ piglit_init(int argc, char **argv)
 
 		piglit_report_result(PIGLIT_FAIL);
 	} else 	if (max_address_registers == 1) {
-		if (glutExtensionSupported("GL_NV_vertex_program2_option")) {
+		if (piglit_is_extension_supported("GL_NV_vertex_program2_option")) {
 			/* this extension requires two address regs */
 			if (! piglit_automatic)
 				printf("GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB "
diff --git a/tests/shaders/vp-address-04.c b/tests/shaders/vp-address-04.c
index 353c62e..adfc109 100644
--- a/tests/shaders/vp-address-04.c
+++ b/tests/shaders/vp-address-04.c
@@ -243,7 +243,7 @@ piglit_init(int argc, char **argv)
 
 		piglit_report_result(PIGLIT_FAIL);
 	} else 	if (max_address_registers == 1) {
-		if (glutExtensionSupported("GL_NV_vertex_program2_option")) {
+		if (piglit_is_extension_supported("GL_NV_vertex_program2_option")) {
 			/* this extension requires two address regs */
 			if (! piglit_automatic)
 				printf("GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB "
diff --git a/tests/texturing/array-texture.c b/tests/texturing/array-texture.c
index b6c03f2..9029b58 100644
--- a/tests/texturing/array-texture.c
+++ b/tests/texturing/array-texture.c
@@ -328,7 +328,7 @@ piglit_init(int argc, char **argv)
 {
    piglit_require_extension("GL_EXT_texture_array");
 
-   have_MESA_texture_array = glutExtensionSupported("GL_MESA_texture_array");
+   have_MESA_texture_array = piglit_is_extension_supported("GL_MESA_texture_array");
 
    /* Make shader programs */
    frag_shader_2d_array =
diff --git a/tests/texturing/crossbar.c b/tests/texturing/crossbar.c
index e404bff..3bc26df 100644
--- a/tests/texturing/crossbar.c
+++ b/tests/texturing/crossbar.c
@@ -217,13 +217,13 @@ static void Init( void )
    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
    printf("GL_VERSION = %s\n", ver_string);
 
-   if ( (!glutExtensionSupported("GL_ARB_multitexture")
+   if ( (!piglit_is_extension_supported("GL_ARB_multitexture")
 	 && (ver < 1.3))
-	|| (!glutExtensionSupported("GL_ARB_texture_env_combine")
-	    && !glutExtensionSupported("GL_EXT_texture_env_combine")
+	|| (!piglit_is_extension_supported("GL_ARB_texture_env_combine")
+	    && !piglit_is_extension_supported("GL_EXT_texture_env_combine")
 	    && (ver < 1.3))
-	|| (!glutExtensionSupported("GL_ARB_texture_env_crossbar")
-	    && !glutExtensionSupported("GL_NV_texture_env_combine4")
+	|| (!piglit_is_extension_supported("GL_ARB_texture_env_crossbar")
+	    && !piglit_is_extension_supported("GL_NV_texture_env_combine4")
 	    && (ver < 1.4)) ) {
       printf("\nSorry, this program requires GL_ARB_multitexture and either\n"
 	     "GL_ARB_texture_env_combine or GL_EXT_texture_env_combine (or OpenGL 1.3).\n"
diff --git a/tests/texturing/tex-srgb.c b/tests/texturing/tex-srgb.c
index 1f53508..3f98ac7 100644
--- a/tests/texturing/tex-srgb.c
+++ b/tests/texturing/tex-srgb.c
@@ -91,7 +91,7 @@ srgb_tex_test(int srgb_format)
 	GLuint tex;
 	GLboolean have_decode;
 
-	have_decode = glutExtensionSupported("GL_EXT_texture_sRGB_decode");
+	have_decode = piglit_is_extension_supported("GL_EXT_texture_sRGB_decode");
 
 	glGenTextures(1, &tex);
 
diff --git a/tests/texturing/texdepth.c b/tests/texturing/texdepth.c
index bc13ba3..f7bdaaf 100644
--- a/tests/texturing/texdepth.c
+++ b/tests/texturing/texdepth.c
@@ -387,13 +387,13 @@ piglit_init(int argc, char **argv)
 		printf("Press 't' to cycle through test images\n");
 
 	piglit_require_extension("GL_ARB_depth_texture");
-	HaveShadow = glutExtensionSupported("GL_ARB_shadow");
+	HaveShadow = piglit_is_extension_supported("GL_ARB_shadow");
 	if (!HaveShadow)
 		printf("GL_ARB_shadow not supported.\n");
-	HaveShadowAmbient = glutExtensionSupported("GL_ARB_shadow_ambient");
+	HaveShadowAmbient = piglit_is_extension_supported("GL_ARB_shadow_ambient");
 	if (!HaveShadowAmbient)
 		printf("GL_ARB_shadow_ambient not supported.\n");
-	HaveShadowFuncs = glutExtensionSupported("GL_EXT_shadow_funcs");
+	HaveShadowFuncs = piglit_is_extension_supported("GL_EXT_shadow_funcs");
 	if (!HaveShadowFuncs)
 		printf("GL_EXT_shadow_funcs not supported.\n");
 
-- 
1.7.10.1



More information about the Piglit mailing list