Commit a4ba962e authored by Paul Berry's avatar Paul Berry

Stop using GLEW extension macros

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().
Reviewed-by: default avatarChad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
parent 7ffd7d06
......@@ -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 {
......
......@@ -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],
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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)
......
......@@ -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);
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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;
}
}
......
......@@ -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,
......
......@@ -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();
......
......@@ -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;
}
}
......
......@@ -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");
......
......@@ -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");
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment