diff options
author | Fabian Bieler <fabianbieler@fastmail.fm> | 2017-12-28 15:04:08 +0100 |
---|---|---|
committer | Fabian Bieler <fabianbieler@fastmail.fm> | 2018-01-03 22:40:52 +0100 |
commit | d88e698b3d61fecca5c6c375133a185feab69c25 (patch) | |
tree | a7378da80459011f85b18fac5169051c95ad50f2 /tests/texturing/compressedteximage.c | |
parent | 4dd96134e5e5b1c9554a91849b5dd825e7bd265d (diff) |
compressedteximage: Remove GLenum stringification macros.
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.
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'tests/texturing/compressedteximage.c')
-rw-r--r-- | tests/texturing/compressedteximage.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/tests/texturing/compressedteximage.c b/tests/texturing/compressedteximage.c index a4a6ec6fa..45ae695b2 100644 --- a/tests/texturing/compressedteximage.c +++ b/tests/texturing/compressedteximage.c @@ -48,7 +48,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN PIGLIT_GL_TEST_CONFIG_END struct format { - const char *name; GLenum token; const char **extension; }; @@ -87,30 +86,29 @@ const char *BPTC[] = { NULL }; -#define FORMAT(t, ext) { #t, t, ext } static struct format formats[] = { - FORMAT(GL_COMPRESSED_RGB_FXT1_3DFX, FXT1), - FORMAT(GL_COMPRESSED_RGBA_FXT1_3DFX, FXT1), - - FORMAT(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, S3TC), - FORMAT(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, S3TC), - FORMAT(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, S3TC), - FORMAT(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, S3TC), - - FORMAT(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, S3TC_srgb), - FORMAT(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, S3TC_srgb), - FORMAT(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, S3TC_srgb), - FORMAT(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, S3TC_srgb), - - FORMAT(GL_COMPRESSED_RGBA_BPTC_UNORM, BPTC), - FORMAT(GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, BPTC), - FORMAT(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, BPTC), - FORMAT(GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, BPTC), - - FORMAT(GL_COMPRESSED_RED_RGTC1_EXT, RGTC), - FORMAT(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT, RGTC_signed), - FORMAT(GL_COMPRESSED_RED_GREEN_RGTC2_EXT, RGTC), - FORMAT(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, RGTC_signed), + { GL_COMPRESSED_RGB_FXT1_3DFX, FXT1 }, + { GL_COMPRESSED_RGBA_FXT1_3DFX, FXT1 }, + + { GL_COMPRESSED_RGB_S3TC_DXT1_EXT, S3TC }, + { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, S3TC }, + { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, S3TC }, + { GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, S3TC }, + + { GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, S3TC_srgb }, + { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, S3TC_srgb }, + { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, S3TC_srgb }, + { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, S3TC_srgb }, + + { GL_COMPRESSED_RGBA_BPTC_UNORM, BPTC }, + { GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, BPTC }, + { GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, BPTC }, + { GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, BPTC }, + + { GL_COMPRESSED_RED_RGTC1_EXT, RGTC }, + { GL_COMPRESSED_SIGNED_RED_RGTC1_EXT, RGTC_signed }, + { GL_COMPRESSED_RED_GREEN_RGTC2_EXT, RGTC }, + { GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, RGTC_signed }, }; static void @@ -217,7 +215,8 @@ piglit_display(void) if (size != expected_size) { fprintf(stderr, "Format %s level %d (%dx%d) size %d " "doesn't match expected size %d\n", - format->name, level, w, h, size, expected_size); + piglit_get_gl_enum_name(format->token), + level, w, h, size, expected_size); piglit_report_result(PIGLIT_FAIL); } @@ -253,7 +252,8 @@ usage(int argc, char **argv) fprintf(stderr, "Usage: %s <format>\n", argv[0]); fprintf(stderr, "format is one of:\n"); for (i = 0; i < ARRAY_SIZE(formats); i++) { - fprintf(stderr, " %s\n", formats[i].name); + fprintf(stderr, " %s\n", + piglit_get_gl_enum_name(formats[i].token)); } exit(1); } @@ -271,8 +271,9 @@ piglit_init(int argc, char **argv) format = NULL; + const GLenum arg = piglit_get_gl_enum_from_name(argv[1]); for (i = 0; i < ARRAY_SIZE(formats); i++) { - if (strcmp(formats[i].name, argv[1]) == 0) { + if (formats[i].token == arg) { format = &formats[i]; break; } |