[Piglit] [PATCH 14/31] fbo-stencil8: Remove GLenum stringification macros.

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


Replace GLenum stringification macros with calls to piglit_get_gl_enum_name.

Also replace string comparison between command line argument and GLenum name
with call to piglit_get_gl_enum_from_name and integer comparision.
---
 tests/spec/arb_texture_stencil8/fbo-stencil8.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/tests/spec/arb_texture_stencil8/fbo-stencil8.c b/tests/spec/arb_texture_stencil8/fbo-stencil8.c
index 8e3fad8b8..054297b7d 100644
--- a/tests/spec/arb_texture_stencil8/fbo-stencil8.c
+++ b/tests/spec/arb_texture_stencil8/fbo-stencil8.c
@@ -49,17 +49,14 @@ enum {
 };
 int test = CLEAR;
 
-#define F(name) #name, name
-
 struct format {
-	const char *name;
 	GLuint iformat;
 	const char *extension;
 } formats[] = {
-	{F(GL_STENCIL_INDEX1),    NULL},
-	{F(GL_STENCIL_INDEX4),    NULL},
-	{F(GL_STENCIL_INDEX8),    NULL},
-	{F(GL_STENCIL_INDEX16),   NULL},
+	{GL_STENCIL_INDEX1,    NULL},
+	{GL_STENCIL_INDEX4,    NULL},
+	{GL_STENCIL_INDEX8,    NULL},
+	{GL_STENCIL_INDEX16,   NULL},
 };
 
 struct format f;
@@ -321,18 +318,20 @@ void piglit_init(int argc, char **argv)
 			test = BLIT;
 			continue;
 		}
+		const GLenum arg = piglit_get_gl_enum_from_name(argv[p]);
 		for (i = 0; i < sizeof(formats)/sizeof(*formats); i++) {
-			if (!strcmp(argv[p], formats[i].name)) {
+			if (arg == formats[i].iformat) {
 				if (formats[i].extension)
 					piglit_require_extension(formats[i].extension);
 				f = formats[i];
-				printf("Testing %s.\n", f.name);
+				printf("Testing %s.\n",
+				       piglit_get_gl_enum_name(f.iformat));
 				break;
 			}
 		}
 	}
 
-	if (!f.name) {
+	if (!f.iformat) {
 		printf("Not enough parameters.\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
-- 
2.15.1



More information about the Piglit mailing list