Commit 7ffd7d06 authored by Paul Berry's avatar Paul Berry

Stop using GLEW_VERSION_* macros

Several tests were checking the GL version using GLEW's GLEW_VERSION_*
macros.  This patch changes the tests to use piglit_get_gl_version(),
which provides the same functionality in a way that is not dependent
on GLEW.
Reviewed-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
Reviewed-by: default avatarChad Versace <chad.versace@linux.intel.com>
parent ac16e8c5
...@@ -60,7 +60,7 @@ piglit_init(int argc, char **argv) ...@@ -60,7 +60,7 @@ piglit_init(int argc, char **argv)
(void) argc; (void) argc;
(void) argv; (void) argv;
if (!GLEW_VERSION_1_3) { if (piglit_get_gl_version() < 13) {
printf("Requires OpenGL 1.3\n"); printf("Requires OpenGL 1.3\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -8,7 +8,7 @@ piglit_init(int argc, char *argv[]) ...@@ -8,7 +8,7 @@ piglit_init(int argc, char *argv[])
{ {
GLuint id; GLuint id;
if (!GLEW_VERSION_1_5) { if (piglit_get_gl_version() < 15) {
printf("Requires OpenGL 1.5\n"); printf("Requires OpenGL 1.5\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -77,7 +77,7 @@ enum piglit_result ...@@ -77,7 +77,7 @@ enum piglit_result
piglit_display(void) piglit_display(void)
{ {
static const GLenum origins[2] = { GL_UPPER_LEFT, GL_LOWER_LEFT }; static const GLenum origins[2] = { GL_UPPER_LEFT, GL_LOWER_LEFT };
const unsigned num_rows = (GLEW_VERSION_2_0) ? 2 : 1; const unsigned num_rows = (piglit_get_gl_version() >= 20) ? 2 : 1;
GLboolean pass = GL_TRUE; GLboolean pass = GL_TRUE;
unsigned i; unsigned i;
unsigned j; unsigned j;
...@@ -95,7 +95,7 @@ piglit_display(void) ...@@ -95,7 +95,7 @@ piglit_display(void)
/* OpenGL version must be at least 2.0 to support modifying /* OpenGL version must be at least 2.0 to support modifying
* GL_POINT_SPRITE_COORD_ORIGIN. * GL_POINT_SPRITE_COORD_ORIGIN.
*/ */
if (GLEW_VERSION_2_0) if (piglit_get_gl_version() >= 20)
glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN,
origins[i]); origins[i]);
......
...@@ -159,7 +159,7 @@ void piglit_init(int argc, char **argv) ...@@ -159,7 +159,7 @@ void piglit_init(int argc, char **argv)
{ {
GLuint fs, vs; GLuint fs, vs;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -209,7 +209,7 @@ piglit_display(void) ...@@ -209,7 +209,7 @@ piglit_display(void)
void void
piglit_init(int argc, char **argv) piglit_init(int argc, char **argv)
{ {
if (!GLEW_VERSION_1_4) { if (piglit_get_gl_version() < 14) {
printf("Requires OpenGL 1.4\n"); printf("Requires OpenGL 1.4\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -229,7 +229,7 @@ piglit_init(int argc, char **argv) ...@@ -229,7 +229,7 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -178,7 +178,7 @@ piglit_init(int argc, char **argv) ...@@ -178,7 +178,7 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -186,7 +186,7 @@ piglit_init(int argc, char **argv) ...@@ -186,7 +186,7 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -139,7 +139,7 @@ piglit_init(int argc, char **argv) ...@@ -139,7 +139,7 @@ piglit_init(int argc, char **argv)
{ {
GLint vs, fs; GLint vs, fs;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -208,7 +208,7 @@ piglit_init(int argc, char**argv) ...@@ -208,7 +208,7 @@ piglit_init(int argc, char**argv)
{ {
GLuint vs, fs; GLuint vs, fs;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -212,7 +212,7 @@ piglit_display(void) ...@@ -212,7 +212,7 @@ piglit_display(void)
void void
piglit_init(int argc, char **argv) piglit_init(int argc, char **argv)
{ {
if (!GLEW_VERSION_1_4) { if (piglit_get_gl_version() < 14) {
printf("Requires OpenGL 1.4\n"); printf("Requires OpenGL 1.4\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -50,7 +50,7 @@ static GLubyte colors[16] = {255, 0, 0, 127, ...@@ -50,7 +50,7 @@ static GLubyte colors[16] = {255, 0, 0, 127,
void void
piglit_init(int argc, char **argv) piglit_init(int argc, char **argv)
{ {
if (!GLEW_VERSION_1_4) { if (piglit_get_gl_version() < 14) {
printf("Requires OpenGL 1.4\n"); printf("Requires OpenGL 1.4\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -108,7 +108,7 @@ compileLinkProg(void) ...@@ -108,7 +108,7 @@ compileLinkProg(void)
void void
piglit_init(int argc, char **argv) piglit_init(int argc, char **argv)
{ {
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -130,7 +130,7 @@ piglit_init(int argc, char **argv) ...@@ -130,7 +130,7 @@ piglit_init(int argc, char **argv)
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
if (!GLEW_VERSION_1_4) { if (piglit_get_gl_version() < 14) {
printf("Requires OpenGL 1.4\n"); printf("Requires OpenGL 1.4\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -89,7 +89,7 @@ piglit_display(void) ...@@ -89,7 +89,7 @@ piglit_display(void)
void void
piglit_init(int argc, char **argv) piglit_init(int argc, char **argv)
{ {
if (!GLEW_VERSION_1_4 && !GLEW_NV_blend_square) { if (piglit_get_gl_version() < 14 && !GLEW_NV_blend_square) {
printf("Sorry, this program requires either OpenGL 1.4 or " printf("Sorry, this program requires either OpenGL 1.4 or "
"GL_NV_blend_square\n"); "GL_NV_blend_square\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
......
...@@ -127,7 +127,7 @@ piglit_init(int argc, char **argv) ...@@ -127,7 +127,7 @@ piglit_init(int argc, char **argv)
{ {
GLuint vert_prog, frag_prog; GLuint vert_prog, frag_prog;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -30,7 +30,7 @@ int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE; ...@@ -30,7 +30,7 @@ int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
void void
piglit_init(int argc, char **argv) piglit_init(int argc, char **argv)
{ {
if (!GLEW_VERSION_1_4) { if (piglit_get_gl_version() < 14) {
printf("Requires OpenGL 1.4.\n"); printf("Requires OpenGL 1.4.\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -44,7 +44,7 @@ void piglit_init(int argc, char **argv) ...@@ -44,7 +44,7 @@ void piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
if (!GLEW_VERSION_1_5) { if (piglit_get_gl_version() < 15) {
printf("Requires OpenGL 1.5\n"); printf("Requires OpenGL 1.5\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -49,7 +49,7 @@ piglit_init(int argc, char **argv) ...@@ -49,7 +49,7 @@ piglit_init(int argc, char **argv)
{ {
GLfloat red[4] = {1, 0, 0, 1}; GLfloat red[4] = {1, 0, 0, 1};
if (!GLEW_VERSION_1_2) { if (piglit_get_gl_version() < 12) {
printf("Requires OpenGL 1.2\n"); printf("Requires OpenGL 1.2\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -49,7 +49,7 @@ void piglit_init(int argc, char **argv) ...@@ -49,7 +49,7 @@ void piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
if (!GLEW_VERSION_1_5) { if (piglit_get_gl_version() < 15) {
printf("Requires OpenGL 1.5\n"); printf("Requires OpenGL 1.5\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -49,7 +49,7 @@ void piglit_init(int argc, char **argv) ...@@ -49,7 +49,7 @@ void piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
if (!GLEW_VERSION_1_5) { if (piglit_get_gl_version() < 15) {
printf("Requires OpenGL 1.5\n"); printf("Requires OpenGL 1.5\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -49,7 +49,7 @@ void piglit_init(int argc, char **argv) ...@@ -49,7 +49,7 @@ void piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
if (!GLEW_VERSION_1_5) { if (piglit_get_gl_version() < 15) {
printf("Requires OpenGL 1.5\n"); printf("Requires OpenGL 1.5\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -144,7 +144,7 @@ piglit_init(int argc, char **argv) ...@@ -144,7 +144,7 @@ piglit_init(int argc, char **argv)
{ {
int i; int i;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0 / GLSL\n"); printf("Requires OpenGL 2.0 / GLSL\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -100,7 +100,7 @@ piglit_display(void) ...@@ -100,7 +100,7 @@ piglit_display(void)
void void
piglit_init(int argc, char**argv) piglit_init(int argc, char**argv)
{ {
if (!GLEW_VERSION_1_5) { if (piglit_get_gl_version() < 15) {
printf("Requires OpenGL 1.5\n"); printf("Requires OpenGL 1.5\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -126,7 +126,7 @@ piglit_init(int argc, char **argv) ...@@ -126,7 +126,7 @@ piglit_init(int argc, char **argv)
{ {
GLint query_bits; GLint query_bits;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -173,7 +173,7 @@ piglit_init(int argc, char **argv) ...@@ -173,7 +173,7 @@ piglit_init(int argc, char **argv)
glDepthFunc(GL_LESS); glDepthFunc(GL_LESS);
if (GLEW_VERSION_1_5) { if (piglit_get_gl_version() >= 15) {
gen_queries = GLEW_GET_FUN(__glewGenQueries); gen_queries = GLEW_GET_FUN(__glewGenQueries);
begin_query = GLEW_GET_FUN(__glewBeginQuery); begin_query = GLEW_GET_FUN(__glewBeginQuery);
end_query = GLEW_GET_FUN(__glewEndQuery); end_query = GLEW_GET_FUN(__glewEndQuery);
......
...@@ -217,13 +217,13 @@ piglit_display(void) ...@@ -217,13 +217,13 @@ piglit_display(void)
void void
piglit_init(int argc, char **argv) piglit_init(int argc, char **argv)
{ {
if (!GLEW_ATI_separate_stencil && !GLEW_VERSION_2_0) { if (!GLEW_ATI_separate_stencil && piglit_get_gl_version() < 20) {
printf("Sorry, this program requires either " printf("Sorry, this program requires either "
"GL_ATI_separate_stencil or OpenGL 2.0.\n"); "GL_ATI_separate_stencil or OpenGL 2.0.\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
use20syntax = 0; use20syntax = 0;
} }
......
...@@ -144,7 +144,7 @@ piglit_display(void) ...@@ -144,7 +144,7 @@ piglit_display(void)
void void
piglit_init(int argc, char **argv) piglit_init(int argc, char **argv)
{ {
if (!GLEW_EXT_stencil_wrap && !GLEW_VERSION_1_4) { if (!GLEW_EXT_stencil_wrap && piglit_get_gl_version() < 14) {
printf("Sorry, this program requires either " printf("Sorry, this program requires either "
"GL_EXT_stencil_wrap or OpenGL 1.4.\n"); "GL_EXT_stencil_wrap or OpenGL 1.4.\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
......
...@@ -384,7 +384,7 @@ init(void) ...@@ -384,7 +384,7 @@ init(void)
void void
piglit_init(int argc, char *argv[]) piglit_init(int argc, char *argv[])
{ {
if (!GLEW_VERSION_1_3) { if (piglit_get_gl_version() < 13) {
printf("Requires OpenGL 1.3\n"); printf("Requires OpenGL 1.3\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -68,7 +68,7 @@ piglit_init(int argc, char **argv) ...@@ -68,7 +68,7 @@ piglit_init(int argc, char **argv)
}; };
GLubyte indices[] = {0, 1, 2, 3}; GLubyte indices[] = {0, 1, 2, 3};
if (!GLEW_VERSION_1_5) { if (piglit_get_gl_version() < 15) {
printf("Requires OpenGL 1.5\n"); printf("Requires OpenGL 1.5\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -90,7 +90,7 @@ draw(Display *dpy) ...@@ -90,7 +90,7 @@ draw(Display *dpy)
glewInit(); glewInit();
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("%s: Requires OpenGL 2.0\n", TestName); printf("%s: Requires OpenGL 2.0\n", TestName);
return PIGLIT_SKIP; return PIGLIT_SKIP;
} }
......
...@@ -54,7 +54,7 @@ piglit_init(int argc, char **argv) ...@@ -54,7 +54,7 @@ piglit_init(int argc, char **argv)
GLuint prog; GLuint prog;
GLuint vs; GLuint vs;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -49,7 +49,7 @@ piglit_init(int argc, char **argv) ...@@ -49,7 +49,7 @@ piglit_init(int argc, char **argv)
GLuint got; GLuint got;
GLuint vs; GLuint vs;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -50,7 +50,7 @@ piglit_init(int argc, char **argv) ...@@ -50,7 +50,7 @@ piglit_init(int argc, char **argv)
GLuint prog; GLuint prog;
GLenum err; GLenum err;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -110,7 +110,7 @@ piglit_init(int argc, char **argv) ...@@ -110,7 +110,7 @@ piglit_init(int argc, char **argv)
? 0 : GL_INVALID_ENUM; ? 0 : GL_INVALID_ENUM;
GLboolean pass; GLboolean pass;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -134,7 +134,7 @@ piglit_init(int argc, char **argv) ...@@ -134,7 +134,7 @@ piglit_init(int argc, char **argv)
glClearColor(0.3, 0.3, 0.3, 0.3); glClearColor(0.3, 0.3, 0.3, 0.3);
if (GLEW_VERSION_1_4) { if (piglit_get_gl_version() >= 14) {
pglFogCoordf = glFogCoordf; pglFogCoordf = glFogCoordf;
} else if (GLEW_EXT_fog_coord) { } else if (GLEW_EXT_fog_coord) {
pglFogCoordf = glFogCoordfEXT; pglFogCoordf = glFogCoordfEXT;
......
...@@ -274,7 +274,7 @@ piglit_init(int argc, char **argv) ...@@ -274,7 +274,7 @@ piglit_init(int argc, char **argv)
GLubyte rectangle[200][200][4]; GLubyte rectangle[200][200][4];
GLubyte tex[256*256][4]; GLubyte tex[256*256][4];
if (!GLEW_VERSION_1_3) { if (piglit_get_gl_version() < 13) {
printf("Requires OpenGL 1.3\n"); printf("Requires OpenGL 1.3\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -278,7 +278,7 @@ piglit_init(int argc, char **argv) ...@@ -278,7 +278,7 @@ piglit_init(int argc, char **argv)
glutReshapeFunc(Reshape); glutReshapeFunc(Reshape);
if (!GLEW_VERSION_1_3) { if (piglit_get_gl_version() < 13) {
printf("Requires OpenGL 1.3\n"); printf("Requires OpenGL 1.3\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -61,7 +61,7 @@ piglit_init(int argc, char **argv) ...@@ -61,7 +61,7 @@ piglit_init(int argc, char **argv)
{ {
GLint vs, fs; GLint vs, fs;
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);
} }
......
...@@ -218,7 +218,7 @@ static void key_func(unsigned char key, int x, int y) ...@@ -218,7 +218,7 @@ static void key_func(unsigned char key, int x, int y)
void void
piglit_init(int argc, char **argv) piglit_init(int argc, char **argv)
{ {
if (!GLEW_VERSION_2_0) { if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n"); printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP); piglit_report_result(PIGLIT_SKIP);