[Piglit] [PATCH 02/15] Stop using GLEW extension macros

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


Several tests were checking for the presence of GL extensions using
GLEW macros.  This patch changes the tests to use
piglit_is_extension_supported(), which provides the same functionality
in a way that is not dependent on GLEW.

v2: Follow piglit convention of including "GL_" in the string passed
to piglit_is_extension_supported().
---
 tests/fbo/fbo-clear-formats.c                      |    2 +-
 tests/fbo/fbo-generatemipmap-formats.c             |    8 +++---
 tests/general/blendminmax.c                        |    2 +-
 tests/general/blendsquare.c                        |    2 +-
 tests/general/occlusion_query.c                    |    2 +-
 tests/general/stencil-twoside.c                    |    4 +-
 tests/general/stencil-wrap.c                       |    2 +-
 tests/glx/glx-tfp.c                                |    2 +-
 tests/shaders/createshaderprogram-bad-type.c       |    6 ++--
 tests/shaders/fp-fog.c                             |    2 +-
 tests/shaders/glsl-fs-texturelod-01.c              |    2 +-
 tests/shaders/glsl-link-test.c                     |    2 +-
 tests/shaders/glsl-reload-source.c                 |    2 +-
 tests/shaders/glsl-uniform-out-of-bounds.c         |    2 +-
 tests/shaders/useshaderprogram-bad-type.c          |    6 ++--
 tests/spec/arb_color_buffer_float/common.h         |    2 +-
 tests/spec/arb_color_buffer_float/queries.c        |    2 +-
 tests/spec/arb_color_buffer_float/render.c         |    8 +++---
 ...rb_es2_compatibility-getshaderprecisionformat.c |    2 +-
 .../arb_es2_compatibility-maxvectors.c             |    2 +-
 .../arb_es2_compatibility-releaseshadercompiler.c  |    2 +-
 .../arb_es2_compatibility-shadercompiler.c         |    2 +-
 .../internal-format-query.c                        |   24 ++++++++++----------
 .../spec/arb_texture_compression/invalid-formats.c |   20 ++++++++--------
 tests/texturing/depth-cube-map.c                   |    2 +-
 tests/texturing/texture-rg.c                       |    4 +-
 tests/util/piglit-shader-gl.c                      |    6 ++--
 tests/util/piglit-transform-feedback.c             |    2 +-
 tests/util/piglit-util-gl.c                        |    4 +-
 29 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/tests/fbo/fbo-clear-formats.c b/tests/fbo/fbo-clear-formats.c
index df0d854..0c300d6 100644
--- a/tests/fbo/fbo-clear-formats.c
+++ b/tests/fbo/fbo-clear-formats.c
@@ -271,7 +271,7 @@ test_mipmap_drawing(int x, int y, int dim, int level, GLuint internalformat)
 	if (compressed && dim < 8)
 		return GL_TRUE;
 
-	if (GLEW_ARB_depth_texture) {
+	if (piglit_is_extension_supported("GL_ARB_depth_texture")) {
 		glGetTexLevelParameteriv(GL_TEXTURE_2D, level,
 					 GL_TEXTURE_DEPTH_SIZE, &d_size);
 	} else {
diff --git a/tests/fbo/fbo-generatemipmap-formats.c b/tests/fbo/fbo-generatemipmap-formats.c
index be52380..e1f0af0 100644
--- a/tests/fbo/fbo-generatemipmap-formats.c
+++ b/tests/fbo/fbo-generatemipmap-formats.c
@@ -57,7 +57,7 @@ key_func(unsigned char key, int x, int y)
 {
 	switch (key) {
 	case 'd':
-		set_npot(tex_width == 256 && GLEW_ARB_texture_non_power_of_two);
+		set_npot(tex_width == 256 && piglit_is_extension_supported("GL_ARB_texture_non_power_of_two"));
 		break;
 	}
 	fbo_formats_key_func(key, x, y);
@@ -128,7 +128,7 @@ draw_mipmap(int x, int y, int level, GLenum basetype)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	if (GLEW_ARB_depth_texture) {
+	if (piglit_is_extension_supported("GL_ARB_depth_texture")) {
 		glGetTexLevelParameteriv(GL_TEXTURE_2D, level,
 					 GL_TEXTURE_DEPTH_SIZE, &d);
 	} else {
@@ -248,7 +248,7 @@ test_mipmap_drawing(int x, int y, int level, GLuint internalformat)
 	if (compressed && (w < h ? w : h) < 8)
 		return GL_TRUE;
 
-	if (GLEW_ARB_depth_texture) {
+	if (piglit_is_extension_supported("GL_ARB_depth_texture")) {
 		glGetTexLevelParameteriv(GL_TEXTURE_2D, level,
 					 GL_TEXTURE_DEPTH_SIZE, &d_size);
 	} else {
@@ -446,7 +446,7 @@ piglit_display(void)
 			pass = test_format(&test_set->format[i],
 					   test_set->base, test_set->basetype) && pass;
 		}
-		if (GLEW_ARB_texture_non_power_of_two) {
+		if (piglit_is_extension_supported("GL_ARB_texture_non_power_of_two")) {
 			set_npot(GL_TRUE);
 			for (i = 0; i < test_set->num_formats; i++) {
 				pass = test_format(&test_set->format[i],
diff --git a/tests/general/blendminmax.c b/tests/general/blendminmax.c
index ece1721..6521358 100644
--- a/tests/general/blendminmax.c
+++ b/tests/general/blendminmax.c
@@ -124,7 +124,7 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	if (!GLEW_ARB_imaging && !GLEW_EXT_blend_minmax) {
+	if (!piglit_is_extension_supported("GL_ARB_imaging") && !piglit_is_extension_supported("GL_EXT_blend_minmax")) {
 		printf("Sorry, this program requires either GL_ARB_imaging or "
 		       "GL_EXT_blend_minmax.\n");
 		piglit_report_result(PIGLIT_SKIP);
diff --git a/tests/general/blendsquare.c b/tests/general/blendsquare.c
index c0ba61f..8850a41 100644
--- a/tests/general/blendsquare.c
+++ b/tests/general/blendsquare.c
@@ -89,7 +89,7 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	if (piglit_get_gl_version() < 14 && !GLEW_NV_blend_square) {
+	if (piglit_get_gl_version() < 14 && !piglit_is_extension_supported("GL_NV_blend_square")) {
 		printf("Sorry, this program requires either OpenGL 1.4 or "
 		       "GL_NV_blend_square\n");
 		piglit_report_result(PIGLIT_SKIP);
diff --git a/tests/general/occlusion_query.c b/tests/general/occlusion_query.c
index 9ed4ded..ed09671 100644
--- a/tests/general/occlusion_query.c
+++ b/tests/general/occlusion_query.c
@@ -179,7 +179,7 @@ piglit_init(int argc, char **argv)
 		end_query = GLEW_GET_FUN(__glewEndQuery);
 		get_queryiv = GLEW_GET_FUN(__glewGetQueryiv);
 		get_query_objectiv = GLEW_GET_FUN(__glewGetQueryObjectiv);
-	} else if (GLEW_ARB_occlusion_query) {
+	} else if (piglit_is_extension_supported("GL_ARB_occlusion_query")) {
 		gen_queries = GLEW_GET_FUN(__glewGenQueriesARB);
 		begin_query = GLEW_GET_FUN(__glewBeginQueryARB);
 		end_query = GLEW_GET_FUN(__glewEndQueryARB);
diff --git a/tests/general/stencil-twoside.c b/tests/general/stencil-twoside.c
index fb92458..2d2d623 100644
--- a/tests/general/stencil-twoside.c
+++ b/tests/general/stencil-twoside.c
@@ -176,7 +176,7 @@ piglit_display(void)
 	piglit_draw_rect(w * 9, start_y, w, h);
 
 	/* 6th square */
-	if (GLEW_EXT_stencil_wrap) {
+	if (piglit_is_extension_supported("GL_EXT_stencil_wrap")) {
 		if (use20syntax) {
 			glStencilFuncSeparate(GL_FRONT, GL_ALWAYS, 0, ~0);
 			glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, ~0);
@@ -217,7 +217,7 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	if (!GLEW_ATI_separate_stencil && piglit_get_gl_version() < 20) {
+	if (!piglit_is_extension_supported("GL_ATI_separate_stencil") && piglit_get_gl_version() < 20) {
 		printf("Sorry, this program requires either "
 		       "GL_ATI_separate_stencil or OpenGL 2.0.\n");
 		piglit_report_result(PIGLIT_SKIP);
diff --git a/tests/general/stencil-wrap.c b/tests/general/stencil-wrap.c
index 388ddba..cc7fbea 100644
--- a/tests/general/stencil-wrap.c
+++ b/tests/general/stencil-wrap.c
@@ -144,7 +144,7 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	if (!GLEW_EXT_stencil_wrap && piglit_get_gl_version() < 14) {
+	if (!piglit_is_extension_supported("GL_EXT_stencil_wrap") && piglit_get_gl_version() < 14) {
 		printf("Sorry, this program requires either "
 		       "GL_EXT_stencil_wrap or OpenGL 1.4.\n");
 		piglit_report_result(PIGLIT_SKIP);
diff --git a/tests/glx/glx-tfp.c b/tests/glx/glx-tfp.c
index 204933e..f2976dd 100644
--- a/tests/glx/glx-tfp.c
+++ b/tests/glx/glx-tfp.c
@@ -328,7 +328,7 @@ int main(int argc, char**argv)
 	XMapWindow(dpy, win);
 
 	piglit_require_glx_extension(dpy, "GLX_EXT_texture_from_pixmap");
-	if (!GLEW_ARB_texture_env_combine) {
+	if (!piglit_is_extension_supported("GL_ARB_texture_env_combine")) {
 		fprintf(stderr, "Test requires GL_ARB_texture_env_combine\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
diff --git a/tests/shaders/createshaderprogram-bad-type.c b/tests/shaders/createshaderprogram-bad-type.c
index 8871fcf..6838f1f 100644
--- a/tests/shaders/createshaderprogram-bad-type.c
+++ b/tests/shaders/createshaderprogram-bad-type.c
@@ -104,9 +104,9 @@ try_CreateShaderProgram(GLenum type, const char *source, GLenum expect)
 void
 piglit_init(int argc, char **argv)
 {
-	const GLenum expect = (GLEW_ARB_geometry_shader4
-			       || GLEW_EXT_geometry_shader4
-			       || GLEW_NV_geometry_shader4)
+	const GLenum expect = (piglit_is_extension_supported("GL_ARB_geometry_shader4")
+			       || piglit_is_extension_supported("GL_EXT_geometry_shader4")
+			       || piglit_is_extension_supported("GL_NV_geometry_shader4"))
 		? 0 : GL_INVALID_ENUM;
 	GLboolean pass;
 
diff --git a/tests/shaders/fp-fog.c b/tests/shaders/fp-fog.c
index cbc0dc9..684d132 100644
--- a/tests/shaders/fp-fog.c
+++ b/tests/shaders/fp-fog.c
@@ -136,7 +136,7 @@ piglit_init(int argc, char **argv)
 
 	if (piglit_get_gl_version() >= 14) {
 		pglFogCoordf = glFogCoordf;
-	} else if (GLEW_EXT_fog_coord) {
+	} else if (piglit_is_extension_supported("GL_EXT_fog_coord")) {
 		pglFogCoordf = glFogCoordfEXT;
 	} else {
 		piglit_report_result(PIGLIT_SKIP);
diff --git a/tests/shaders/glsl-fs-texturelod-01.c b/tests/shaders/glsl-fs-texturelod-01.c
index 25313dc..aa7719c 100644
--- a/tests/shaders/glsl-fs-texturelod-01.c
+++ b/tests/shaders/glsl-fs-texturelod-01.c
@@ -129,7 +129,7 @@ piglit_init(int argc, char **argv)
 		printf("Requires OpenGL 2.0\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
-	if (!GLEW_ARB_shader_texture_lod) {
+	if (!piglit_is_extension_supported("GL_ARB_shader_texture_lod")) {
 		printf("Requires extension GL_ARB_shader_texture_lod\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
diff --git a/tests/shaders/glsl-link-test.c b/tests/shaders/glsl-link-test.c
index 909d3b2..18ff3ae 100644
--- a/tests/shaders/glsl-link-test.c
+++ b/tests/shaders/glsl-link-test.c
@@ -83,7 +83,7 @@ void piglit_init(int argc, char **argv)
 			target = GL_VERTEX_SHADER;
 		} else if (strcmp(argv[i] + len - 5, ".geom") == 0) {
 			target = GL_GEOMETRY_SHADER;
-			if (piglit_get_gl_version() < 32 && !GLEW_ARB_geometry_shader4) {
+			if (piglit_get_gl_version() < 32 && !piglit_is_extension_supported("GL_ARB_geometry_shader4")) {
 				printf("Requires geometry shaders.\n");
 				piglit_report_result(PIGLIT_SKIP);
 			}
diff --git a/tests/shaders/glsl-reload-source.c b/tests/shaders/glsl-reload-source.c
index b01bf02..46c3528 100644
--- a/tests/shaders/glsl-reload-source.c
+++ b/tests/shaders/glsl-reload-source.c
@@ -150,7 +150,7 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	if (!GLEW_ARB_shader_objects || !GLEW_ARB_vertex_shader || !GLEW_ARB_fragment_shader) {
+	if (!piglit_is_extension_supported("GL_ARB_shader_objects") || !piglit_is_extension_supported("GL_ARB_vertex_shader") || !piglit_is_extension_supported("GL_ARB_fragment_shader")) {
 		printf("Requires ARB_shader_objects and ARB_{vertex,fragment}_shader\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
diff --git a/tests/shaders/glsl-uniform-out-of-bounds.c b/tests/shaders/glsl-uniform-out-of-bounds.c
index 6810a0c..773dbfc 100644
--- a/tests/shaders/glsl-uniform-out-of-bounds.c
+++ b/tests/shaders/glsl-uniform-out-of-bounds.c
@@ -306,7 +306,7 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	if (!GLEW_ARB_shader_objects || !GLEW_ARB_vertex_shader || !GLEW_ARB_fragment_shader) {
+	if (!piglit_is_extension_supported("GL_ARB_shader_objects") || !piglit_is_extension_supported("GL_ARB_vertex_shader") || !piglit_is_extension_supported("GL_ARB_fragment_shader")) {
 		printf("Requires ARB_shader_objects and ARB_{vertex,fragment}_shader\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
diff --git a/tests/shaders/useshaderprogram-bad-type.c b/tests/shaders/useshaderprogram-bad-type.c
index 55a5af3..0e0a788 100644
--- a/tests/shaders/useshaderprogram-bad-type.c
+++ b/tests/shaders/useshaderprogram-bad-type.c
@@ -73,9 +73,9 @@ try_UseShaderProgram(GLenum type, GLenum expect)
 void
 piglit_init(int argc, char **argv)
 {
-	const GLenum expect = (GLEW_ARB_geometry_shader4
-			       || GLEW_EXT_geometry_shader4
-			       || GLEW_NV_geometry_shader4)
+	const GLenum expect = (piglit_is_extension_supported("GL_ARB_geometry_shader4")
+			       || piglit_is_extension_supported("GL_EXT_geometry_shader4")
+			       || piglit_is_extension_supported("GL_NV_geometry_shader4"))
 		? 0 : GL_INVALID_ENUM;
 	GLboolean pass;
 
diff --git a/tests/spec/arb_color_buffer_float/common.h b/tests/spec/arb_color_buffer_float/common.h
index 6113264..2e2939f 100644
--- a/tests/spec/arb_color_buffer_float/common.h
+++ b/tests/spec/arb_color_buffer_float/common.h
@@ -166,7 +166,7 @@ static GLboolean run_test()
 	}
 	else
 	{
-		unsigned mrt_modes = GLEW_ARB_draw_buffers ? (GLEW_ARB_texture_float ? 3 : 2) : 1;
+		unsigned mrt_modes = piglit_is_extension_supported("GL_ARB_draw_buffers") ? (piglit_is_extension_supported("GL_ARB_texture_float") ? 3 : 2) : 1;
 		unsigned first_mrt_mode = (test_mode == TEST_MRT) ? 1 : 0;
 
 		for (mrt_mode = first_mrt_mode; mrt_mode < mrt_modes; ++mrt_mode)
diff --git a/tests/spec/arb_color_buffer_float/queries.c b/tests/spec/arb_color_buffer_float/queries.c
index 47acec0..34a38d6 100644
--- a/tests/spec/arb_color_buffer_float/queries.c
+++ b/tests/spec/arb_color_buffer_float/queries.c
@@ -73,7 +73,7 @@ GLboolean test()
 			case 0:
 				/* ARB_color_buffer_float adds a potential clamp on queries, but only ARB_texture_float removes
 				 * the clamp on setting the texture border color  */
-				if(!GLEW_ARB_texture_float)
+				if(!piglit_is_extension_supported("GL_ARB_texture_float"))
 					clamped = 1;
 				glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, pixels);
 				glGetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, observed);
diff --git a/tests/spec/arb_color_buffer_float/render.c b/tests/spec/arb_color_buffer_float/render.c
index 302a522..b70cc8e 100644
--- a/tests/spec/arb_color_buffer_float/render.c
+++ b/tests/spec/arb_color_buffer_float/render.c
@@ -211,8 +211,8 @@ GLboolean test(void)
 	GLboolean all_pass = GL_TRUE;
 	int npass = 0, total = 0;
 	unsigned semantic, blend, logicop, vpmode, fpmode;
-	unsigned vpmodes = 1 + !!GLEW_ARB_vertex_program;
-	unsigned fpmodes = 1 + !!GLEW_ARB_fragment_program;
+	unsigned vpmodes = 1 + !!piglit_is_extension_supported("GL_ARB_vertex_program");
+	unsigned fpmodes = 1 + !!piglit_is_extension_supported("GL_ARB_fragment_program");
 	unsigned vert_clamp, frag_clamp;
 
 	glFogi(GL_FOG_MODE, GL_LINEAR);
@@ -258,14 +258,14 @@ GLboolean test(void)
 unsigned
 init(void)
 {
-	if (GLEW_ARB_vertex_program)
+	if (piglit_is_extension_supported("GL_ARB_vertex_program"))
 	{
 		unsigned i;
 		for (i = 0; i < 2; ++i)
 			vps[i] = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, vp_strings[i]);
 	}
 
-	if (GLEW_ARB_fragment_program)
+	if (piglit_is_extension_supported("GL_ARB_fragment_program"))
 	{
 		unsigned i;
 		for (i = 0; i < 4; ++i)
diff --git a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-getshaderprecisionformat.c b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-getshaderprecisionformat.c
index 5993951..c9c4acd 100644
--- a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-getshaderprecisionformat.c
+++ b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-getshaderprecisionformat.c
@@ -74,7 +74,7 @@ piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_SKIP);
 	}
 
-	if (!GLEW_ARB_ES2_compatibility) {
+	if (!piglit_is_extension_supported("GL_ARB_ES2_compatibility")) {
 		printf("Requires ARB_ES2_compatibility\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
diff --git a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-maxvectors.c b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-maxvectors.c
index 7a1b3d8..f826eb3 100644
--- a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-maxvectors.c
+++ b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-maxvectors.c
@@ -49,7 +49,7 @@ piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_SKIP);
 	}
 
-	if (!GLEW_ARB_ES2_compatibility) {
+	if (!piglit_is_extension_supported("GL_ARB_ES2_compatibility")) {
 		printf("Requires ARB_ES2_compatibility\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
diff --git a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c
index 05f5f74..3d8dcc4 100644
--- a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c
+++ b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c
@@ -126,7 +126,7 @@ piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_SKIP);
 	}
 
-	if (!GLEW_ARB_ES2_compatibility) {
+	if (!piglit_is_extension_supported("GL_ARB_ES2_compatibility")) {
 		printf("Requires ARB_ES2_compatibility\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
diff --git a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-shadercompiler.c b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-shadercompiler.c
index 7fd5d2b..a43666d 100644
--- a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-shadercompiler.c
+++ b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-shadercompiler.c
@@ -49,7 +49,7 @@ piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_SKIP);
 	}
 
-	if (!GLEW_ARB_ES2_compatibility) {
+	if (!piglit_is_extension_supported("GL_ARB_ES2_compatibility")) {
 		printf("Requires ARB_ES2_compatibility\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
diff --git a/tests/spec/arb_texture_compression/internal-format-query.c b/tests/spec/arb_texture_compression/internal-format-query.c
index d02fff2..36daf52 100644
--- a/tests/spec/arb_texture_compression/internal-format-query.c
+++ b/tests/spec/arb_texture_compression/internal-format-query.c
@@ -297,7 +297,7 @@ piglit_init(int argc, char **argv)
 	 * caveats for RGB or RGBA base formats.  We have to add these formats
 	 * to the list of possible formats by hand.
 	 */
-	if (GLEW_EXT_texture_compression_latc) {
+	if (piglit_is_extension_supported("GL_EXT_texture_compression_latc")) {
 		compressed_formats =
 			add_formats(compressed_formats,
 				    &num_compressed_formats,
@@ -308,7 +308,7 @@ piglit_init(int argc, char **argv)
 				    GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT);
 	}
 
-	if (GLEW_ATI_texture_compression_3dc) {
+	if (piglit_is_extension_supported("GL_ATI_texture_compression_3dc")) {
 		compressed_formats =
 			add_formats(compressed_formats,
 				    &num_compressed_formats,
@@ -324,19 +324,19 @@ piglit_init(int argc, char **argv)
 	/* Remove the various luminance and luminance-alpha formats from the
 	 * list since they cannot be used for the later tests.
 	 */
-	if (GLEW_ATI_texture_compression_3dc) {
+	if (piglit_is_extension_supported("GL_ATI_texture_compression_3dc")) {
 		num_compressed_formats--;
 	}
 
-	if (GLEW_EXT_texture_compression_latc) {
+	if (piglit_is_extension_supported("GL_EXT_texture_compression_latc")) {
 		num_compressed_formats -= 4;
 	}
 
 	/* Add the RGTC formats, then check them.
 	 */
-	if (GLEW_ARB_texture_rg) {
-		if (GLEW_ARB_texture_compression_rgtc
-		    || GLEW_EXT_texture_compression_rgtc) {
+	if (piglit_is_extension_supported("GL_ARB_texture_rg")) {
+		if (piglit_is_extension_supported("GL_ARB_texture_compression_rgtc")
+		    || piglit_is_extension_supported("GL_EXT_texture_compression_rgtc")) {
 			compressed_formats =
 				add_formats(compressed_formats,
 					    &num_compressed_formats,
@@ -356,8 +356,8 @@ piglit_init(int argc, char **argv)
 		/* Remove the RGTC formats from the list since they cannot be
 		 * used for the later tests.
 		 */
-		if (GLEW_ARB_texture_compression_rgtc
-		    || GLEW_EXT_texture_compression_rgtc) {
+		if (piglit_is_extension_supported("GL_ARB_texture_compression_rgtc")
+		    || piglit_is_extension_supported("GL_EXT_texture_compression_rgtc")) {
 			num_compressed_formats -= 4;
 		}
 	}
@@ -365,7 +365,7 @@ piglit_init(int argc, char **argv)
 
 	/* Add the sRGB formats, then check them.
 	 */
-	if (GLEW_EXT_texture_sRGB) {
+	if (piglit_is_extension_supported("GL_EXT_texture_sRGB")) {
 		compressed_formats =
 			add_formats(compressed_formats,
 				    &num_compressed_formats,
@@ -375,7 +375,7 @@ piglit_init(int argc, char **argv)
 				    GL_COMPRESSED_SLUMINANCE,
 				    GL_COMPRESSED_SLUMINANCE_ALPHA);
 
-		if (GLEW_EXT_texture_compression_s3tc) {
+		if (piglit_is_extension_supported("GL_EXT_texture_compression_s3tc")) {
 			compressed_formats =
 				add_formats(compressed_formats,
 					    &num_compressed_formats,
@@ -396,7 +396,7 @@ piglit_init(int argc, char **argv)
 		 * used for the later tests.
 		 */
 		num_compressed_formats -= 4;
-		if (GLEW_EXT_texture_compression_s3tc) {
+		if (piglit_is_extension_supported("GL_EXT_texture_compression_s3tc")) {
 			num_compressed_formats -= 4;
 		}
 	}
diff --git a/tests/spec/arb_texture_compression/invalid-formats.c b/tests/spec/arb_texture_compression/invalid-formats.c
index 2429497..fd3f730 100644
--- a/tests/spec/arb_texture_compression/invalid-formats.c
+++ b/tests/spec/arb_texture_compression/invalid-formats.c
@@ -376,58 +376,58 @@ piglit_init(int argc, char **argv)
 					   compressed_formats,
 					   num_compressed_formats,
 					   check_errors,
-					   GLEW_ARB_texture_compression_bptc)
+					   piglit_is_extension_supported("GL_ARB_texture_compression_bptc"))
 				&& pass;
 		} else if (strcmp(argv[i], "s3tc") == 0) {
 			pass = try_formats(&s3tc_formats,
 					   compressed_formats,
 					   num_compressed_formats,
 					   check_errors,
-					   GLEW_EXT_texture_compression_s3tc)
+					   piglit_is_extension_supported("GL_EXT_texture_compression_s3tc"))
 				&& pass;
 		} else if (strcmp(argv[i], "fxt1") == 0) {
 			pass = try_formats(&fxt1_formats,
 					   compressed_formats,
 					   num_compressed_formats,
 					   check_errors,
-					   GLEW_3DFX_texture_compression_FXT1)
+					   piglit_is_extension_supported("GL_3DFX_texture_compression_FXT1"))
 				&& pass;
 		} else if (strcmp(argv[i], "latc") == 0) {
 			pass = try_formats(&latc_formats,
 					   compressed_formats,
 					   num_compressed_formats,
 					   check_errors,
-					   GLEW_EXT_texture_compression_latc)
+					   piglit_is_extension_supported("GL_EXT_texture_compression_latc"))
 				&& pass;
 		} else if (strcmp(argv[i], "3dc") == 0) {
 			pass = try_formats(&ati_3dc_formats,
 					   compressed_formats,
 					   num_compressed_formats,
 					   check_errors,
-					   GLEW_ATI_texture_compression_3dc)
+					   piglit_is_extension_supported("GL_ATI_texture_compression_3dc"))
 				&& pass;
 		} else if (strcmp(argv[i], "rgtc") == 0) {
 			pass = try_formats(&rgtc_formats,
 					   compressed_formats,
 					   num_compressed_formats,
 					   check_errors,
-					   (GLEW_ARB_texture_compression_rgtc
-					    || GLEW_EXT_texture_compression_rgtc))
+					   (piglit_is_extension_supported("GL_ARB_texture_compression_rgtc")
+					    || piglit_is_extension_supported("GL_EXT_texture_compression_rgtc")))
 				&& pass;
 		} else if (strcmp(argv[i], "srgb") == 0) {
 			pass = try_formats(&srgb_formats,
 					   compressed_formats,
 					   num_compressed_formats,
 					   check_errors,
-					   (GLEW_EXT_texture_sRGB
-					    && GLEW_EXT_texture_compression_s3tc))
+					   (piglit_is_extension_supported("GL_EXT_texture_sRGB")
+					    && piglit_is_extension_supported("GL_EXT_texture_compression_s3tc")))
 				&& pass;
 		} else if (strcmp(argv[i], "paletted") == 0) {
 			pass = try_formats(&paletted_formats,
 					   compressed_formats,
 					   num_compressed_formats,
 					   check_errors,
-					   GLEW_OES_compressed_paletted_texture)
+					   piglit_is_extension_supported("GL_OES_compressed_paletted_texture"))
 				&& pass;
 		} else {
 			fprintf(stderr,
diff --git a/tests/texturing/depth-cube-map.c b/tests/texturing/depth-cube-map.c
index b5ea216..78cb86f 100644
--- a/tests/texturing/depth-cube-map.c
+++ b/tests/texturing/depth-cube-map.c
@@ -158,7 +158,7 @@ void
 piglit_init(int argc, char **argv)
 {
 	/* Check if EXT_gpu_shader4 is supported */
-	if (!piglit_is_extension_supported("EXT_gpu_shader4"))
+	if (!piglit_is_extension_supported("GL_EXT_gpu_shader4"))
 		/* If EXT_gpu_shader4 is not supported GL version must be 3.0 */
 		piglit_require_gl_version(30);
 	loadTex();
diff --git a/tests/texturing/texture-rg.c b/tests/texturing/texture-rg.c
index fd06469..4831c4b 100644
--- a/tests/texturing/texture-rg.c
+++ b/tests/texturing/texture-rg.c
@@ -137,7 +137,7 @@ test_teximage_formats(void)
       if (info->IsInteger) {
 #if 0
          /* XXX we don't test integer texture formats yet */
-         if (!GLEW_EXT_texture_integer) {
+	      if (!piglit_is_extension_supported("GL_EXT_texture_integer")) {
             continue;
          }
          else {
@@ -148,7 +148,7 @@ test_teximage_formats(void)
 #endif
       }
       else if (info->IsFloat) {
-         if (!GLEW_ARB_texture_float) {
+	      if (!piglit_is_extension_supported("GL_ARB_texture_float")) {
             continue;
          }
       }
diff --git a/tests/util/piglit-shader-gl.c b/tests/util/piglit-shader-gl.c
index db41a58..e29a07f 100644
--- a/tests/util/piglit-shader-gl.c
+++ b/tests/util/piglit-shader-gl.c
@@ -195,7 +195,7 @@ piglit_require_GLSL(void)
 {
 	if (piglit_get_gl_version() >= 20) {
 		init_functions_from_core();
-	} else if (GLEW_ARB_shader_objects && GLEW_ARB_shading_language_100) {
+	} else if (piglit_is_extension_supported("GL_ARB_shader_objects") && piglit_is_extension_supported("GL_ARB_shading_language_100")) {
 		init_functions_from_extension();
 	} else {
 		printf("GLSL not supported.\n");
@@ -227,7 +227,7 @@ piglit_require_vertex_shader(void)
 {
 	if (piglit_get_gl_version() >= 20) {
 		init_functions_from_core();
-	} else if (GLEW_ARB_shader_objects && GLEW_ARB_vertex_shader) {
+	} else if (piglit_is_extension_supported("GL_ARB_shader_objects") && piglit_is_extension_supported("GL_ARB_vertex_shader")) {
 		init_functions_from_extension();
 	} else {
 		printf("GLSL vertex shaders are not supported.\n");
@@ -241,7 +241,7 @@ piglit_require_fragment_shader(void)
 {
 	if (piglit_get_gl_version() >= 20) {
 		init_functions_from_core();
-	} else if (GLEW_ARB_shader_objects && GLEW_ARB_fragment_shader) {
+	} else if (piglit_is_extension_supported("GL_ARB_shader_objects") && piglit_is_extension_supported("GL_ARB_fragment_shader")) {
 		init_functions_from_extension();
 	} else {
 		printf("GLSL vertex shaders are not supported.\n");
diff --git a/tests/util/piglit-transform-feedback.c b/tests/util/piglit-transform-feedback.c
index ba88c5b..4e7f9cc 100644
--- a/tests/util/piglit-transform-feedback.c
+++ b/tests/util/piglit-transform-feedback.c
@@ -71,7 +71,7 @@ piglit_require_transform_feedback(void)
 {
 	if (piglit_get_gl_version() >= 30) {
 		init_functions_from_core();
-	} else if (GLEW_EXT_transform_feedback) {
+	} else if (piglit_is_extension_supported("GL_EXT_transform_feedback")) {
 		init_functions_from_ext();
 	} else {
 		printf("Transform feedback not supported.\n");
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 3562aa6..4270cd6 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -621,7 +621,7 @@ int piglit_use_fragment_program(void)
 		;
 
 	glewInit();
-	if (!GLEW_ARB_fragment_program)
+	if (!piglit_is_extension_supported("GL_ARB_fragment_program"))
 		return 0;
 
 	piglit_ARBfp_pass_through =
@@ -642,7 +642,7 @@ void piglit_require_fragment_program(void)
 int piglit_use_vertex_program(void)
 {
 	glewInit();
-	return GLEW_ARB_vertex_program;
+	return piglit_is_extension_supported("GL_ARB_vertex_program");
 }
 
 void piglit_require_vertex_program(void)
-- 
1.7.7.6



More information about the Piglit mailing list