diff options
author | Fabian Bieler <fabianbieler@fastmail.fm> | 2017-12-28 15:47:36 +0100 |
---|---|---|
committer | Fabian Bieler <fabianbieler@fastmail.fm> | 2018-01-03 22:40:52 +0100 |
commit | 827b6bec3e183945234c6432c2c77900e8672cc4 (patch) | |
tree | 98bd6866eddf2e474862aae4fe15a8055b8406e0 /tests | |
parent | 45042c7bb9910b9242ca13f884b05f4510a157ac (diff) |
dsa-compressedtextureimage: 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')
-rw-r--r-- | tests/spec/arb_direct_state_access/compressedtextureimage.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/tests/spec/arb_direct_state_access/compressedtextureimage.c b/tests/spec/arb_direct_state_access/compressedtextureimage.c index 2202ca6ca..7b93fda8f 100644 --- a/tests/spec/arb_direct_state_access/compressedtextureimage.c +++ b/tests/spec/arb_direct_state_access/compressedtextureimage.c @@ -51,7 +51,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN PIGLIT_GL_TEST_CONFIG_END struct format { - const char *name; GLenum token; const char **extension; }; @@ -90,30 +89,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 @@ -220,7 +218,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); } @@ -256,7 +255,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); } @@ -274,8 +274,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; } |