[Piglit] [PATCH 23/31] ARB_*_program: Remove GLenum stringification macros.

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


Replace GLenum stringification macros with calls to piglit_get_gl_enum_name.
---
 tests/spec/arb_fragment_program/minmax.c | 52 ++++++++++++++++----------------
 tests/spec/arb_vertex_program/minmax.c   | 48 ++++++++++++++---------------
 2 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/tests/spec/arb_fragment_program/minmax.c b/tests/spec/arb_fragment_program/minmax.c
index b0d0d9f7f..d80c171a0 100644
--- a/tests/spec/arb_fragment_program/minmax.c
+++ b/tests/spec/arb_fragment_program/minmax.c
@@ -45,9 +45,10 @@ piglit_display(void)
 static bool pass = true;
 
 static void
-min_test_i(GLenum token, GLint min, const char *name)
+min_test_i(GLenum token, GLint min)
 {
 	GLint val;
+	const char *name = piglit_get_gl_enum_name(token);
 
 	glGetIntegerv(token, &val);
 
@@ -60,9 +61,10 @@ min_test_i(GLenum token, GLint min, const char *name)
 }
 
 static void
-min_test_program(GLenum token, GLint min, const char *name)
+min_test_program(GLenum token, GLint min)
 {
 	GLint val;
+	const char *name = piglit_get_gl_enum_name(token);
 
 	glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, token, &val);
 
@@ -73,8 +75,6 @@ min_test_program(GLenum token, GLint min, const char *name)
 		printf("%-50s %8d %8d\n", name, min, val);
 	}
 }
-#define MIN_INTEGER_TEST(token, min) min_test_i(token, min, #token)
-#define MIN_PROGRAM_TEST(token, min) min_test_program(token, min, #token)
 
 void
 piglit_init(int argc, char **argv)
@@ -83,31 +83,31 @@ piglit_init(int argc, char **argv)
 
 	printf("%-50s %8s %8s\n", "token", "minimum", "value");
 
-	MIN_INTEGER_TEST(GL_MAX_TEXTURE_COORDS_ARB, 2);
-	MIN_INTEGER_TEST(GL_MAX_TEXTURE_UNITS_ARB, 2);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, 24);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, 24);
-	MIN_INTEGER_TEST(GL_MAX_PROGRAM_MATRICES_ARB, 8); /* FINISHME: < 32 */
-	MIN_INTEGER_TEST(GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, 1);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_INSTRUCTIONS_ARB, 72);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, 48);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, 24);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, 4);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEMPORARIES_ARB, 16);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_PARAMETERS_ARB, 24);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ATTRIBS_ARB, 10);
+	min_test_i(GL_MAX_TEXTURE_COORDS_ARB, 2);
+	min_test_i(GL_MAX_TEXTURE_UNITS_ARB, 2);
+	min_test_program(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, 24);
+	min_test_program(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, 24);
+	min_test_i(GL_MAX_PROGRAM_MATRICES_ARB, 8); /* FINISHME: < 32 */
+	min_test_i(GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, 1);
+	min_test_program(GL_MAX_PROGRAM_INSTRUCTIONS_ARB, 72);
+	min_test_program(GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, 48);
+	min_test_program(GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, 24);
+	min_test_program(GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, 4);
+	min_test_program(GL_MAX_PROGRAM_TEMPORARIES_ARB, 16);
+	min_test_program(GL_MAX_PROGRAM_PARAMETERS_ARB, 24);
+	min_test_program(GL_MAX_PROGRAM_ATTRIBS_ARB, 10);
 	/* No specified minimum, but test that we can query them anyway. */
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, 0);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, 0);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB, 0);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, 0);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, 0);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, 0);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, 0);
 
 	if (piglit_is_extension_supported("GL_ARB_vertex_program")) {
-		MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, 0);
-		MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB, 0);
+		min_test_program(GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, 0);
+		min_test_program(GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB, 0);
 	}
 
 	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
diff --git a/tests/spec/arb_vertex_program/minmax.c b/tests/spec/arb_vertex_program/minmax.c
index 4fdf20a45..5fbd6ab32 100644
--- a/tests/spec/arb_vertex_program/minmax.c
+++ b/tests/spec/arb_vertex_program/minmax.c
@@ -46,9 +46,10 @@ static bool pass = true;
 static GLenum target;
 
 static void
-min_test_i(GLenum token, GLint min, const char *name)
+min_test_i(GLenum token, GLint min)
 {
 	GLint val;
+	const char *name = piglit_get_gl_enum_name(token);
 
 	glGetIntegerv(token, &val);
 
@@ -61,9 +62,10 @@ min_test_i(GLenum token, GLint min, const char *name)
 }
 
 static void
-min_test_program(GLenum token, GLint min, const char *name)
+min_test_program(GLenum token, GLint min)
 {
 	GLint val;
+	const char *name = piglit_get_gl_enum_name(token);
 
 	glGetProgramivARB(target, token, &val);
 
@@ -74,8 +76,6 @@ min_test_program(GLenum token, GLint min, const char *name)
 		printf("%-50s %8d %8d\n", name, min, val);
 	}
 }
-#define MIN_INTEGER_TEST(token, min) min_test_i(token, min, #token)
-#define MIN_PROGRAM_TEST(token, min) min_test_program(token, min, #token)
 
 void
 piglit_init(int argc, char **argv)
@@ -85,33 +85,33 @@ piglit_init(int argc, char **argv)
 	printf("%-50s %8s %8s\n", "token", "minimum", "value");
 
 	target = GL_VERTEX_PROGRAM_ARB;
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, 96);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, 96);
-	MIN_INTEGER_TEST(GL_MAX_PROGRAM_MATRICES_ARB, 8);
-	MIN_INTEGER_TEST(GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, 1);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_INSTRUCTIONS_ARB, 128);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEMPORARIES_ARB, 12);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_PARAMETERS_ARB, 96);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ATTRIBS_ARB, 16);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, 1);
+	min_test_program(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, 96);
+	min_test_program(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, 96);
+	min_test_i(GL_MAX_PROGRAM_MATRICES_ARB, 8);
+	min_test_i(GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, 1);
+	min_test_program(GL_MAX_PROGRAM_INSTRUCTIONS_ARB, 128);
+	min_test_program(GL_MAX_PROGRAM_TEMPORARIES_ARB, 12);
+	min_test_program(GL_MAX_PROGRAM_PARAMETERS_ARB, 96);
+	min_test_program(GL_MAX_PROGRAM_ATTRIBS_ARB, 16);
+	min_test_program(GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, 1);
 	/* No specified minimum, but test that we can query them anyway. */
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, 0);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, 0);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, 0);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, 0);
-	MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, 0);
+	min_test_program(GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB, 0);
 
 	/* See the GL_ARB_fragment_program specification for this
 	 * consistency requirement.
 	 */
 	if (piglit_is_extension_supported("GL_ARB_fragment_program")) {
 		target = GL_FRAGMENT_PROGRAM_ARB;
-		MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, 0);
-		MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, 0);
-		MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, 0);
-		MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, 0);
-		MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB, 0);
-		MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, 0);
+		min_test_program(GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, 0);
+		min_test_program(GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, 0);
+		min_test_program(GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, 0);
+		min_test_program(GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, 0);
+		min_test_program(GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB, 0);
+		min_test_program(GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, 0);
 	}
 
 	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
-- 
2.15.1



More information about the Piglit mailing list