[Piglit] [PATCH 30/31] arb_clear_texture: Remove GLenum stringification macros.

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


Replace GLenum stringification macros with calls to piglit_get_gl_enum_name.
---
 tests/spec/arb_clear_texture/base-formats.c  | 14 +++++++-------
 tests/spec/arb_clear_texture/common.c        |  6 +++---
 tests/spec/arb_clear_texture/common.h        | 15 ---------------
 tests/spec/arb_clear_texture/float.c         |  4 ++--
 tests/spec/arb_clear_texture/rg.c            |  4 ++--
 tests/spec/arb_clear_texture/sized-formats.c | 16 ++++++++--------
 tests/spec/arb_clear_texture/srgb.c          |  8 ++++----
 7 files changed, 26 insertions(+), 41 deletions(-)

diff --git a/tests/spec/arb_clear_texture/base-formats.c b/tests/spec/arb_clear_texture/base-formats.c
index 338cf712e..00b7c4fc9 100644
--- a/tests/spec/arb_clear_texture/base-formats.c
+++ b/tests/spec/arb_clear_texture/base-formats.c
@@ -40,13 +40,13 @@ PIGLIT_GL_TEST_CONFIG_END
 
 static const struct format
 formats[] = {
-	DEF_FORMAT(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 4),
-	DEF_FORMAT(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, 3),
-	DEF_FORMAT(GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE, 4),
-	DEF_FORMAT(GL_RGB, GL_BGR, GL_UNSIGNED_BYTE, 3),
-	DEF_FORMAT(GL_RGBA, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 4),
-	DEF_FORMAT(GL_RGBA, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4),
-	DEF_FORMAT(GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, 1),
+	{ GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 4 },
+	{ GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, 3 },
+	{ GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE, 4 },
+	{ GL_RGB, GL_BGR, GL_UNSIGNED_BYTE, 3 },
+	{ GL_RGBA, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 4 },
+	{ GL_RGBA, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4 },
+	{ GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, 1 },
 };
 
 void
diff --git a/tests/spec/arb_clear_texture/common.c b/tests/spec/arb_clear_texture/common.c
index ebe5a6558..3503fb071 100644
--- a/tests/spec/arb_clear_texture/common.c
+++ b/tests/spec/arb_clear_texture/common.c
@@ -237,9 +237,9 @@ test_formats(const struct format *formats,
 				   format->texelSize);
 
 		printf("internalFormat = %s, format = %s, type = %s : %s\n",
-		       format->internalFormatName,
-		       format->formatName,
-		       format->typeName,
+		       piglit_get_gl_enum_name(format->internalFormat),
+		       piglit_get_gl_enum_name(format->format),
+		       piglit_get_gl_enum_name(format->type),
 		       pass ? "pass" : "fail");
 
 		overallResult &= pass;
diff --git a/tests/spec/arb_clear_texture/common.h b/tests/spec/arb_clear_texture/common.h
index 7f59dc4f0..e8b3b5429 100644
--- a/tests/spec/arb_clear_texture/common.h
+++ b/tests/spec/arb_clear_texture/common.h
@@ -30,23 +30,8 @@ struct format {
 	GLenum format;
 	GLenum type;
 	GLsizei texelSize;
-
-	const char *internalFormatName;
-	const char *formatName;
-	const char *typeName;
 };
 
-#define DEF_FORMAT(internalFormatArg, formatArg, typeArg, texelSizeArg) \
-	{                                                               \
-		internalFormatArg,                                      \
-		formatArg,                                              \
-		typeArg,                                                \
-		texelSizeArg,                                           \
-		#internalFormatArg,                                     \
-		#formatArg,                                             \
-		#typeArg                                                \
-	}
-
 bool
 test_format(GLenum internalFormat,
 	    GLenum format,
diff --git a/tests/spec/arb_clear_texture/float.c b/tests/spec/arb_clear_texture/float.c
index daabe0795..a15619331 100644
--- a/tests/spec/arb_clear_texture/float.c
+++ b/tests/spec/arb_clear_texture/float.c
@@ -40,8 +40,8 @@ PIGLIT_GL_TEST_CONFIG_END
 
 static const struct format
 formats[] = {
-        DEF_FORMAT(GL_RGBA32F, GL_RGBA, GL_FLOAT, 16),
-        DEF_FORMAT(GL_RGB32F, GL_RGB, GL_FLOAT, 12),
+	{ GL_RGBA32F, GL_RGBA, GL_FLOAT, 16 },
+	{ GL_RGB32F, GL_RGB, GL_FLOAT, 12 },
 };
 
 void
diff --git a/tests/spec/arb_clear_texture/rg.c b/tests/spec/arb_clear_texture/rg.c
index 5733b937c..75e5f6a46 100644
--- a/tests/spec/arb_clear_texture/rg.c
+++ b/tests/spec/arb_clear_texture/rg.c
@@ -40,8 +40,8 @@ PIGLIT_GL_TEST_CONFIG_END
 
 static const struct format
 formats[] = {
-	DEF_FORMAT(GL_RED, GL_RED, GL_UNSIGNED_BYTE, 1),
-	DEF_FORMAT(GL_RG, GL_RG, GL_UNSIGNED_BYTE, 2),
+	{ GL_RED, GL_RED, GL_UNSIGNED_BYTE, 1 },
+	{ GL_RG, GL_RG, GL_UNSIGNED_BYTE, 2 },
 };
 
 void
diff --git a/tests/spec/arb_clear_texture/sized-formats.c b/tests/spec/arb_clear_texture/sized-formats.c
index 533556936..35b87da69 100644
--- a/tests/spec/arb_clear_texture/sized-formats.c
+++ b/tests/spec/arb_clear_texture/sized-formats.c
@@ -40,14 +40,14 @@ PIGLIT_GL_TEST_CONFIG_END
 
 static const struct format
 formats[] = {
-	DEF_FORMAT(GL_ALPHA8, GL_ALPHA, GL_UNSIGNED_BYTE, 1),
-	DEF_FORMAT(GL_ALPHA16, GL_ALPHA, GL_UNSIGNED_SHORT, 2),
-	DEF_FORMAT(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, 3),
-	DEF_FORMAT(GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, 6),
-	DEF_FORMAT(GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2),
-	DEF_FORMAT(GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, 4),
-	DEF_FORMAT(GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4),
-	DEF_FORMAT(GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, 8),
+	{ GL_ALPHA8, GL_ALPHA, GL_UNSIGNED_BYTE, 1 },
+	{ GL_ALPHA16, GL_ALPHA, GL_UNSIGNED_SHORT, 2 },
+	{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, 3 },
+	{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, 6 },
+	{ GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2 },
+	{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, 4 },
+	{ GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4 },
+	{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, 8 },
 };
 
 void
diff --git a/tests/spec/arb_clear_texture/srgb.c b/tests/spec/arb_clear_texture/srgb.c
index 4f5832ba0..129ba5e67 100644
--- a/tests/spec/arb_clear_texture/srgb.c
+++ b/tests/spec/arb_clear_texture/srgb.c
@@ -43,10 +43,10 @@ PIGLIT_GL_TEST_CONFIG_END
 
 static const struct format
 formats[] = {
-	DEF_FORMAT(GL_SRGB_EXT, GL_RGB, GL_UNSIGNED_BYTE, 3),
-	DEF_FORMAT(GL_SRGB8_EXT, GL_RGB, GL_UNSIGNED_BYTE, 3),
-	DEF_FORMAT(GL_SRGB_ALPHA_EXT, GL_RGBA, GL_UNSIGNED_BYTE, 4),
-	DEF_FORMAT(GL_SRGB8_ALPHA8_EXT, GL_RGBA, GL_UNSIGNED_BYTE, 4)
+	{ GL_SRGB_EXT, GL_RGB, GL_UNSIGNED_BYTE, 3 },
+	{ GL_SRGB8_EXT, GL_RGB, GL_UNSIGNED_BYTE, 3 },
+	{ GL_SRGB_ALPHA_EXT, GL_RGBA, GL_UNSIGNED_BYTE, 4 },
+	{ GL_SRGB8_ALPHA8_EXT, GL_RGBA, GL_UNSIGNED_BYTE, 4 }
 };
 
 void
-- 
2.15.1



More information about the Piglit mailing list