[Piglit] [PATCH 02/31] Remove GLenum string literals.

Fabian Bieler fabianbieler at fastmail.fm
Thu Dec 28 15:57:28 UTC 2017


Replace GLenum string literals with calls to piglit_get_gl_enum_name.

This commit modifies all tests were the replacement is simple and
straightforward.
---
 tests/fbo/fbo-integer.c                            | 34 +++++-----
 tests/fbo/fbo-readpixels-depth-formats.c           | 12 ++--
 tests/general/polygon-mode.c                       | 27 +++-----
 tests/general/primitive-restart.c                  |  8 +--
 tests/shaders/vp-max-array.c                       | 10 +--
 .../spec/arb_direct_state_access/texture-storage.c |  5 +-
 ...ufferRenderbuffer-GL_DEPTH_STENCIL_ATTACHMENT.c | 24 +------
 ...mebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT.c | 44 ++-----------
 tests/spec/arb_separate_shader_objects/dlist.c     | 11 ++--
 .../program-interface-query.c                      | 16 +----
 .../spec/arb_texture_float/texture-float-formats.c | 49 ++++++--------
 tests/spec/arb_texture_multisample/texstate.c      |  7 +-
 tests/spec/arb_texture_storage/texture-storage.c   |  5 +-
 .../fbo-integer-precision-clear.c                  | 16 ++---
 .../fbo-integer-readpixels-sint-uint.c             | 12 ++--
 tests/spec/gl-1.0/rendermode-feedback.c            | 28 ++++----
 tests/spec/gl-3.0/texture-integer.c                | 76 +++++++++++-----------
 tests/spec/gles-2.0/invalid-es3-queries.c          | 68 +++++++++----------
 tests/spec/khr_debug/debug-object-label.c          | 31 ++++-----
 tests/spec/oes_texture_float/oes_texture_float.c   | 16 ++---
 tests/texturing/texture-rg.c                       | 54 +++++++--------
 21 files changed, 228 insertions(+), 325 deletions(-)

diff --git a/tests/fbo/fbo-integer.c b/tests/fbo/fbo-integer.c
index 0bd40adb3..08e4e153c 100644
--- a/tests/fbo/fbo-integer.c
+++ b/tests/fbo/fbo-integer.c
@@ -45,7 +45,6 @@ static GLint TexWidth = 256, TexHeight = 256;
 
 struct format_info
 {
-   const char *Name;
    GLenum IntFormat, BaseFormat;
    GLuint BitsPerChannel;
    GLboolean Signed;
@@ -54,19 +53,19 @@ struct format_info
 
 static const struct format_info Formats[] = {
    /*   { "GL_RGBA", GL_RGBA, GL_RGBA, 8, GL_FALSE },*/
-   { "GL_RGBA8I_EXT",   GL_RGBA8I_EXT,   GL_RGBA_INTEGER_EXT, 8,  GL_TRUE  },
-   { "GL_RGBA8UI_EXT",  GL_RGBA8UI_EXT , GL_RGBA_INTEGER_EXT, 8,  GL_FALSE },
-   { "GL_RGBA16I_EXT",  GL_RGBA16I_EXT,  GL_RGBA_INTEGER_EXT, 16, GL_TRUE  },
-   { "GL_RGBA16UI_EXT", GL_RGBA16UI_EXT, GL_RGBA_INTEGER_EXT, 16, GL_FALSE },
-   { "GL_RGBA32I_EXT",  GL_RGBA32I_EXT,  GL_RGBA_INTEGER_EXT, 32, GL_TRUE  },
-   { "GL_RGBA32UI_EXT", GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, 32, GL_FALSE },
+   { GL_RGBA8I_EXT,   GL_RGBA_INTEGER_EXT, 8,  GL_TRUE  },
+   { GL_RGBA8UI_EXT , GL_RGBA_INTEGER_EXT, 8,  GL_FALSE },
+   { GL_RGBA16I_EXT,  GL_RGBA_INTEGER_EXT, 16, GL_TRUE  },
+   { GL_RGBA16UI_EXT, GL_RGBA_INTEGER_EXT, 16, GL_FALSE },
+   { GL_RGBA32I_EXT,  GL_RGBA_INTEGER_EXT, 32, GL_TRUE  },
+   { GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, 32, GL_FALSE },
 
-   { "GL_RGB8I_EXT",   GL_RGB8I_EXT,   GL_RGB_INTEGER_EXT, 8,  GL_TRUE  },
-   { "GL_RGB8UI_EXT",  GL_RGB8UI_EXT , GL_RGB_INTEGER_EXT, 8,  GL_FALSE },
-   { "GL_RGB16I_EXT",  GL_RGB16I_EXT,  GL_RGB_INTEGER_EXT, 16, GL_TRUE  },
-   { "GL_RGB16UI_EXT", GL_RGB16UI_EXT, GL_RGB_INTEGER_EXT, 16, GL_FALSE },
-   { "GL_RGB32I_EXT",  GL_RGB32I_EXT,  GL_RGB_INTEGER_EXT, 32, GL_TRUE  },
-   { "GL_RGB32UI_EXT", GL_RGB32UI_EXT, GL_RGB_INTEGER_EXT, 32, GL_FALSE },
+   { GL_RGB8I_EXT,   GL_RGB_INTEGER_EXT, 8,  GL_TRUE  },
+   { GL_RGB8UI_EXT , GL_RGB_INTEGER_EXT, 8,  GL_FALSE },
+   { GL_RGB16I_EXT,  GL_RGB_INTEGER_EXT, 16, GL_TRUE  },
+   { GL_RGB16UI_EXT, GL_RGB_INTEGER_EXT, 16, GL_FALSE },
+   { GL_RGB32I_EXT,  GL_RGB_INTEGER_EXT, 32, GL_TRUE  },
+   { GL_RGB32UI_EXT, GL_RGB_INTEGER_EXT, 32, GL_FALSE },
 };
 
 #define NUM_FORMATS  (sizeof(Formats) / sizeof(Formats[0]))
@@ -191,6 +190,7 @@ test_fbo(const struct format_info *info)
    const int max = get_max_val(info);
    const int comps = num_components(info->BaseFormat);
    const GLenum type = get_datatype(info);
+   const char *name = piglit_get_gl_enum_name(info->IntFormat);
    GLint f;
    GLuint fbo, texObj;
    GLenum status;
@@ -198,7 +198,7 @@ test_fbo(const struct format_info *info)
    GLint buf;
 
    if (0)
-      fprintf(stderr, "============ Testing format = %s ========\n", info->Name);
+      fprintf(stderr, "============ Testing format = %s ========\n", name);
 
    /* Create texture */
    glGenTextures(1, &texObj);
@@ -260,7 +260,7 @@ test_fbo(const struct format_info *info)
       for (i = 0; i < comps; i++) {
          if (pix[i] != clr[i]) {
             fprintf(stderr, "%s: glClear failed\n", TestName);
-            fprintf(stderr, "  Texture format = %s\n", info->Name);
+            fprintf(stderr, "  Texture format = %s\n", name);
             fprintf(stderr, "  Expected %d, %d, %d, %d\n",
                     clr[0], clr[1], clr[2], clr[3]);
             fprintf(stderr, "  Found %d, %d, %d, %d\n",
@@ -313,7 +313,7 @@ test_fbo(const struct format_info *info)
             fprintf(stderr,
                  "%s: glDraw/ReadPixels failed at %d.  Expected %d, found %d\n",
                     TestName, i, image[i], readback[i]);
-            fprintf(stderr, "Texture format = %s\n", info->Name);
+            fprintf(stderr, "Texture format = %s\n", name);
             assert(0);
             return GL_FALSE;
          }
@@ -365,7 +365,7 @@ test_fbo(const struct format_info *info)
           abs(result[1] - value[1]) > error ||
           abs(result[2] - value[2]) > error ||
           abs(result[3] - value[3]) > error) {
-         fprintf(stderr, "%s: failure with format %s:\n", TestName, info->Name);
+         fprintf(stderr, "%s: failure with format %s:\n", TestName, name);
          fprintf(stderr, "  input value = %d, %d, %d, %d\n",
                  value[0], value[1], value[2], value[3]);
          fprintf(stderr, "  result color = %d, %d, %d, %d\n",
diff --git a/tests/fbo/fbo-readpixels-depth-formats.c b/tests/fbo/fbo-readpixels-depth-formats.c
index 3830da074..d53ce9eac 100644
--- a/tests/fbo/fbo-readpixels-depth-formats.c
+++ b/tests/fbo/fbo-readpixels-depth-formats.c
@@ -161,13 +161,12 @@ test_unsigned_byte(int x, int y, void *values)
 
 struct {
 	GLenum token;
-	char *name;
 	bool (*test)(int x, int y, void *values);
 } read_formats[] = {
-	{ GL_FLOAT, "GL_FLOAT", test_float },
-	{ GL_UNSIGNED_INT, "GL_UNSIGNED_INT", test_unsigned_int },
-	{ GL_UNSIGNED_SHORT, "GL_UNSIGNED_SHORT", test_unsigned_short },
-	{ GL_UNSIGNED_BYTE, "GL_UNSIGNED_BYTE", test_unsigned_byte },
+	{ GL_FLOAT, test_float },
+	{ GL_UNSIGNED_INT, test_unsigned_int },
+	{ GL_UNSIGNED_SHORT, test_unsigned_short },
+	{ GL_UNSIGNED_BYTE, test_unsigned_byte },
 };
 
 static bool
@@ -243,7 +242,8 @@ test_with_format(GLenum internal_format, const char *name)
 					      PIGLIT_PASS : PIGLIT_FAIL),
 					     "%s/%s",
 					     name,
-					     read_formats[i].name);
+					     piglit_get_gl_enum_name(
+						read_formats[i].token));
 		pass = format_passed && pass;
 	}
 
diff --git a/tests/general/polygon-mode.c b/tests/general/polygon-mode.c
index 2ca9f8e3e..c41c392f4 100644
--- a/tests/general/polygon-mode.c
+++ b/tests/general/polygon-mode.c
@@ -96,21 +96,6 @@ static const GLfloat Colors[VERTS][4] = {
 };
 
 
-static const char *
-get_mode_str(GLenum mode)
-{
-   switch (mode) {
-   case GL_POINT:
-      return "GL_POINT";
-   case GL_LINE:
-      return "GL_LINE";
-   case GL_FILL:
-      return "GL_FILL";
-   default:
-      return NULL;
-   }
-}
-
 
 static GLenum
 get_prim_mode(GLenum mode)
@@ -258,9 +243,11 @@ test_combo(GLenum frontMode, GLenum backMode)
          /* we didn't get the expected reference primitive */
          fprintf(stderr,
                  "%s: reference drawing failed for frontPrim=%s, backPrim=%s\n",
-                 TestName, get_mode_str(frontMode), get_mode_str(backMode));
+                 TestName, piglit_get_gl_enum_name(frontMode),
+		 piglit_get_gl_enum_name(backMode));
 	 fprintf(stderr, "At position %d, found prim %s instead of %s\n",
-		 i, get_mode_str(expectedPrims[i]), get_mode_str(testMode));
+		 i, piglit_get_gl_enum_name(expectedPrims[i]),
+		 piglit_get_gl_enum_name(testMode));
          return GL_FALSE;
       }
    }
@@ -276,9 +263,11 @@ test_combo(GLenum frontMode, GLenum backMode)
       GLenum prim = identify_primitive(&Positions[4 * i], Colors[4 * i]);
       if (prim != expectedPrims[i]) {
          fprintf(stderr, "%s: glPolygonMode(front=%s, back=%s) failed\n",
-                 TestName, get_mode_str(frontMode), get_mode_str(backMode));
+                 TestName, piglit_get_gl_enum_name(frontMode),
+		 piglit_get_gl_enum_name(backMode));
 	 fprintf(stderr, "At position %d, found prim %s instead of %s\n",
-		 i, get_mode_str(prim), get_mode_str(expectedPrims[i]));
+		 i, piglit_get_gl_enum_name(prim),
+		 piglit_get_gl_enum_name(expectedPrims[i]));
          pass = GL_FALSE;
       }
    }
diff --git a/tests/general/primitive-restart.c b/tests/general/primitive-restart.c
index 8c48bf6e9..abe55c7a8 100644
--- a/tests/general/primitive-restart.c
+++ b/tests/general/primitive-restart.c
@@ -296,7 +296,7 @@ test_draw_by_index(VBO_CFG vbo_cfg, bool one_by_one, GLenum primMode, GLenum ind
    GLuint restart_index;
    GLuint num_elems;
    bool pass = true;
-   const char *typeStr = NULL, *primStr = NULL;
+   const char *primStr = NULL;
    GLuint vbo1, vbo2;
    bool create_vbo1 = false;
    bool create_vbo2 = false;
@@ -323,15 +323,12 @@ test_draw_by_index(VBO_CFG vbo_cfg, bool one_by_one, GLenum primMode, GLenum ind
    switch (indexType) {
    case GL_UNSIGNED_BYTE:
       restart_index = 255;
-      typeStr = "GL_UNSIGNED_BYTE";
       break;
    case GL_UNSIGNED_SHORT:
       restart_index = 1000;
-      typeStr = "GL_UNSIGNED_SHORT";
       break;
    case GL_UNSIGNED_INT:
       restart_index = 1000 * 1000;
-      typeStr = "GL_UNSIGNED_INT";
       break;
    default:
       assert(0);
@@ -471,7 +468,8 @@ test_draw_by_index(VBO_CFG vbo_cfg, bool one_by_one, GLenum primMode, GLenum ind
       fprintf(stderr, "%s: failure drawing with %s(%s, %s), %s\n",
               TestName,
               one_by_one ? "glArrayElement" : "glDrawElements",
-              primStr, typeStr,
+              primStr,
+              piglit_get_gl_enum_name(indexType),
               vbo_cfg_names[vbo_cfg]);
       pass = false;
    }
diff --git a/tests/shaders/vp-max-array.c b/tests/shaders/vp-max-array.c
index d23486363..99abe3c8c 100644
--- a/tests/shaders/vp-max-array.c
+++ b/tests/shaders/vp-max-array.c
@@ -79,13 +79,13 @@ piglit_display(void)
 
 
 bool
-query_and_require_limit(GLenum pname, GLint *param, const char *name,
-			GLint minimum_maximum)
+query_and_require_limit(GLenum pname, GLint *param, GLint minimum_maximum)
 {
 	glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, pname, param);
 	if (*param < minimum_maximum) {
 		fprintf(stderr, "%s: Expected at least %d, got %d\n",
-			name, minimum_maximum, *param);
+			piglit_get_gl_enum_name(pname),
+			minimum_maximum, *param);
 		return false;
 	}
 
@@ -114,22 +114,18 @@ piglit_init(int argc, char **argv)
 	 */
 	pass = query_and_require_limit(GL_MAX_PROGRAM_PARAMETERS_ARB,
 				       & max_parameters,
-				       "GL_MAX_PROGRAM_PARAMETERS_ARB",
 				       96)
 		&& pass;
 	pass = query_and_require_limit(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB,
 				       & max_native_parameters,
-				       "GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB",
 				       96)
 		&& pass;
 	pass = query_and_require_limit(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB,
 				       & max_local_parameters,
-				       "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB",
 				       96)
 		&& pass;
 	pass = query_and_require_limit(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB,
 				       & max_env_parameters,
-				       "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB",
 				       96)
 		&& pass;
 	if (!pass) {
diff --git a/tests/spec/arb_direct_state_access/texture-storage.c b/tests/spec/arb_direct_state_access/texture-storage.c
index 2ce55c9f4..264e7ffe6 100644
--- a/tests/spec/arb_direct_state_access/texture-storage.c
+++ b/tests/spec/arb_direct_state_access/texture-storage.c
@@ -156,7 +156,7 @@ static bool
 test_mipmap_errors(GLenum target)
 {
 	GLint width = 128, height = 64, depth = 4, levels = 8;
-	const char *targetString = "";
+	const char *targetString = piglit_get_gl_enum_name(target);
 	GLuint tex;
 	GLint v, l;
 
@@ -169,14 +169,11 @@ test_mipmap_errors(GLenum target)
 
 	if (target == GL_TEXTURE_1D) {
 		glTextureStorage1D(tex, levels, GL_RGBA8, width);
-		targetString = "GL_TEXTURE_1D";
 	} else if (target == GL_TEXTURE_2D) {
 		glTextureStorage2D(tex, levels, GL_RGBA8, width, height);
-		targetString = "GL_TEXTURE_2D";
 	} else if (target == GL_TEXTURE_3D) {
 		glTextureStorage3D(tex, levels, GL_RGBA8, width, 
 			height, depth);
-		targetString = "GL_TEXTURE_3D";
 	}
 
 	piglit_check_gl_error(GL_NO_ERROR);
diff --git a/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferRenderbuffer-GL_DEPTH_STENCIL_ATTACHMENT.c b/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferRenderbuffer-GL_DEPTH_STENCIL_ATTACHMENT.c
index a385baf2c..7094ddce2 100644
--- a/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferRenderbuffer-GL_DEPTH_STENCIL_ATTACHMENT.c
+++ b/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferRenderbuffer-GL_DEPTH_STENCIL_ATTACHMENT.c
@@ -42,17 +42,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-const char*
-get_attachment_string(GLint attach)
-{
-	switch (attach) {
-	case GL_DEPTH_ATTACHMENT: return "GL_DEPTH_ATTACHMENT";
-	case GL_STENCIL_ATTACHMENT: return "GL_STENCIL_ATTACHMENT";
-	case GL_DEPTH_STENCIL_ATTACHMENT: return "GL_DEPTH_STENICL";
-	default: return NULL;
-	}
-}
-
 bool
 check_attachment(GLenum attach, GLint expect_name)
 {
@@ -65,17 +54,10 @@ check_attachment(GLenum attach, GLint expect_name)
 				              &actual_type);
 
 	if (actual_type != GL_RENDERBUFFER) {
-		char actual_type_str[16];
-
-		if (actual_type == GL_NONE) {
-			sprintf(actual_type_str, "GL_NONE");
-		} else {
-			snprintf(actual_type_str, 16, "0x%x", actual_type);
-		}
-
 		fprintf(stderr,
 			"error: expected GL_RENDERBUFFER for %s attachment type, but found %s\n",
-			get_attachment_string(attach), actual_type_str);
+			piglit_get_gl_enum_name(attach),
+			piglit_get_gl_enum_name(actual_type));
 
 		/* Return now and don't query the attachment name, because
 		 * that would generate a GL error.
@@ -91,7 +73,7 @@ check_attachment(GLenum attach, GLint expect_name)
 	if (actual_name != expect_name) {
 		fprintf(stderr,
 			"error: expected %d for %s attachment name, but found %d\n",
-			expect_name, get_attachment_string(attach), actual_name);
+			expect_name, piglit_get_gl_enum_name(attach), actual_name);
 		return false;
 	}
 
diff --git a/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT.c b/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT.c
index fb0e59f5a..1de6a1caa 100644
--- a/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT.c
+++ b/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT.c
@@ -43,31 +43,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-const char*
-get_cube_map_face_string(GLenum face)
-{
-	switch (face) {
-	case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: return "GL_TEXTURE_CUBE_MAP_POSITIVE_Y";
-	case GL_TEXTURE_CUBE_MAP_POSITIVE_X: return "GL_TEXTURE_CUBE_MAP_POSITIVE_X";
-	case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: return "GL_TEXTURE_CUBE_MAP_POSITIVE_Z";
-	case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: return "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y";
-	case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: return "GL_TEXTURE_CUBE_MAP_NEGATIVE_X";
-	case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: return "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z";
-	default: return NULL;
-	}
-}
-
-const char*
-get_attachment_string(GLint attach)
-{
-	switch (attach) {
-	case GL_DEPTH_ATTACHMENT: return "GL_DEPTH_ATTACHMENT";
-	case GL_STENCIL_ATTACHMENT: return "GL_STENCIL_ATTACHMENT";
-	case GL_DEPTH_STENCIL_ATTACHMENT: return "GL_DEPTH_STENICL";
-	default: return NULL;
-	}
-}
-
 bool
 check_attachment(GLenum attach, GLint expect_name, GLenum expect_cube_map_face)
 {
@@ -81,17 +56,10 @@ check_attachment(GLenum attach, GLint expect_name, GLenum expect_cube_map_face)
 				              &actual_type);
 
 	if (actual_type != GL_TEXTURE) {
-		char actual_type_str[16];
-
-		if (actual_type == GL_NONE) {
-			sprintf(actual_type_str, "GL_NONE");
-		} else {
-			snprintf(actual_type_str, 16, "0x%x", actual_type);
-		}
-
 		fprintf(stderr,
 			"error: expected GL_TEXTURE for %s attachment type, but found %s\n",
-			get_attachment_string(attach), actual_type_str);
+			piglit_get_gl_enum_name(attach),
+			piglit_get_gl_enum_name(actual_type));
 
 		/* Return now and don't query the attachment name, because
 		 * that would generate a GL error.
@@ -107,7 +75,7 @@ check_attachment(GLenum attach, GLint expect_name, GLenum expect_cube_map_face)
 	if (actual_name != expect_name) {
 		fprintf(stderr,
 			"error: expected %d for %s attachment name, but found %d\n",
-			expect_name, get_attachment_string(attach), actual_name);
+			expect_name, piglit_get_gl_enum_name(attach), actual_name);
 		return false;
 	}
 
@@ -119,9 +87,9 @@ check_attachment(GLenum attach, GLint expect_name, GLenum expect_cube_map_face)
 	if (actual_cube_map_face != expect_cube_map_face) {
 		fprintf(stderr,
 			"error: expected %s for %s attachment cube map face, but found %s\n",
-			get_cube_map_face_string(expect_cube_map_face),
-			get_attachment_string(attach),
-			get_cube_map_face_string(actual_cube_map_face));
+			piglit_get_gl_enum_name(expect_cube_map_face),
+			piglit_get_gl_enum_name(attach),
+			piglit_get_gl_enum_name(actual_cube_map_face));
 		return false;
 	}
 
diff --git a/tests/spec/arb_separate_shader_objects/dlist.c b/tests/spec/arb_separate_shader_objects/dlist.c
index c007aa566..15dce4561 100644
--- a/tests/spec/arb_separate_shader_objects/dlist.c
+++ b/tests/spec/arb_separate_shader_objects/dlist.c
@@ -615,28 +615,27 @@ process_shader(const char *func, const char *source, bool matrix)
 {
 	static const struct {
 		GLenum list_mode;
-		const char *list_mode_name;
 		enum mode setter_mode;
 		const char *setter_mode_name;
 		unsigned base_value;
 	} tests[] = {
 		{
-			GL_COMPILE, "GL_COMPILE",
+			GL_COMPILE,
 			set_scalar, "scalar",
 			5
 		},
 		{
-			GL_COMPILE, "GL_COMPILE",
+			GL_COMPILE,
 			set_vector, "vector",
 			7
 		},
 		{
-			GL_COMPILE_AND_EXECUTE, "GL_COMPILE_AND_EXECUTE",
+			GL_COMPILE_AND_EXECUTE,
 			set_scalar, "scalar",
 			11
 		},
 		{
-			GL_COMPILE_AND_EXECUTE, "GL_COMPILE_AND_EXECUTE",
+			GL_COMPILE_AND_EXECUTE,
 			set_vector, "vector",
 			13
 		}
@@ -662,7 +661,7 @@ process_shader(const char *func, const char *source, bool matrix)
 			continue;
 
 		printf("    %s: %s mode\n",
-		       tests[i].list_mode_name,
+		       piglit_get_gl_enum_name(tests[i].list_mode),
 		       tests[i].setter_mode_name);
 
 		printf("        pre-initialize\n");
diff --git a/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c b/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c
index c21a37c80..338b6c092 100644
--- a/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c
+++ b/tests/spec/arb_shader_storage_buffer_object/program-interface-query.c
@@ -104,17 +104,6 @@ piglit_init(int argc, char **argv)
 					  GL_IS_ROW_MAJOR,
 					  GL_REFERENCED_BY_VERTEX_SHADER,
 					  GL_REFERENCED_BY_FRAGMENT_SHADER };
-	const char *prop_names[NUM_QUERIES] = {"GL_TOP_LEVEL_ARRAY_SIZE",
-					       "GL_TOP_LEVEL_ARRAY_STRIDE",
-					       "GL_TYPE",
-					       "GL_ARRAY_SIZE",
-					       "GL_BLOCK_INDEX",
-					       "GL_OFFSET",
-					       "GL_ARRAY_STRIDE",
-					       "GL_MATRIX_STRIDE",
-					       "GL_IS_ROW_MAJOR",
-					       "GL_REFERENCED_BY_VERTEX_SHADER",
-					       "GL_REFERENCED_BY_FRAGMENT_SHADER" };
 	int query_std140[NUM_QUERIES] = {0};
 	int query_std430[NUM_QUERIES] = {0};
 	int num_vertex_ssbo;
@@ -161,17 +150,18 @@ piglit_init(int argc, char **argv)
 	   pass = false;
 
 	for (i = 0 ; i < NUM_QUERIES; i++) {
+		const char *prop_name = piglit_get_gl_enum_name(prop[i]);
 		if (has_vertex_ssbo) {
 			if (query_std140[i] != expected_std140[i]) {
 				printf("std140 %s expected = %d. Value = %d.\n",
-				       prop_names[i], expected_std140[i],
+				       prop_name, expected_std140[i],
 				       query_std140[i]);
 				pass = false;
 			}
 		}
 		if (query_std430[i] != expected_std430[i]) {
 			printf("std430 %s expected = %d. Value = %d.\n",
-			       prop_names[i], expected_std430[i],
+			       prop_name, expected_std430[i],
 			       query_std430[i]);
 			pass = false;
 		}
diff --git a/tests/spec/arb_texture_float/texture-float-formats.c b/tests/spec/arb_texture_float/texture-float-formats.c
index 88b3d3486..0766f77bf 100644
--- a/tests/spec/arb_texture_float/texture-float-formats.c
+++ b/tests/spec/arb_texture_float/texture-float-formats.c
@@ -45,32 +45,31 @@ static GLboolean HaveRG;
 
 struct format_info
 {
-   const char *Name;
    GLenum IntFormat, BaseFormat;
    GLuint BitsPerChannel;
 };
 
 
 static const struct format_info Formats[] = {
-   { "GL_RGBA32F_ARB", GL_RGBA32F_ARB, GL_RGBA, 32 },
-   { "GL_RGB32F_ARB", GL_RGB32F_ARB, GL_RGB, 32 },
-   { "GL_ALPHA32F_ARB", GL_ALPHA32F_ARB, GL_ALPHA, 32 },
-   { "GL_INTENSITY32F_ARB", GL_INTENSITY32F_ARB, GL_INTENSITY, 32 },
-   { "GL_LUMINANCE32F_ARB", GL_LUMINANCE32F_ARB, GL_LUMINANCE, 32 },
-   { "GL_LUMINANCE_ALPHA32F_ARB", GL_LUMINANCE_ALPHA32F_ARB, GL_LUMINANCE, 32 },
+   { GL_RGBA32F_ARB, GL_RGBA, 32 },
+   { GL_RGB32F_ARB, GL_RGB, 32 },
+   { GL_ALPHA32F_ARB, GL_ALPHA, 32 },
+   { GL_INTENSITY32F_ARB, GL_INTENSITY, 32 },
+   { GL_LUMINANCE32F_ARB, GL_LUMINANCE, 32 },
+   { GL_LUMINANCE_ALPHA32F_ARB, GL_LUMINANCE, 32 },
 
-   { "GL_RGBA16F_ARB", GL_RGBA16F_ARB, GL_RGBA, 16 },
-   { "GL_RGB16F_ARB", GL_RGB16F_ARB, GL_RGB, 16 },
-   { "GL_ALPHA16F_ARB", GL_ALPHA16F_ARB, GL_ALPHA, 16 },
-   { "GL_INTENSITY16F_ARB", GL_INTENSITY16F_ARB, GL_INTENSITY, 16 },
-   { "GL_LUMINANCE16F_ARB", GL_LUMINANCE16F_ARB, GL_LUMINANCE, 16 },
-   { "GL_LUMINANCE_ALPHA16F_ARB", GL_LUMINANCE_ALPHA16F_ARB, GL_LUMINANCE, 16 },
+   { GL_RGBA16F_ARB, GL_RGBA, 16 },
+   { GL_RGB16F_ARB, GL_RGB, 16 },
+   { GL_ALPHA16F_ARB, GL_ALPHA, 16 },
+   { GL_INTENSITY16F_ARB, GL_INTENSITY, 16 },
+   { GL_LUMINANCE16F_ARB, GL_LUMINANCE, 16 },
+   { GL_LUMINANCE_ALPHA16F_ARB, GL_LUMINANCE, 16 },
 
    /* These require GL_ARB_texture_rg */
-   { "GL_R32F", GL_R32F, GL_RED, 32 },
-   { "GL_RG32F", GL_RG32F, GL_RG, 32 },
-   { "GL_R16F", GL_R16F, GL_RED, 16 },
-   { "GL_RG16F", GL_RG16F, GL_RG, 16 },
+   { GL_R32F, GL_RED, 32 },
+   { GL_RG32F, GL_RG, 32 },
+   { GL_R16F, GL_RED, 16 },
+   { GL_RG16F, GL_RG, 16 },
 };
 
 
@@ -193,6 +192,7 @@ test_format(const struct format_info *info)
    GLint f;
    GLenum userFormat;
    int p;
+   const char *name = piglit_get_gl_enum_name(info->IntFormat);
 
    if ((info->BaseFormat == GL_RED ||
         info->BaseFormat == GL_RG) && !HaveRG) {
@@ -200,7 +200,7 @@ test_format(const struct format_info *info)
       return GL_TRUE;
    }
 
-   /*printf("Testing %s\n", info->Name);*/
+   /*printf("Testing %s\n", name);*/
 
    get_texture_color(value);
 
@@ -238,15 +238,6 @@ test_format(const struct format_info *info)
          GL_TEXTURE_INTENSITY_TYPE_ARB,
          GL_TEXTURE_DEPTH_TYPE_ARB
       };
-      static const char *queryNames[] = {
-         "GL_TEXTURE_RED_TYPE_ARB",
-         "GL_TEXTURE_GREEN_TYPE_ARB",
-         "GL_TEXTURE_BLUE_TYPE_ARB",
-         "GL_TEXTURE_ALPHA_TYPE_ARB",
-         "GL_TEXTURE_LUMINANCE_TYPE_ARB",
-         "GL_TEXTURE_INTENSITY_TYPE_ARB",
-         "GL_TEXTURE_DEPTH_TYPE_ARB"
-      };
       int i;
       for (i = 0; i < ARRAY_SIZE(queries); i++) {
          GLint type = 1;
@@ -255,7 +246,7 @@ test_format(const struct format_info *info)
             return GL_FALSE;
          if (type != GL_NONE && type != GL_FLOAT) {
             printf("%s: %s query failed (returned 0x%x)\n",
-                   TestName, queryNames[i], type);
+                   TestName, piglit_get_gl_enum_name(queries[i]), type);
             return GL_FALSE;
          }
       }
@@ -330,7 +321,7 @@ test_format(const struct format_info *info)
    if (!p) {
       int i;
 
-      printf("  Failed with format %s:\n", info->Name);
+      printf("  Failed with format %s:\n", name);
       printf("  Texture color = ");
       for (i = 0; i < comps; i++) {
          printf("%f", value[i]);
diff --git a/tests/spec/arb_texture_multisample/texstate.c b/tests/spec/arb_texture_multisample/texstate.c
index a0cca33cf..e0407a3b3 100644
--- a/tests/spec/arb_texture_multisample/texstate.c
+++ b/tests/spec/arb_texture_multisample/texstate.c
@@ -38,8 +38,9 @@ piglit_display(void)
 
 static bool
 check_texlevelparameter_int(GLuint target, GLuint level,
-        char const *name, GLuint pname, GLint expected_value)
+        GLuint pname, GLint expected_value)
 {
+    const char *name = piglit_get_gl_enum_name(pname);
     GLint actual_value;
     glGetTexLevelParameteriv(target, level, pname, &actual_value);
     if (!piglit_check_gl_error(GL_NO_ERROR))
@@ -69,9 +70,9 @@ piglit_init(int argc, char **argv)
     glBindTexture(GL_TEXTURE_2D, tex2d);
     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
 
-    pass = check_texlevelparameter_int(GL_TEXTURE_2D, 0, "GL_TEXTURE_SAMPLES",
+    pass = check_texlevelparameter_int(GL_TEXTURE_2D, 0,
             GL_TEXTURE_SAMPLES, 0) && pass;
-    pass = check_texlevelparameter_int(GL_TEXTURE_2D, 0, "GL_TEXTURE_FIXED_SAMPLE_LOCATIONS",
+    pass = check_texlevelparameter_int(GL_TEXTURE_2D, 0,
             GL_TEXTURE_FIXED_SAMPLE_LOCATIONS, GL_TRUE) && pass;
 
     piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
diff --git a/tests/spec/arb_texture_storage/texture-storage.c b/tests/spec/arb_texture_storage/texture-storage.c
index 118d4dbac..e8fed28be 100644
--- a/tests/spec/arb_texture_storage/texture-storage.c
+++ b/tests/spec/arb_texture_storage/texture-storage.c
@@ -160,7 +160,7 @@ static bool
 test_mipmap_errors(GLenum target)
 {
 	GLint width = 128, height = 64, depth = 4, levels = 8;
-	const char *targetString = "";
+	const char *targetString = piglit_get_gl_enum_name(target);
 	GLuint tex;
 	GLint v, l;
 
@@ -173,15 +173,12 @@ test_mipmap_errors(GLenum target)
 
 	if (target == GL_TEXTURE_1D) {
 		glTexStorage1D(target, levels, GL_RGBA8, width);
-		targetString = "GL_TEXTURE_1D";
 	}
 	else if (target == GL_TEXTURE_2D) {
 		glTexStorage2D(target, levels, GL_RGBA8, width, height);
-		targetString = "GL_TEXTURE_2D";
 	}
 	else if (target == GL_TEXTURE_3D) {
 		glTexStorage3D(target, levels, GL_RGBA8, width, height, depth);
-		targetString = "GL_TEXTURE_3D";
 	}
 
 	piglit_check_gl_error(GL_NO_ERROR);
diff --git a/tests/spec/ext_texture_integer/fbo-integer-precision-clear.c b/tests/spec/ext_texture_integer/fbo-integer-precision-clear.c
index 470a55cba..0c555496c 100644
--- a/tests/spec/ext_texture_integer/fbo-integer-precision-clear.c
+++ b/tests/spec/ext_texture_integer/fbo-integer-precision-clear.c
@@ -49,7 +49,6 @@ static GLint TexWidth = 256, TexHeight = 256;
 
 struct format_info
 {
-	const char *Name;
 	GLenum IntFormat, BaseFormat;
 	GLuint BitsPerChannel;
 	GLboolean Signed;
@@ -57,11 +56,11 @@ struct format_info
 
 /* Only test 32-bit formats - since you won't see precision problems on lower sizes */
 static const struct format_info Formats[] = {
-	{ "GL_RGBA32I_EXT",  GL_RGBA32I_EXT,  GL_RGBA_INTEGER_EXT, 32, GL_TRUE  },
-	{ "GL_RGBA32UI_EXT", GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, 32, GL_FALSE },
+	{ GL_RGBA32I_EXT,  GL_RGBA_INTEGER_EXT, 32, GL_TRUE  },
+	{ GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, 32, GL_FALSE },
 
-	{ "GL_RGB32I_EXT",  GL_RGB32I_EXT,  GL_RGB_INTEGER_EXT, 32, GL_TRUE  },
-	{ "GL_RGB32UI_EXT", GL_RGB32UI_EXT, GL_RGB_INTEGER_EXT, 32, GL_FALSE },
+	{ GL_RGB32I_EXT,  GL_RGB_INTEGER_EXT, 32, GL_TRUE  },
+	{ GL_RGB32UI_EXT, GL_RGB_INTEGER_EXT, 32, GL_FALSE },
 };
 
 #define NUM_FORMATS  (sizeof(Formats) / sizeof(Formats[0]))
@@ -125,6 +124,7 @@ test_fbo(const struct format_info *info)
 {
 	const int comps = num_components(info->BaseFormat);
 	const GLenum type = get_datatype(info);
+	const char *name = piglit_get_gl_enum_name(info->IntFormat);
 	GLint f;
 	GLuint fbo, texObj;
 	GLenum status;
@@ -141,7 +141,7 @@ test_fbo(const struct format_info *info)
 
 	if (0)
 		fprintf(stderr, "============ Testing format = %s ========\n",
-			info->Name);
+			name);
 
 	/* Create texture */
 	glGenTextures(1, &texObj);
@@ -171,7 +171,7 @@ test_fbo(const struct format_info *info)
 
 	status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
-		printf("%s: framebuffer incomplete.\n", info->Name);
+		printf("%s: framebuffer incomplete.\n", name);
 		return PIGLIT_SKIP;
 	}
 
@@ -201,7 +201,7 @@ test_fbo(const struct format_info *info)
 			fprintf(stderr, "%s: glClear failed\n",
 				TestName);
 			fprintf(stderr, "  Texture format = %s\n",
-				info->Name);
+				name);
 			fprintf(stderr, "  Expected %d, %d, %d, %d\n",
 				clr[0], clr[1], clr[2], clr[3]);
 			fprintf(stderr, "  Found %d, %d, %d, %d\n",
diff --git a/tests/spec/ext_texture_integer/fbo-integer-readpixels-sint-uint.c b/tests/spec/ext_texture_integer/fbo-integer-readpixels-sint-uint.c
index e66dccddf..18bbea728 100644
--- a/tests/spec/ext_texture_integer/fbo-integer-readpixels-sint-uint.c
+++ b/tests/spec/ext_texture_integer/fbo-integer-readpixels-sint-uint.c
@@ -49,7 +49,6 @@ static GLint TexWidth = 256, TexHeight = 256;
 
 struct format_info
 {
-   const char *Name;
    GLenum IntFormat, BaseFormat;
    GLuint BitsPerChannel;
    GLboolean Signed;
@@ -57,8 +56,8 @@ struct format_info
 
 /* Only test 32-bit formats - since you won't see precision problems on lower sizes */
 static const struct format_info Formats[] = {
-   { "GL_RGBA32I_EXT",  GL_RGBA32I_EXT,  GL_RGBA_INTEGER_EXT, 32, GL_TRUE },
-   { "GL_RGBA32UI_EXT", GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, 32, GL_FALSE },
+   { GL_RGBA32I_EXT,  GL_RGBA_INTEGER_EXT, 32, GL_TRUE },
+   { GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, 32, GL_FALSE },
 };
 
 #define NUM_FORMATS  (sizeof(Formats) / sizeof(Formats[0]))
@@ -154,6 +153,7 @@ test_fbo(const struct format_info *info)
 {
    const int comps = num_components(info->BaseFormat);
    const GLenum type = get_datatype(info);
+   const char *name = piglit_get_gl_enum_name(info->IntFormat);
    GLint f;
    GLuint fbo, texObj;
    GLenum status;
@@ -162,7 +162,7 @@ test_fbo(const struct format_info *info)
    bool pass = true;
 
    if (0)
-      fprintf(stderr, "============ Testing format = %s ========\n", info->Name);
+      fprintf(stderr, "============ Testing format = %s ========\n", name);
 
    /* Create texture */
    glGenTextures(1, &texObj);
@@ -237,7 +237,7 @@ test_fbo(const struct format_info *info)
           for (i = 0; i < comps; i++) {
                if (pix_ui[i] != exp_ui[i]) {
                    fprintf(stderr, "%s: glClear failed\n", TestName);
-                   fprintf(stderr, "  Texture format = %s\n", info->Name);
+                   fprintf(stderr, "  Texture format = %s\n", name);
                    fprintf(stderr, "  Expected %u, %u, %u, %u\n",
                         exp_ui[0], exp_ui[1], exp_ui[2], exp_ui[3]);
                    fprintf(stderr, "  Found %u, %u, %u, %u\n",
@@ -250,7 +250,7 @@ test_fbo(const struct format_info *info)
           for (i = 0; i < comps; i++) {
                if (pix[i] != exp_i[i]) {
                    fprintf(stderr, "%s: glClear failed\n", TestName);
-                   fprintf(stderr, "  Texture format = %s\n", info->Name);
+                   fprintf(stderr, "  Texture format = %s\n", name);
                    fprintf(stderr, "  Expected %d, %d, %d, %d\n",
                         exp_i[0], exp_i[1], exp_i[2], exp_i[3]);
                    fprintf(stderr, "  Found %d, %d, %d, %d\n",
diff --git a/tests/spec/gl-1.0/rendermode-feedback.c b/tests/spec/gl-1.0/rendermode-feedback.c
index 884ab3d8f..880f04167 100644
--- a/tests/spec/gl-1.0/rendermode-feedback.c
+++ b/tests/spec/gl-1.0/rendermode-feedback.c
@@ -87,24 +87,20 @@ static const float gl_4d_color_texture_values[] =
 
 struct type {
 	GLenum type;
-	char *name;
 	const float *values;
 	int count;
 } types[] = {
-	{ GL_2D, "GL_2D",
-	  gl_2d_values, ARRAY_SIZE(gl_2d_values) },
+	{ GL_2D, gl_2d_values, ARRAY_SIZE(gl_2d_values) },
 
-	{ GL_3D, "GL_3D",
-	  gl_3d_values, ARRAY_SIZE(gl_3d_values) },
+	{ GL_3D, gl_3d_values, ARRAY_SIZE(gl_3d_values) },
 
-	{ GL_3D_COLOR, "GL_3D_COLOR",
-	  gl_3d_color_values, ARRAY_SIZE(gl_3d_color_values) },
+	{ GL_3D_COLOR, gl_3d_color_values, ARRAY_SIZE(gl_3d_color_values) },
 
-	{ GL_3D_COLOR_TEXTURE, "GL_3D_COLOR_TEXTURE",
-	  gl_3d_color_texture_values, ARRAY_SIZE(gl_3d_color_texture_values) },
+	{ GL_3D_COLOR_TEXTURE, gl_3d_color_texture_values,
+	  ARRAY_SIZE(gl_3d_color_texture_values) },
 
-	{ GL_4D_COLOR_TEXTURE, "GL_4D_COLOR_TEXTURE",
-	  gl_4d_color_texture_values, ARRAY_SIZE(gl_4d_color_texture_values) },
+	{ GL_4D_COLOR_TEXTURE, gl_4d_color_texture_values,
+	  ARRAY_SIZE(gl_4d_color_texture_values) },
 };
 
 static void
@@ -112,7 +108,8 @@ report_failure(struct type *type, float *buffer, int count)
 {
 	int i;
 
-	fprintf(stderr, "Feeback failed for %s:\n", type->name);
+	fprintf(stderr, "Feeback failed for %s:\n",
+		piglit_get_gl_enum_name(type->type));
 
 	fprintf(stderr, "  Expected:    Observed: (%d/%d)\n",
 		count, type->count);
@@ -148,8 +145,9 @@ piglit_display(void)
 	for (i = 0; i < ARRAY_SIZE(types); i++) {
 		bool case_pass = true;
 		int returned_count;
+		const char *name = piglit_get_gl_enum_name(types[i].type);
 
-		printf("Testing %s\n", types[i].name);
+		printf("Testing %s\n", name);
 
 		for (j = 0; j < ARRAY_SIZE(buffer); j++)
 			buffer[j] = -1.0;
@@ -172,10 +170,10 @@ piglit_display(void)
 			pass = false;
 			report_failure(&types[i], buffer, returned_count);
 			piglit_report_subtest_result(PIGLIT_FAIL,
-						     "%s", types[i].name);
+						     "%s", name);
 		} else {
 			piglit_report_subtest_result(PIGLIT_PASS,
-						     "%s", types[i].name);
+						     "%s", name);
 		}
 	}
 
diff --git a/tests/spec/gl-3.0/texture-integer.c b/tests/spec/gl-3.0/texture-integer.c
index 8caa00043..4051e4e3a 100644
--- a/tests/spec/gl-3.0/texture-integer.c
+++ b/tests/spec/gl-3.0/texture-integer.c
@@ -43,7 +43,6 @@ static GLint BiasUniform = -1, TexUniform = -1;
 
 struct format_info
 {
-	const char *Name;
 	GLenum IntFormat, BaseFormat;
 	GLuint BitsPerChannel;
 	GLboolean Signed;
@@ -52,47 +51,47 @@ struct format_info
 
 static const struct format_info Formats[] = {
 	/* { "GL_RGBA", GL_RGBA, GL_RGBA, 8, GL_FALSE },*/
-	{ "GL_RGBA8I_EXT",   GL_RGBA8I_EXT,   GL_RGBA_INTEGER_EXT, 8,  GL_TRUE  },
-	{ "GL_RGBA8UI_EXT",  GL_RGBA8UI_EXT,  GL_RGBA_INTEGER_EXT, 8,  GL_FALSE },
-	{ "GL_RGBA16I_EXT",  GL_RGBA16I_EXT,  GL_RGBA_INTEGER_EXT, 16, GL_TRUE  },
-	{ "GL_RGBA16UI_EXT", GL_RGBA16UI_EXT, GL_RGBA_INTEGER_EXT, 16, GL_FALSE },
-	{ "GL_RGBA32I_EXT",  GL_RGBA32I_EXT,  GL_RGBA_INTEGER_EXT, 32, GL_TRUE  },
-	{ "GL_RGBA32UI_EXT", GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, 32, GL_FALSE },
+	{ GL_RGBA8I_EXT,   GL_RGBA_INTEGER_EXT, 8,  GL_TRUE  },
+	{ GL_RGBA8UI_EXT,  GL_RGBA_INTEGER_EXT, 8,  GL_FALSE },
+	{ GL_RGBA16I_EXT,  GL_RGBA_INTEGER_EXT, 16, GL_TRUE  },
+	{ GL_RGBA16UI_EXT, GL_RGBA_INTEGER_EXT, 16, GL_FALSE },
+	{ GL_RGBA32I_EXT,  GL_RGBA_INTEGER_EXT, 32, GL_TRUE  },
+	{ GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, 32, GL_FALSE },
 
-	{ "GL_RGB8I_EXT",   GL_RGB8I_EXT,   GL_RGB_INTEGER_EXT, 8,  GL_TRUE  },
-	{ "GL_RGB8UI_EXT",  GL_RGB8UI_EXT,  GL_RGB_INTEGER_EXT, 8,  GL_FALSE },
-	{ "GL_RGB16I_EXT",  GL_RGB16I_EXT,  GL_RGB_INTEGER_EXT, 16, GL_TRUE  },
-	{ "GL_RGB16UI_EXT", GL_RGB16UI_EXT, GL_RGB_INTEGER_EXT, 16, GL_FALSE },
-	{ "GL_RGB32I_EXT",  GL_RGB32I_EXT,  GL_RGB_INTEGER_EXT, 32, GL_TRUE  },
-	{ "GL_RGB32UI_EXT", GL_RGB32UI_EXT, GL_RGB_INTEGER_EXT, 32, GL_FALSE },
+	{ GL_RGB8I_EXT,   GL_RGB_INTEGER_EXT, 8,  GL_TRUE  },
+	{ GL_RGB8UI_EXT,  GL_RGB_INTEGER_EXT, 8,  GL_FALSE },
+	{ GL_RGB16I_EXT,  GL_RGB_INTEGER_EXT, 16, GL_TRUE  },
+	{ GL_RGB16UI_EXT, GL_RGB_INTEGER_EXT, 16, GL_FALSE },
+	{ GL_RGB32I_EXT,  GL_RGB_INTEGER_EXT, 32, GL_TRUE  },
+	{ GL_RGB32UI_EXT, GL_RGB_INTEGER_EXT, 32, GL_FALSE },
 
-	{ "GL_ALPHA8I_EXT",   GL_ALPHA8I_EXT,   GL_ALPHA_INTEGER_EXT, 8,  GL_TRUE  },
-	{ "GL_ALPHA8UI_EXT",  GL_ALPHA8UI_EXT,  GL_ALPHA_INTEGER_EXT, 8,  GL_FALSE },
-	{ "GL_ALPHA16I_EXT",  GL_ALPHA16I_EXT,  GL_ALPHA_INTEGER_EXT, 16, GL_TRUE  },
-	{ "GL_ALPHA16UI_EXT", GL_ALPHA16UI_EXT, GL_ALPHA_INTEGER_EXT, 16, GL_FALSE },
-	{ "GL_ALPHA32I_EXT",  GL_ALPHA32I_EXT,  GL_ALPHA_INTEGER_EXT, 32, GL_TRUE  },
-	{ "GL_ALPHA32UI_EXT", GL_ALPHA32UI_EXT, GL_ALPHA_INTEGER_EXT, 32, GL_FALSE },
+	{ GL_ALPHA8I_EXT,   GL_ALPHA_INTEGER_EXT, 8,  GL_TRUE  },
+	{ GL_ALPHA8UI_EXT,  GL_ALPHA_INTEGER_EXT, 8,  GL_FALSE },
+	{ GL_ALPHA16I_EXT,  GL_ALPHA_INTEGER_EXT, 16, GL_TRUE  },
+	{ GL_ALPHA16UI_EXT, GL_ALPHA_INTEGER_EXT, 16, GL_FALSE },
+	{ GL_ALPHA32I_EXT,  GL_ALPHA_INTEGER_EXT, 32, GL_TRUE  },
+	{ GL_ALPHA32UI_EXT, GL_ALPHA_INTEGER_EXT, 32, GL_FALSE },
 
-	{ "GL_LUMINANCE8I_EXT",   GL_LUMINANCE8I_EXT,   GL_LUMINANCE_INTEGER_EXT, 8,  GL_TRUE  },
-	{ "GL_LUMINANCE8UI_EXT",  GL_LUMINANCE8UI_EXT,  GL_LUMINANCE_INTEGER_EXT, 8,  GL_FALSE },
-	{ "GL_LUMINANCE16I_EXT",  GL_LUMINANCE16I_EXT,  GL_LUMINANCE_INTEGER_EXT, 16, GL_TRUE  },
-	{ "GL_LUMINANCE16UI_EXT", GL_LUMINANCE16UI_EXT, GL_LUMINANCE_INTEGER_EXT, 16, GL_FALSE },
-	{ "GL_LUMINANCE32I_EXT",  GL_LUMINANCE32I_EXT,  GL_LUMINANCE_INTEGER_EXT, 32, GL_TRUE  },
-	{ "GL_LUMINANCE32UI_EXT", GL_LUMINANCE32UI_EXT, GL_LUMINANCE_INTEGER_EXT, 32, GL_FALSE },
+	{ GL_LUMINANCE8I_EXT,   GL_LUMINANCE_INTEGER_EXT, 8,  GL_TRUE  },
+	{ GL_LUMINANCE8UI_EXT,  GL_LUMINANCE_INTEGER_EXT, 8,  GL_FALSE },
+	{ GL_LUMINANCE16I_EXT,  GL_LUMINANCE_INTEGER_EXT, 16, GL_TRUE  },
+	{ GL_LUMINANCE16UI_EXT, GL_LUMINANCE_INTEGER_EXT, 16, GL_FALSE },
+	{ GL_LUMINANCE32I_EXT,  GL_LUMINANCE_INTEGER_EXT, 32, GL_TRUE  },
+	{ GL_LUMINANCE32UI_EXT, GL_LUMINANCE_INTEGER_EXT, 32, GL_FALSE },
 
-	{ "GL_LUMINANCE_ALPHA8I_EXT",   GL_LUMINANCE_ALPHA8I_EXT,   GL_LUMINANCE_ALPHA_INTEGER_EXT, 8,  GL_TRUE  },
-	{ "GL_LUMINANCE_ALPHA8UI_EXT",  GL_LUMINANCE_ALPHA8UI_EXT,  GL_LUMINANCE_ALPHA_INTEGER_EXT, 8,  GL_FALSE },
-	{ "GL_LUMINANCE_ALPHA16I_EXT",  GL_LUMINANCE_ALPHA16I_EXT,  GL_LUMINANCE_ALPHA_INTEGER_EXT, 16, GL_TRUE  },
-	{ "GL_LUMINANCE_ALPHA16UI_EXT", GL_LUMINANCE_ALPHA16UI_EXT, GL_LUMINANCE_ALPHA_INTEGER_EXT, 16, GL_FALSE },
-	{ "GL_LUMINANCE_ALPHA32I_EXT",  GL_LUMINANCE_ALPHA32I_EXT,  GL_LUMINANCE_ALPHA_INTEGER_EXT, 32, GL_TRUE  },
-	{ "GL_LUMINANCE_ALPHA32UI_EXT", GL_LUMINANCE_ALPHA32UI_EXT, GL_LUMINANCE_ALPHA_INTEGER_EXT, 32, GL_FALSE },
+	{ GL_LUMINANCE_ALPHA8I_EXT,   GL_LUMINANCE_ALPHA_INTEGER_EXT, 8,  GL_TRUE  },
+	{ GL_LUMINANCE_ALPHA8UI_EXT,  GL_LUMINANCE_ALPHA_INTEGER_EXT, 8,  GL_FALSE },
+	{ GL_LUMINANCE_ALPHA16I_EXT,  GL_LUMINANCE_ALPHA_INTEGER_EXT, 16, GL_TRUE  },
+	{ GL_LUMINANCE_ALPHA16UI_EXT, GL_LUMINANCE_ALPHA_INTEGER_EXT, 16, GL_FALSE },
+	{ GL_LUMINANCE_ALPHA32I_EXT,  GL_LUMINANCE_ALPHA_INTEGER_EXT, 32, GL_TRUE  },
+	{ GL_LUMINANCE_ALPHA32UI_EXT, GL_LUMINANCE_ALPHA_INTEGER_EXT, 32, GL_FALSE },
 
-	{ "GL_INTENSITY8I_EXT",   GL_INTENSITY8I_EXT,   GL_RED_INTEGER_EXT, 8,  GL_TRUE  },
-	{ "GL_INTENSITY8UI_EXT",  GL_INTENSITY8UI_EXT,  GL_RED_INTEGER_EXT, 8,  GL_FALSE },
-	{ "GL_INTENSITY16I_EXT",  GL_INTENSITY16I_EXT,  GL_RED_INTEGER_EXT, 16, GL_TRUE  },
-	{ "GL_INTENSITY16UI_EXT", GL_INTENSITY16UI_EXT, GL_RED_INTEGER_EXT, 16, GL_FALSE },
-	{ "GL_INTENSITY32I_EXT",  GL_INTENSITY32I_EXT,  GL_RED_INTEGER_EXT, 32, GL_TRUE  },
-	{ "GL_INTENSITY32UI_EXT", GL_INTENSITY32UI_EXT, GL_RED_INTEGER_EXT, 32, GL_FALSE },
+	{ GL_INTENSITY8I_EXT,   GL_RED_INTEGER_EXT, 8,  GL_TRUE  },
+	{ GL_INTENSITY8UI_EXT,  GL_RED_INTEGER_EXT, 8,  GL_FALSE },
+	{ GL_INTENSITY16I_EXT,  GL_RED_INTEGER_EXT, 16, GL_TRUE  },
+	{ GL_INTENSITY16UI_EXT, GL_RED_INTEGER_EXT, 16, GL_FALSE },
+	{ GL_INTENSITY32I_EXT,  GL_RED_INTEGER_EXT, 32, GL_TRUE  },
+	{ GL_INTENSITY32UI_EXT, GL_RED_INTEGER_EXT, 32, GL_FALSE },
 };
 
 
@@ -339,7 +338,8 @@ test_format(const struct format_info *info)
 		 fabsf(result[1] - expected[1]) > error ||
 		 fabsf(result[2] - expected[2]) > error ||
 		 fabsf(result[3] - expected[3]) > error) {
-		fprintf(stderr, "%s: failure with format %s:\n", TestName, info->Name);
+		fprintf(stderr, "%s: failure with format %s:\n", TestName,
+			piglit_get_gl_enum_name(info->IntFormat));
 		fprintf(stderr, "  texture color = %d, %d, %d, %d\n",
 				  value[0], value[1], value[2], value[3]);
 		fprintf(stderr, "  expected color = %g, %g, %g, %g\n",
diff --git a/tests/spec/gles-2.0/invalid-es3-queries.c b/tests/spec/gles-2.0/invalid-es3-queries.c
index f8dc85a85..894051820 100644
--- a/tests/spec/gles-2.0/invalid-es3-queries.c
+++ b/tests/spec/gles-2.0/invalid-es3-queries.c
@@ -34,19 +34,15 @@ piglit_display(void)
 	return PIGLIT_FAIL;
 }
 
-struct enums {
-	const char *name;
-	GLenum val;
-};
-
-static bool try(const struct enums *list, unsigned len) {
+static bool try(const GLenum *list, unsigned len) {
 	GLint param;
 	int i;
 	for (i = 0; i < len; i++) {
-		glGetIntegerv(list[i].val, &param);
+		glGetIntegerv(list[i], &param);
 
 		if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
-			fprintf(stderr, "\t%s\n", list[i].name);
+			fprintf(stderr, "\t%s\n",
+				piglit_get_gl_enum_name(list[i]));
 			return false;
 		}
 	}
@@ -61,55 +57,55 @@ piglit_init(int argc, char **argv)
 	/* ES 3 adds many new queries over ES 2. This test confirms that ES 2
 	 * correctly rejects them with an INVALID_ENUM error.
 	 */
-	static const struct enums
+	static const GLenum
 	GL_ARB_ES3_compatibility_enums[] = {
-		{ "GL_MAX_ELEMENT_INDEX", 0x8D6B },
+		/*GL_MAX_ELEMENT_INDEX*/ 0x8D6B,
 	},
 	GL_ARB_fragment_shader_enums[] = {
-		{ "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS", 0x8B49 },
+		/*GL_MAX_FRAGMENT_UNIFORM_COMPONENTS*/ 0x8B49,
 	},
 	GL_ARB_framebuffer_object_enums[] = {
-		{ "GL_MAX_SAMPLES", 0x8D57 },
+		/*GL_MAX_SAMPLES*/ 0x8D57,
 	},
 	GL_ARB_sync_enums[] = {
-		{ "GL_MAX_SERVER_WAIT_TIMEOUT", 0x9111 },
+		/*GL_MAX_SERVER_WAIT_TIMEOUT*/ 0x9111,
 	},
 	GL_ARB_transform_feedback2_enums[] = {
-		{ "GL_TRANSFORM_FEEDBACK_PAUSED", 0x8E23 },
-		{ "GL_TRANSFORM_FEEDBACK_ACTIVE", 0x8E24 },
-		{ "GL_TRANSFORM_FEEDBACK_BINDING", 0x8E25 },
+		/*GL_TRANSFORM_FEEDBACK_PAUSED*/ 0x8E23,
+		/*GL_TRANSFORM_FEEDBACK_ACTIVE*/ 0x8E24,
+		/*GL_TRANSFORM_FEEDBACK_BINDING*/ 0x8E25,
 	},
 	GL_ARB_uniform_buffer_object_enums[] = {
-		{ "GL_MAX_VERTEX_UNIFORM_BLOCKS", 0x8A2B },
-		{ "GL_MAX_FRAGMENT_UNIFORM_BLOCKS", 0x8A2D },
-		{ "GL_MAX_COMBINED_UNIFORM_BLOCKS", 0x8A2E },
-		{ "GL_MAX_UNIFORM_BLOCK_SIZE", 0x8A30 },
-		{ "GL_MAX_UNIFORM_BUFFER_BINDINGS", 0x8A2F },
-		{ "GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", 0x8A31 },
-		{ "GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", 0x8A33 },
-		{ "GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT", 0x8A34 },
-		{ "GL_UNIFORM_BUFFER_BINDING", 0x8A28 },
+		/*GL_MAX_VERTEX_UNIFORM_BLOCKS*/ 0x8A2B,
+		/*GL_MAX_FRAGMENT_UNIFORM_BLOCKS*/ 0x8A2D,
+		/*GL_MAX_COMBINED_UNIFORM_BLOCKS*/ 0x8A2E,
+		/*GL_MAX_UNIFORM_BLOCK_SIZE*/ 0x8A30,
+		/*GL_MAX_UNIFORM_BUFFER_BINDINGS*/ 0x8A2F,
+		/*GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS*/ 0x8A31,
+		/*GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS*/ 0x8A33,
+		/*GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT*/ 0x8A34,
+		/*GL_UNIFORM_BUFFER_BINDING*/ 0x8A28,
 	},
 	GL_ARB_vertex_shader_enums[] = {
-		{ "GL_MAX_VERTEX_UNIFORM_COMPONENTS", 0x8B4A },
-		{ "GL_MAX_VARYING_COMPONENTS", 0x8B4B },
+		/*GL_MAX_VERTEX_UNIFORM_COMPONENTS*/ 0x8B4A,
+		/*GL_MAX_VARYING_COMPONENTS*/ 0x8B4B,
 	},
 	GL_EXT_framebuffer_blit_enums[] = {
-		{ "GL_READ_FRAMEBUFFER_BINDING", 0x8CAA },
+		/*GL_READ_FRAMEBUFFER_BINDING*/ 0x8CAA,
 	},
 	GL_EXT_pixel_buffer_object_enums[] = {
-		{ "GL_PIXEL_PACK_BUFFER_BINDING", 0x88ED },
-		{ "GL_PIXEL_UNPACK_BUFFER_BINDING", 0x88EF },
+		/*GL_PIXEL_PACK_BUFFER_BINDING*/ 0x88ED,
+		/*GL_PIXEL_UNPACK_BUFFER_BINDING*/ 0x88EF,
 	},
 	GL_EXT_texture_lod_bias_enums[] = {
-		{ "GL_MAX_TEXTURE_LOD_BIAS", 0x84FD },
+		/*GL_MAX_TEXTURE_LOD_BIAS*/ 0x84FD,
 	},
 	GL_EXT_transform_feedback_enums[] = {
-		{ "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING", 0x8C8F },
-		{ "GL_RASTERIZER_DISCARD", 0x8C89 },
-		{ "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", 0x8C8A },
-		{ "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", 0x8C8B },
-		{ "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", 0x8C80 },
+		/*GL_TRANSFORM_FEEDBACK_BUFFER_BINDING*/ 0x8C8F,
+		/*GL_RASTERIZER_DISCARD*/ 0x8C89,
+		/*GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS*/ 0x8C8A,
+		/*GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS*/ 0x8C8B,
+		/*GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS*/ 0x8C80,
 	};
 
 	if (piglit_get_gl_version() >= 30) {
diff --git a/tests/spec/khr_debug/debug-object-label.c b/tests/spec/khr_debug/debug-object-label.c
index 65d733e41..e9617d719 100644
--- a/tests/spec/khr_debug/debug-object-label.c
+++ b/tests/spec/khr_debug/debug-object-label.c
@@ -102,17 +102,18 @@ test_object_ptr_label()
  * excluding the null terminator, is returned in <length>.
  */
 static bool
-check_label_and_length(char *label, int length, char *object)
+check_label_and_length(char *label, int length, GLenum object)
 {
 	bool pass = true;
+	const char *name = piglit_get_gl_enum_name(object);
 
-	printf("Checking label and length of %s object\n", object);
+	printf("Checking label and length of %s object\n", name);
 
 	if (!piglit_check_gl_error(GL_NO_ERROR))
 		pass = false;
 
 	if (length != TestLabelLen || (strcmp(TestLabel, label) != 0)) {
-		fprintf(stderr, "Label or length does not match in %s object\n", object);
+		fprintf(stderr, "Label or length does not match in %s object\n", name);
 		printf("  actual label: %s actual length: %i\n", label, length);
 		printf("  expected label: %s expected length: %i\n", TestLabel, TestLabelLen);
 		pass = false;
@@ -160,7 +161,7 @@ test_object_label_types()
 	GetObjectLabel(GL_BUFFER, buffer, TestLabelLen + 1, &length[BUFFER_IDX], label[BUFFER_IDX]);
 
 	pass = check_label_and_length(label[BUFFER_IDX], length[BUFFER_IDX],
-				      "GL_BUFFER") && pass;
+				      GL_BUFFER) && pass;
 
 	glDeleteBuffers(1, &buffer);
 
@@ -172,7 +173,7 @@ test_object_label_types()
 				 &length[SHADER_IDX], label[SHADER_IDX]);
 
 		pass = check_label_and_length(label[SHADER_IDX], length[SHADER_IDX],
-					      "GL_SHADER") && pass;
+					      GL_SHADER) && pass;
 
 		glDeleteShader(shader);
 
@@ -183,7 +184,7 @@ test_object_label_types()
 				 &length[PROGRAM_IDX], label[PROGRAM_IDX]);
 
 		pass = check_label_and_length(label[PROGRAM_IDX], length[PROGRAM_IDX],
-					      "GL_PROGRAM") && pass;
+					      GL_PROGRAM) && pass;
 
 		glDeleteProgram(program);
 	}
@@ -198,7 +199,7 @@ test_object_label_types()
 				 &length[VERTEX_ARRAY_IDX], label[VERTEX_ARRAY_IDX]);
 
 		pass = check_label_and_length(label[VERTEX_ARRAY_IDX], length[VERTEX_ARRAY_IDX],
-					      "GL_VERTEX_ARRAY") && pass;
+					      GL_VERTEX_ARRAY) && pass;
 
 		glDeleteVertexArrays(1, &vertexArray);
 	}
@@ -213,7 +214,7 @@ test_object_label_types()
 				 &length[RENDERBUFFER_IDX], label[RENDERBUFFER_IDX]);
 
 		pass = check_label_and_length(label[RENDERBUFFER_IDX], length[RENDERBUFFER_IDX],
-					      "GL_RENDERBUFFER") && pass;
+					      GL_RENDERBUFFER) && pass;
 
 		glDeleteRenderbuffers(1, &renderbuffer);
 
@@ -225,7 +226,7 @@ test_object_label_types()
 				 &length[FRAMEBUFFER_IDX], label[FRAMEBUFFER_IDX]);
 
 		pass = check_label_and_length(label[FRAMEBUFFER_IDX], length[FRAMEBUFFER_IDX],
-					      "GL_FRAMEBUFFER") && pass;
+					      GL_FRAMEBUFFER) && pass;
 
 		glDeleteFramebuffers(1, &framebuffer);
 	}
@@ -241,7 +242,7 @@ test_object_label_types()
 		GetObjectLabel(GL_QUERY, query, TestLabelLen + 1, &length[QUERY_IDX], label[QUERY_IDX]);
 
 		pass = check_label_and_length(label[QUERY_IDX], length[QUERY_IDX],
-					      "GL_TEST_QUERY") && pass;
+					      GL_QUERY) && pass;
 
 		glDeleteQueries(1, &query);
 	}
@@ -256,7 +257,7 @@ test_object_label_types()
 				 &length[PROGRAM_PIPELINE_IDX], label[PROGRAM_PIPELINE_IDX]);
 
 		pass = check_label_and_length(label[PROGRAM_PIPELINE_IDX], length[PROGRAM_PIPELINE_IDX],
-					      "GL_PROGRAM_PIPELINE")  && pass;
+					      GL_PROGRAM_PIPELINE)  && pass;
 
 		glDeleteProgramPipelines(1, &programPipeline);
 	}
@@ -272,7 +273,7 @@ test_object_label_types()
 				 &length[TRANSFORM_FEEDBACK_IDX], label[TRANSFORM_FEEDBACK_IDX]);
 
 		pass = check_label_and_length(label[TRANSFORM_FEEDBACK_IDX], length[TRANSFORM_FEEDBACK_IDX],
-					      "GL_TRANSFORM_FEEDBACK") && pass;
+					      GL_TRANSFORM_FEEDBACK) && pass;
 
 		glDeleteTransformFeedbacks(1, &transformFeedback);
 	}
@@ -286,7 +287,7 @@ test_object_label_types()
 		GetObjectLabel(GL_SAMPLER, sampler, TestLabelLen + 1, &length[SAMPLER_IDX], label[SAMPLER_IDX]);
 
 		pass = check_label_and_length(label[SAMPLER_IDX], length[SAMPLER_IDX],
-					      "GL_SAMPLER") && pass;
+					      GL_SAMPLER) && pass;
 
 		glDeleteSamplers(1, &sampler);
 	}
@@ -298,7 +299,7 @@ test_object_label_types()
 	GetObjectLabel(GL_TEXTURE, texture, TestLabelLen + 1, &length[TEXTURE_IDX], label[TEXTURE_IDX]);
 
 	pass = check_label_and_length(label[TEXTURE_IDX], length[TEXTURE_IDX],
-				      "GL_TEXTURE") && pass;
+				      GL_TEXTURE) && pass;
 
 	glDeleteTextures(1, &texture);
 
@@ -311,7 +312,7 @@ test_object_label_types()
 	GetObjectLabel(GL_DISPLAY_LIST, displayList, TestLabelLen + 1, &length[DISPLAY_LIST_IDX], label[DISPLAY_LIST_IDX]);
 
 	pass = check_label_and_length(label[DISPLAY_LIST_IDX], length[DISPLAY_LIST_IDX],
-				      "GL_DISPLAY_LIST") && pass;
+				      GL_DISPLAY_LIST) && pass;
 
 	glDeleteLists(displayList, 1);
 #endif /* PIGLIT_USE_OPENGL */
diff --git a/tests/spec/oes_texture_float/oes_texture_float.c b/tests/spec/oes_texture_float/oes_texture_float.c
index aed0b86ba..68b22c133 100644
--- a/tests/spec/oes_texture_float/oes_texture_float.c
+++ b/tests/spec/oes_texture_float/oes_texture_float.c
@@ -55,17 +55,16 @@ static const float Scale = 1.0 / 2000.0, Bias = 0.5;
 
 struct format_info
 {
-   const char *Name;
    GLenum Format;
    int NumComponents;
 };
 
 static const struct format_info Formats[] = {
-  { "GL_RGBA",            GL_RGBA,            4 },
-  { "GL_RGB",             GL_RGB,             3 },
-  { "GL_ALPHA",           GL_ALPHA,           1 },
-  { "GL_LUMINANCE",       GL_LUMINANCE,       1 },
-  { "GL_LUMINANCE_ALPHA", GL_LUMINANCE_ALPHA, 2 },
+  { GL_RGBA,            4 },
+  { GL_RGB,             3 },
+  { GL_ALPHA,           1 },
+  { GL_LUMINANCE,       1 },
+  { GL_LUMINANCE_ALPHA, 2 },
 };
 
 static const char *VertShaderText =
@@ -310,13 +309,14 @@ test_format(const struct format_info *info, const struct texture_float_info *tes
    void *image;
    float value[4];
    int p;
+   const char *name = piglit_get_gl_enum_name(info->Format);
    GLushort drawIndices[] =
      {
        0, 1, 2,
        0, 2, 3
      };
 
-   /** printf("Testing %s of %s\n", info->Name, test->TestName); **/
+   /** printf("Testing %s of %s\n", name, test->TestName); **/
 
    get_texture_color(value);
 
@@ -391,7 +391,7 @@ test_format(const struct format_info *info, const struct texture_float_info *tes
    if (!p) {
       int i;
 
-      printf("  Failed with format %s:\n", info->Name);
+      printf("  Failed with format %s:\n", name);
       printf("  Texture color = ");
       for (i = 0; i < comps; i++) {
          printf("%f", value[i]);
diff --git a/tests/texturing/texture-rg.c b/tests/texturing/texture-rg.c
index 911e6938a..401c4cde1 100644
--- a/tests/texturing/texture-rg.c
+++ b/tests/texturing/texture-rg.c
@@ -44,7 +44,6 @@ static GLint TexWidth = 128, TexHeight = 128;
 
 struct format_info
 {
-   const char *Name;
    GLenum IntFormat, BaseFormat;
    GLboolean IsInteger;
    GLboolean IsFloat;
@@ -53,30 +52,30 @@ struct format_info
 
 
 static const struct format_info IntFormats[] = {
-   { "GL_R8", GL_R8, GL_RED, GL_FALSE, GL_FALSE, GL_FALSE },
-   { "GL_R16", GL_R16, GL_RED, GL_FALSE, GL_FALSE, GL_FALSE },
-   { "GL_RG8", GL_RG8, GL_RG, GL_FALSE, GL_FALSE, GL_FALSE },
-   { "GL_RG16", GL_RG16, GL_RG, GL_FALSE, GL_FALSE, GL_FALSE },
-   { "GL_R16F", GL_R16F, GL_RED, GL_FALSE, GL_TRUE, GL_FALSE },
-   { "GL_R32F", GL_R32F, GL_RED, GL_FALSE, GL_TRUE, GL_FALSE },
-   { "GL_RG16F", GL_RG16F, GL_RG, GL_FALSE, GL_TRUE, GL_FALSE },
-   { "GL_RG32F", GL_RG32F, GL_RG, GL_FALSE, GL_TRUE, GL_FALSE },
-   { "GL_R8I", GL_R8I, GL_R8, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_R8UI", GL_R8UI, GL_RED, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_R16I", GL_R16I, GL_RED, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_R16UI", GL_R16UI, GL_RED, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_R32I", GL_R32I, GL_RED, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_R32UI", GL_R32UI, GL_RED, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_RG8I", GL_RG8I, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_RG8UI", GL_RG8UI, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_RG16I", GL_RG16I, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_RG16UI", GL_RG16UI, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_RG32I", GL_RG32I, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_RG32UI", GL_RG32UI, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
-   { "GL_RED", GL_RED, GL_RED, GL_FALSE, GL_FALSE, GL_FALSE },
-   { "GL_RG", GL_RG, GL_RG, GL_FALSE, GL_FALSE, GL_FALSE },
-   { "GL_COMPRESSED_RED", GL_COMPRESSED_RED, GL_RED, GL_FALSE, GL_FALSE, GL_TRUE },
-   { "GL_COMPRESSED_R", GL_COMPRESSED_RG, GL_RG, GL_FALSE, GL_FALSE, GL_TRUE }
+   { GL_R8, GL_RED, GL_FALSE, GL_FALSE, GL_FALSE },
+   { GL_R16, GL_RED, GL_FALSE, GL_FALSE, GL_FALSE },
+   { GL_RG8, GL_RG, GL_FALSE, GL_FALSE, GL_FALSE },
+   { GL_RG16, GL_RG, GL_FALSE, GL_FALSE, GL_FALSE },
+   { GL_R16F, GL_RED, GL_FALSE, GL_TRUE, GL_FALSE },
+   { GL_R32F, GL_RED, GL_FALSE, GL_TRUE, GL_FALSE },
+   { GL_RG16F, GL_RG, GL_FALSE, GL_TRUE, GL_FALSE },
+   { GL_RG32F, GL_RG, GL_FALSE, GL_TRUE, GL_FALSE },
+   { GL_R8I, GL_R8, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_R8UI, GL_RED, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_R16I, GL_RED, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_R16UI, GL_RED, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_R32I, GL_RED, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_R32UI, GL_RED, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_RG8I, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_RG8UI, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_RG16I, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_RG16UI, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_RG32I, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_RG32UI, GL_RG, GL_TRUE, GL_FALSE, GL_FALSE },
+   { GL_RED, GL_RED, GL_FALSE, GL_FALSE, GL_FALSE },
+   { GL_RG, GL_RG, GL_FALSE, GL_FALSE, GL_FALSE },
+   { GL_COMPRESSED_RED, GL_RED, GL_FALSE, GL_FALSE, GL_TRUE },
+   { GL_COMPRESSED_RG, GL_RG, GL_FALSE, GL_FALSE, GL_TRUE }
 };
 
 #define NUM_INT_FORMATS  (sizeof(IntFormats) / sizeof(IntFormats[0]))
@@ -172,7 +171,8 @@ test_teximage_formats(void)
 
       if (check_error(__FILE__, __LINE__)) {
          fprintf(stderr, "%s: Error in glTexImage2D for "
-                 "internalFormat = %s\n", TestName, info->Name);
+                 "internalFormat = %s\n", TestName,
+                 piglit_get_gl_enum_name(info->IntFormat));
          return GL_FALSE;
       }
 
@@ -221,7 +221,7 @@ test_teximage_formats(void)
           fabsf(result[2] - expected[2]) > error ||
           fabsf(result[3] - expected[3]) > error) {
          fprintf(stderr, "%s: failure with format %s:\n", TestName,
-                 info->Name);
+                 piglit_get_gl_enum_name(info->IntFormat));
          fprintf(stderr, "  expected color = %g, %g, %g, %g\n",
                  expected[0], expected[1], expected[2], expected[3]);
          fprintf(stderr, "  result color = %g, %g, %g, %g\n",
-- 
2.15.1



More information about the Piglit mailing list