diff options
author | Fabian Bieler <fabianbieler@fastmail.fm> | 2017-12-27 14:21:54 +0100 |
---|---|---|
committer | Fabian Bieler <fabianbieler@fastmail.fm> | 2018-01-03 22:40:52 +0100 |
commit | fc189b7ff1160e3adc067de09c56caac99a9ff86 (patch) | |
tree | db3372bf9893d420a47023db0deafb9c0331005c /tests | |
parent | 246659cf28ac2c512f01226beb83f364810d8e03 (diff) |
Remove GLenum stringification macros.
Replace GLenum stringification macros with calls to piglit_get_gl_enum_name.
This commit modifies all tests were the replacement is simple and
straightforward.
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'tests')
8 files changed, 194 insertions, 213 deletions
diff --git a/tests/fbo/fbo-readpixels-depth-formats.c b/tests/fbo/fbo-readpixels-depth-formats.c index d53ce9eac..cc4ef9374 100644 --- a/tests/fbo/fbo-readpixels-depth-formats.c +++ b/tests/fbo/fbo-readpixels-depth-formats.c @@ -254,17 +254,13 @@ done: return pass; } -#define ENTRY(token) { #token, token } -struct { - const char *name; - GLenum token; -} rb_internal_formats[] = { - ENTRY(GL_DEPTH_COMPONENT), - ENTRY(GL_DEPTH_COMPONENT32), - ENTRY(GL_DEPTH_COMPONENT24), - ENTRY(GL_DEPTH_COMPONENT16), - ENTRY(GL_DEPTH_STENCIL_EXT), - ENTRY(GL_DEPTH24_STENCIL8_EXT), +GLenum rb_internal_formats[] = { + GL_DEPTH_COMPONENT, + GL_DEPTH_COMPONENT32, + GL_DEPTH_COMPONENT24, + GL_DEPTH_COMPONENT16, + GL_DEPTH_STENCIL_EXT, + GL_DEPTH24_STENCIL8_EXT, }; void piglit_init(int argc, char **argv) @@ -276,8 +272,10 @@ void piglit_init(int argc, char **argv) piglit_require_extension("GL_EXT_packed_depth_stencil"); for (i = 0; i < ARRAY_SIZE(rb_internal_formats); i++) { - pass = test_with_format(rb_internal_formats[i].token, - rb_internal_formats[i].name) && pass; + const char *name = + piglit_get_gl_enum_name(rb_internal_formats[i]); + pass = test_with_format(rb_internal_formats[i], + name) && pass; } piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); diff --git a/tests/spec/arb_program_interface_query/getprograminterfaceiv.c b/tests/spec/arb_program_interface_query/getprograminterfaceiv.c index bada68a78..4f522c2b0 100755 --- a/tests/spec/arb_program_interface_query/getprograminterfaceiv.c +++ b/tests/spec/arb_program_interface_query/getprograminterfaceiv.c @@ -97,23 +97,16 @@ struct subtest_t { GLenum programInterface; GLenum pname; GLenum expected_error; - - - const char *programInterface_str; - const char *pname_str; - const char *error_str; }; -#define ST(programInterface, pname, error) { \ - (programInterface), (pname), (error), #programInterface, #pname, #error \ -} - static const struct subtest_t programInterface_subtests[] = { - ST(GL_TRUE, GL_MAX_NAME_LENGTH, GL_INVALID_OPERATION), - ST(GL_UNIFORM, GL_TRUE, GL_INVALID_OPERATION), - ST(GL_ATOMIC_COUNTER_BUFFER, GL_MAX_NAME_LENGTH, GL_INVALID_OPERATION), - ST(GL_UNIFORM, GL_MAX_NUM_ACTIVE_VARIABLES, GL_INVALID_OPERATION), - ST(GL_PROGRAM_OUTPUT, GL_MAX_NUM_COMPATIBLE_SUBROUTINES, GL_INVALID_OPERATION), + { GL_TRUE, GL_MAX_NAME_LENGTH, GL_INVALID_OPERATION }, + { GL_UNIFORM, GL_TRUE, GL_INVALID_OPERATION }, + { GL_ATOMIC_COUNTER_BUFFER, GL_MAX_NAME_LENGTH, + GL_INVALID_OPERATION }, + { GL_UNIFORM, GL_MAX_NUM_ACTIVE_VARIABLES, GL_INVALID_OPERATION }, + { GL_PROGRAM_OUTPUT, GL_MAX_NUM_COMPATIBLE_SUBROUTINES, + GL_INVALID_OPERATION }, }; static bool @@ -133,6 +126,9 @@ run_subtest(const struct subtest_t st, GLuint prog, bool *pass) enum piglit_result result; bool local_pass = true; int value; + const char *programInterface_str = + piglit_get_gl_enum_name(st.programInterface); + const char *pname_str = piglit_get_gl_enum_name(st.pname); if (!check_extensions(st)) { result = PIGLIT_SKIP; @@ -142,7 +138,7 @@ run_subtest(const struct subtest_t st, GLuint prog, bool *pass) glGetProgramInterfaceiv(prog, st.programInterface, st.pname, &value); if (!piglit_check_gl_error(st.expected_error)) { printf(" Call was glGetProgramInterfaceiv(prog, %s, " - "%s, ...)\n", st.programInterface_str, st.pname_str); + "%s, ...)\n", programInterface_str, pname_str); local_pass = false; } @@ -150,8 +146,8 @@ run_subtest(const struct subtest_t st, GLuint prog, bool *pass) result = local_pass ? PIGLIT_PASS : PIGLIT_FAIL; report_result: - piglit_report_subtest_result(result, "%s on %s", st.pname_str, - st.programInterface_str); + piglit_report_subtest_result(result, "%s on %s", pname_str, + programInterface_str); } void diff --git a/tests/spec/arb_program_interface_query/getprogramresourceindex.c b/tests/spec/arb_program_interface_query/getprogramresourceindex.c index 2933a7fdb..16b38e2d5 100755 --- a/tests/spec/arb_program_interface_query/getprogramresourceindex.c +++ b/tests/spec/arb_program_interface_query/getprogramresourceindex.c @@ -148,44 +148,36 @@ struct subtest_index_t { bool valid_index; GLint expect_value; /* -1, means don't check for an epected value */ GLenum expected_error; - - const char *programInterface_str; - const char *error_str; }; -#define ST(vs_text, programInterface, name, valid, value, error) { \ - (vs_text), (programInterface), (name), (valid), (value), (error), \ - #programInterface, #error \ -} - /* Test for arrays of arrays */ static const struct subtest_index_t index_subtests[] = { - ST( vs_empty, GL_ATOMIC_COUNTER_BUFFER, "dummy", false, -1, GL_INVALID_ENUM), - ST( vs_empty, GL_UNIFORM, NULL, false, -1, GL_NO_ERROR), - ST( vs_empty, GL_UNIFORM, "dummy", false, -1, GL_NO_ERROR), - ST( vs_empty, GL_TRUE, "vs_input", true, -1, GL_INVALID_ENUM), - ST( vs_array, GL_PROGRAM_INPUT, "vs_input", true, -1, GL_NO_ERROR), - ST( vs_array, GL_PROGRAM_INPUT, "vs_input[0]", true, -1, GL_NO_ERROR), - ST( vs_array, GL_PROGRAM_INPUT, "vs_input[1]", false, -1, GL_NO_ERROR), - ST( vs_array, GL_UNIFORM, "hello", false, -1, GL_NO_ERROR), - ST( vs_array, GL_UNIFORM, "sa[0].hello", true, -1, GL_NO_ERROR), - ST( vs_array, GL_UNIFORM, "sa[0].world", true, -1, GL_NO_ERROR), - ST( vs_array, GL_UNIFORM, "sa[0].world[0]", true, -1, GL_NO_ERROR), - ST( vs_array, GL_UNIFORM, "sa[1].hello", false, -1, GL_NO_ERROR), - ST( vs_aofa, GL_PROGRAM_INPUT, "vs_input2", false, -1, GL_NO_ERROR), - ST( vs_aofa, GL_PROGRAM_INPUT, "vs_input2[0]", true, -1, GL_NO_ERROR), - ST( vs_aofa, GL_PROGRAM_INPUT, "vs_input2[0][0]", true, -1, GL_NO_ERROR), - ST( vs_aofa, GL_PROGRAM_INPUT, "vs_input2[1][0]", false, -1, GL_NO_ERROR), - ST( vs_aofa, GL_PROGRAM_INPUT, "vs_input2[0][1]", false, -1, GL_NO_ERROR), - ST( vs_sub, GL_VERTEX_SUBROUTINE, "vss", true, -1, GL_NO_ERROR), - ST( vs_sub, GL_VERTEX_SUBROUTINE, "vss2", true, -1, GL_NO_ERROR), - ST(vs_subidx, GL_VERTEX_SUBROUTINE, "vss_idx", true, 5, GL_NO_ERROR), - ST(vs_subidx, GL_VERTEX_SUBROUTINE, "vss2_idx", true, -1, GL_NO_ERROR), - ST( vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_NextBuffer", false, -1, GL_NO_ERROR), - ST( vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents1", false, -1, GL_NO_ERROR), - ST( vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents2", false, -1, GL_NO_ERROR), - ST( vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents3", false, -1, GL_NO_ERROR), - ST( vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents4", false, -1, GL_NO_ERROR), + { vs_empty, GL_ATOMIC_COUNTER_BUFFER, "dummy", false, -1, GL_INVALID_ENUM }, + { vs_empty, GL_UNIFORM, NULL, false, -1, GL_NO_ERROR }, + { vs_empty, GL_UNIFORM, "dummy", false, -1, GL_NO_ERROR }, + { vs_empty, GL_TRUE, "vs_input", true, -1, GL_INVALID_ENUM }, + { vs_array, GL_PROGRAM_INPUT, "vs_input", true, -1, GL_NO_ERROR }, + { vs_array, GL_PROGRAM_INPUT, "vs_input[0]", true, -1, GL_NO_ERROR }, + { vs_array, GL_PROGRAM_INPUT, "vs_input[1]", false, -1, GL_NO_ERROR }, + { vs_array, GL_UNIFORM, "hello", false, -1, GL_NO_ERROR }, + { vs_array, GL_UNIFORM, "sa[0].hello", true, -1, GL_NO_ERROR }, + { vs_array, GL_UNIFORM, "sa[0].world", true, -1, GL_NO_ERROR }, + { vs_array, GL_UNIFORM, "sa[0].world[0]", true, -1, GL_NO_ERROR }, + { vs_array, GL_UNIFORM, "sa[1].hello", false, -1, GL_NO_ERROR }, + { vs_aofa, GL_PROGRAM_INPUT, "vs_input2", false, -1, GL_NO_ERROR }, + { vs_aofa, GL_PROGRAM_INPUT, "vs_input2[0]", true, -1, GL_NO_ERROR }, + { vs_aofa, GL_PROGRAM_INPUT, "vs_input2[0][0]", true, -1, GL_NO_ERROR }, + { vs_aofa, GL_PROGRAM_INPUT, "vs_input2[1][0]", false, -1, GL_NO_ERROR }, + { vs_aofa, GL_PROGRAM_INPUT, "vs_input2[0][1]", false, -1, GL_NO_ERROR }, + { vs_sub, GL_VERTEX_SUBROUTINE, "vss", true, -1, GL_NO_ERROR }, + { vs_sub, GL_VERTEX_SUBROUTINE, "vss2", true, -1, GL_NO_ERROR }, + { vs_subidx, GL_VERTEX_SUBROUTINE, "vss_idx", true, 5, GL_NO_ERROR }, + { vs_subidx, GL_VERTEX_SUBROUTINE, "vss2_idx", true, -1, GL_NO_ERROR }, + { vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_NextBuffer", false, -1, GL_NO_ERROR }, + { vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents1", false, -1, GL_NO_ERROR }, + { vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents2", false, -1, GL_NO_ERROR }, + { vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents3", false, -1, GL_NO_ERROR }, + { vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents4", false, -1, GL_NO_ERROR }, }; static bool @@ -262,6 +254,8 @@ run_index_subtest(const struct subtest_index_t st, bool *pass) bool local_pass = true; GLint index; GLuint prog; + const char *programInterface_str = + piglit_get_gl_enum_name(st.programInterface); if (!check_extensions(st)) { result = PIGLIT_SKIP; @@ -279,7 +273,7 @@ run_index_subtest(const struct subtest_index_t st, bool *pass) index = glGetProgramResourceIndex(prog, st.programInterface, st.name); if (!piglit_check_gl_error(st.expected_error)) { printf("Call was glGetProgramResourceIndex(prog, %s, " - "%s, ...) = %i\n", st.programInterface_str, st.name, + "%s, ...) = %i\n", programInterface_str, st.name, index); local_pass = false; } else if (st.expected_error == GL_NO_ERROR) { @@ -308,7 +302,7 @@ run_index_subtest(const struct subtest_index_t st, bool *pass) report_result: piglit_report_subtest_result(result, "'%s' on %s", st.name, - st.programInterface_str); + programInterface_str); } void diff --git a/tests/spec/arb_stencil_texturing/blit_corrupts_state.c b/tests/spec/arb_stencil_texturing/blit_corrupts_state.c index 6c1d1f1a4..db3e9d8ea 100644 --- a/tests/spec/arb_stencil_texturing/blit_corrupts_state.c +++ b/tests/spec/arb_stencil_texturing/blit_corrupts_state.c @@ -190,19 +190,16 @@ setup_fbo(GLenum target, GLenum textarget, GLuint attachment) } } -#define ENUM(e) # e, e - static const struct { - const char *target_name; GLenum target; const char *required_extension; } test_vectors[] = { - { ENUM(GL_TEXTURE_1D), NULL }, - { ENUM(GL_TEXTURE_2D), NULL }, + { GL_TEXTURE_1D, NULL }, + { GL_TEXTURE_2D, NULL }, - { ENUM(GL_TEXTURE_RECTANGLE), "GL_ARB_texture_rectangle" }, - { ENUM(GL_TEXTURE_2D_MULTISAMPLE), "GL_ARB_texture_multisample" }, - { ENUM(GL_TEXTURE_2D_MULTISAMPLE_ARRAY), "GL_ARB_texture_multisample" }, + { GL_TEXTURE_RECTANGLE, "GL_ARB_texture_rectangle" }, + { GL_TEXTURE_2D_MULTISAMPLE, "GL_ARB_texture_multisample" }, + { GL_TEXTURE_2D_MULTISAMPLE_ARRAY, "GL_ARB_texture_multisample" }, /** * These do not require any extensions because they are part of OpenGL @@ -211,12 +208,12 @@ static const struct { * GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL formats before then. */ /*@{*/ - { ENUM(GL_TEXTURE_1D_ARRAY), NULL }, - { ENUM(GL_TEXTURE_2D_ARRAY), NULL }, - { ENUM(GL_TEXTURE_CUBE_MAP), NULL }, + { GL_TEXTURE_1D_ARRAY, NULL }, + { GL_TEXTURE_2D_ARRAY, NULL }, + { GL_TEXTURE_CUBE_MAP, NULL }, /*@}*/ - { ENUM(GL_TEXTURE_CUBE_MAP_ARRAY), "GL_ARB_texture_cube_map_array" }, + { GL_TEXTURE_CUBE_MAP_ARRAY, "GL_ARB_texture_cube_map_array" }, }; static NORETURN void @@ -227,12 +224,14 @@ usage_and_exit(const char *name) name); for (unsigned i = 0; i < ARRAY_SIZE(test_vectors); i++) { + const char *target_name = + piglit_get_gl_enum_name(test_vectors[i].target); if (test_vectors[i].required_extension == NULL) printf("\t%s\n", - test_vectors[i].target_name); + target_name); else printf("\t%s (requires %s)\n", - test_vectors[i].target_name, + target_name, test_vectors[i].required_extension); } @@ -253,7 +252,8 @@ piglit_init(int argc, char **argv) usage_and_exit(argv[0]); for (unsigned i = 0; i < ARRAY_SIZE(test_vectors); i++) { - if (strcmp(argv[1], test_vectors[i].target_name) == 0) { + if (strcmp(piglit_get_gl_enum_name(test_vectors[i].target), + argv[1]) == 0) { if (test_vectors[i].required_extension != NULL) piglit_require_extension(test_vectors[i].required_extension); diff --git a/tests/spec/arb_texture_compression/internal-format-query.c b/tests/spec/arb_texture_compression/internal-format-query.c index e9f62dfe3..7c6cfbbf9 100644 --- a/tests/spec/arb_texture_compression/internal-format-query.c +++ b/tests/spec/arb_texture_compression/internal-format-query.c @@ -80,11 +80,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN PIGLIT_GL_TEST_CONFIG_END -#define ENUM_AND_STRING(e) \ - # e, e - struct test_vector { - const char *generic_compressed_format_string; GLenum generic_compressed_format; GLenum base_format; }; @@ -93,30 +89,30 @@ struct test_vector { * Generic texture formats in OpenGL 1.3 and GL_ARB_texture_compression. */ static const struct test_vector arb_texture_compression_formats[] = { - { ENUM_AND_STRING(GL_COMPRESSED_ALPHA), GL_ALPHA }, - { ENUM_AND_STRING(GL_COMPRESSED_LUMINANCE), GL_LUMINANCE }, - { ENUM_AND_STRING(GL_COMPRESSED_LUMINANCE_ALPHA), GL_LUMINANCE_ALPHA }, - { ENUM_AND_STRING(GL_COMPRESSED_INTENSITY), GL_INTENSITY }, - { ENUM_AND_STRING(GL_COMPRESSED_RGB), GL_RGB }, - { ENUM_AND_STRING(GL_COMPRESSED_RGBA), GL_RGBA }, + {GL_COMPRESSED_ALPHA, GL_ALPHA}, + {GL_COMPRESSED_LUMINANCE, GL_LUMINANCE}, + {GL_COMPRESSED_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA}, + {GL_COMPRESSED_INTENSITY, GL_INTENSITY}, + {GL_COMPRESSED_RGB, GL_RGB}, + {GL_COMPRESSED_RGBA, GL_RGBA}, }; /** * Generic texture formats in OpenGL 3.0 and GL_ARB_texture_rg. */ static const struct test_vector arb_texture_rg_formats[] = { - { ENUM_AND_STRING(GL_COMPRESSED_RED), GL_RED }, - { ENUM_AND_STRING(GL_COMPRESSED_RG), GL_RG }, + { GL_COMPRESSED_RED, GL_RED }, + { GL_COMPRESSED_RG, GL_RG }, }; /** * Generic texture formats in OpenGL 2.1 and GL_EXT_texture_sRGB. */ static const struct test_vector ext_texture_srgb_formats[] = { - { ENUM_AND_STRING(GL_COMPRESSED_SRGB_EXT), GL_RGB }, - { ENUM_AND_STRING(GL_COMPRESSED_SRGB_ALPHA_EXT), GL_RGBA }, - { ENUM_AND_STRING(GL_COMPRESSED_SLUMINANCE_EXT), GL_LUMINANCE }, - { ENUM_AND_STRING(GL_COMPRESSED_SLUMINANCE_ALPHA_EXT), GL_LUMINANCE_ALPHA }, + { GL_COMPRESSED_SRGB_EXT, GL_RGB }, + { GL_COMPRESSED_SRGB_ALPHA_EXT, GL_RGBA }, + { GL_COMPRESSED_SLUMINANCE_EXT, GL_LUMINANCE }, + { GL_COMPRESSED_SLUMINANCE_ALPHA_EXT, GL_LUMINANCE_ALPHA }, }; static GLubyte dummy_data[16 * 16 * 4]; @@ -157,10 +153,14 @@ try_formats(const struct test_vector *t, unsigned num_tests, GLuint tex; GLint is_compressed; GLenum format; + const char *generic_compressed_format_string = + piglit_get_gl_enum_name( + t[i].generic_compressed_format); - if (!piglit_automatic) { + if (!piglit_automatic) + { printf("Trying %s/0x%04x (base format = 0x%04x)...\n", - t[i].generic_compressed_format_string, + generic_compressed_format_string, t[i].generic_compressed_format, t[i].base_format); } @@ -208,7 +208,7 @@ try_formats(const struct test_vector *t, unsigned num_tests, "generic\n" "format as the specific internal " "format.\n", - t[i].generic_compressed_format_string); + generic_compressed_format_string); pass = false; } else if (format <= 4 || format == t[i].base_format) { fprintf(stderr, @@ -216,7 +216,7 @@ try_formats(const struct test_vector *t, unsigned num_tests, "internal\n" "format 0x%04x that is " "non-compressed\n", - t[i].generic_compressed_format_string, + generic_compressed_format_string, format); pass = false; } else if (j == num_compressed_formats) { @@ -229,7 +229,7 @@ try_formats(const struct test_vector *t, unsigned num_tests, "This may just mean the test does not " "know about the compessed format that\n" "was selected by the driver.\n", - t[i].generic_compressed_format_string, + generic_compressed_format_string, piglit_get_gl_enum_name(format)); } } else if (format != t[i].base_format) { @@ -239,13 +239,13 @@ try_formats(const struct test_vector *t, unsigned num_tests, "generic\n" "format as the specific internal " "format.\n", - t[i].generic_compressed_format_string); + generic_compressed_format_string); } else { fprintf(stderr, "%s did not compress, but it got an " "internal format of %s when " "%s was expected.\n", - t[i].generic_compressed_format_string, + generic_compressed_format_string, piglit_get_gl_enum_name(format), piglit_get_gl_enum_name(t[i].base_format)); } diff --git a/tests/spec/ext_texture_integer/getteximage-clamping.c b/tests/spec/ext_texture_integer/getteximage-clamping.c index c93ae0f0e..e48a21f57 100644 --- a/tests/spec/ext_texture_integer/getteximage-clamping.c +++ b/tests/spec/ext_texture_integer/getteximage-clamping.c @@ -136,87 +136,83 @@ static const struct format_info formats[] = { }; struct read_format_info { - const char *format_name, *type_name; GLenum format, type; int size; bool sign; }; -#define READ_FORMAT(format, type, size, sign) \ - { #format, #type, format, type, size, sign } - /* Integer formats from table 3.5 and 3.6 of the GL 3.0 specification */ static const struct read_format_info read_formats[] = { - READ_FORMAT(GL_RGBA_INTEGER, GL_UNSIGNED_INT, 32, false), - READ_FORMAT(GL_RGBA_INTEGER, GL_INT, 32, true), - READ_FORMAT(GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, 16, false), - READ_FORMAT(GL_RGBA_INTEGER, GL_SHORT, 16, true), - READ_FORMAT(GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, 8, false), - READ_FORMAT(GL_RGBA_INTEGER, GL_BYTE, 8, true), - - READ_FORMAT(GL_RED_INTEGER, GL_UNSIGNED_INT, 32, false), - READ_FORMAT(GL_RED_INTEGER, GL_INT, 32, true), - READ_FORMAT(GL_RED_INTEGER, GL_UNSIGNED_SHORT, 16, false), - READ_FORMAT(GL_RED_INTEGER, GL_SHORT, 16, true), - READ_FORMAT(GL_RED_INTEGER, GL_UNSIGNED_BYTE, 8, false), - READ_FORMAT(GL_RED_INTEGER, GL_BYTE, 8, true), - - READ_FORMAT(GL_GREEN_INTEGER, GL_UNSIGNED_INT, 32, false), - READ_FORMAT(GL_GREEN_INTEGER, GL_INT, 32, true), - READ_FORMAT(GL_GREEN_INTEGER, GL_UNSIGNED_SHORT, 16, false), - READ_FORMAT(GL_GREEN_INTEGER, GL_SHORT, 16, true), - READ_FORMAT(GL_GREEN_INTEGER, GL_UNSIGNED_BYTE, 8, false), - READ_FORMAT(GL_GREEN_INTEGER, GL_BYTE, 8, true), - - READ_FORMAT(GL_BLUE_INTEGER, GL_UNSIGNED_INT, 32, false), - READ_FORMAT(GL_BLUE_INTEGER, GL_INT, 32, true), - READ_FORMAT(GL_BLUE_INTEGER, GL_UNSIGNED_SHORT, 16, false), - READ_FORMAT(GL_BLUE_INTEGER, GL_SHORT, 16, true), - READ_FORMAT(GL_BLUE_INTEGER, GL_UNSIGNED_BYTE, 8, false), - READ_FORMAT(GL_BLUE_INTEGER, GL_BYTE, 8, true), - - READ_FORMAT(GL_ALPHA_INTEGER, GL_UNSIGNED_INT, 32, false), - READ_FORMAT(GL_ALPHA_INTEGER, GL_INT, 32, true), - READ_FORMAT(GL_ALPHA_INTEGER, GL_UNSIGNED_SHORT, 16, false), - READ_FORMAT(GL_ALPHA_INTEGER, GL_SHORT, 16, true), - READ_FORMAT(GL_ALPHA_INTEGER, GL_UNSIGNED_BYTE, 8, false), - READ_FORMAT(GL_ALPHA_INTEGER, GL_BYTE, 8, true), - - READ_FORMAT(GL_RG_INTEGER, GL_UNSIGNED_INT, 32, false), - READ_FORMAT(GL_RG_INTEGER, GL_INT, 32, true), - READ_FORMAT(GL_RG_INTEGER, GL_UNSIGNED_SHORT, 16, false), - READ_FORMAT(GL_RG_INTEGER, GL_SHORT, 16, true), - READ_FORMAT(GL_RG_INTEGER, GL_UNSIGNED_BYTE, 8, false), - READ_FORMAT(GL_RG_INTEGER, GL_BYTE, 8, true), - - READ_FORMAT(GL_RGB_INTEGER, GL_UNSIGNED_INT, 32, false), - READ_FORMAT(GL_RGB_INTEGER, GL_INT, 32, true), - READ_FORMAT(GL_RGB_INTEGER, GL_UNSIGNED_SHORT, 16, false), - READ_FORMAT(GL_RGB_INTEGER, GL_SHORT, 16, true), - READ_FORMAT(GL_RGB_INTEGER, GL_UNSIGNED_BYTE, 8, false), - READ_FORMAT(GL_RGB_INTEGER, GL_BYTE, 8, true), + { GL_RGBA_INTEGER, GL_UNSIGNED_INT, 32, false }, + { GL_RGBA_INTEGER, GL_INT, 32, true }, + { GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, 16, false }, + { GL_RGBA_INTEGER, GL_SHORT, 16, true }, + { GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, 8, false }, + { GL_RGBA_INTEGER, GL_BYTE, 8, true }, + + { GL_RED_INTEGER, GL_UNSIGNED_INT, 32, false }, + { GL_RED_INTEGER, GL_INT, 32, true }, + { GL_RED_INTEGER, GL_UNSIGNED_SHORT, 16, false }, + { GL_RED_INTEGER, GL_SHORT, 16, true }, + { GL_RED_INTEGER, GL_UNSIGNED_BYTE, 8, false }, + { GL_RED_INTEGER, GL_BYTE, 8, true }, + + { GL_GREEN_INTEGER, GL_UNSIGNED_INT, 32, false }, + { GL_GREEN_INTEGER, GL_INT, 32, true }, + { GL_GREEN_INTEGER, GL_UNSIGNED_SHORT, 16, false }, + { GL_GREEN_INTEGER, GL_SHORT, 16, true }, + { GL_GREEN_INTEGER, GL_UNSIGNED_BYTE, 8, false }, + { GL_GREEN_INTEGER, GL_BYTE, 8, true }, + + { GL_BLUE_INTEGER, GL_UNSIGNED_INT, 32, false }, + { GL_BLUE_INTEGER, GL_INT, 32, true }, + { GL_BLUE_INTEGER, GL_UNSIGNED_SHORT, 16, false }, + { GL_BLUE_INTEGER, GL_SHORT, 16, true }, + { GL_BLUE_INTEGER, GL_UNSIGNED_BYTE, 8, false }, + { GL_BLUE_INTEGER, GL_BYTE, 8, true }, + + { GL_ALPHA_INTEGER, GL_UNSIGNED_INT, 32, false }, + { GL_ALPHA_INTEGER, GL_INT, 32, true }, + { GL_ALPHA_INTEGER, GL_UNSIGNED_SHORT, 16, false }, + { GL_ALPHA_INTEGER, GL_SHORT, 16, true }, + { GL_ALPHA_INTEGER, GL_UNSIGNED_BYTE, 8, false }, + { GL_ALPHA_INTEGER, GL_BYTE, 8, true }, + + { GL_RG_INTEGER, GL_UNSIGNED_INT, 32, false }, + { GL_RG_INTEGER, GL_INT, 32, true }, + { GL_RG_INTEGER, GL_UNSIGNED_SHORT, 16, false }, + { GL_RG_INTEGER, GL_SHORT, 16, true }, + { GL_RG_INTEGER, GL_UNSIGNED_BYTE, 8, false }, + { GL_RG_INTEGER, GL_BYTE, 8, true }, + + { GL_RGB_INTEGER, GL_UNSIGNED_INT, 32, false }, + { GL_RGB_INTEGER, GL_INT, 32, true }, + { GL_RGB_INTEGER, GL_UNSIGNED_SHORT, 16, false }, + { GL_RGB_INTEGER, GL_SHORT, 16, true }, + { GL_RGB_INTEGER, GL_UNSIGNED_BYTE, 8, false }, + { GL_RGB_INTEGER, GL_BYTE, 8, true }, /* RGBA was put at the top so that the more obvious failures come first. */ - READ_FORMAT(GL_BGR_INTEGER, GL_UNSIGNED_INT, 32, false), - READ_FORMAT(GL_BGR_INTEGER, GL_INT, 32, true), - READ_FORMAT(GL_BGR_INTEGER, GL_UNSIGNED_SHORT, 16, false), - READ_FORMAT(GL_BGR_INTEGER, GL_SHORT, 16, true), - READ_FORMAT(GL_BGR_INTEGER, GL_UNSIGNED_BYTE, 8, false), - READ_FORMAT(GL_BGR_INTEGER, GL_BYTE, 8, true), + { GL_BGR_INTEGER, GL_UNSIGNED_INT, 32, false }, + { GL_BGR_INTEGER, GL_INT, 32, true }, + { GL_BGR_INTEGER, GL_UNSIGNED_SHORT, 16, false }, + { GL_BGR_INTEGER, GL_SHORT, 16, true }, + { GL_BGR_INTEGER, GL_UNSIGNED_BYTE, 8, false }, + { GL_BGR_INTEGER, GL_BYTE, 8, true }, - READ_FORMAT(GL_BGRA_INTEGER, GL_UNSIGNED_INT, 32, false), - READ_FORMAT(GL_BGRA_INTEGER, GL_INT, 32, true), - READ_FORMAT(GL_BGRA_INTEGER, GL_UNSIGNED_SHORT, 16, false), - READ_FORMAT(GL_BGRA_INTEGER, GL_SHORT, 16, true), - READ_FORMAT(GL_BGRA_INTEGER, GL_UNSIGNED_BYTE, 8, false), - READ_FORMAT(GL_BGRA_INTEGER, GL_BYTE, 8, true), + { GL_BGRA_INTEGER, GL_UNSIGNED_INT, 32, false }, + { GL_BGRA_INTEGER, GL_INT, 32, true }, + { GL_BGRA_INTEGER, GL_UNSIGNED_SHORT, 16, false }, + { GL_BGRA_INTEGER, GL_SHORT, 16, true }, + { GL_BGRA_INTEGER, GL_UNSIGNED_BYTE, 8, false }, + { GL_BGRA_INTEGER, GL_BYTE, 8, true }, /* FINISHME: Add more RGB10_A2UI. Note the other packed formats * besides 10/10/10/2 included in the spec! */ - READ_FORMAT(GL_RGBA_INTEGER, GL_UNSIGNED_INT_10_10_10_2, 32, false), - READ_FORMAT(GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, 32, false), + { GL_RGBA_INTEGER, GL_UNSIGNED_INT_10_10_10_2, 32, false }, + { GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, 32, false }, }; static bool test_rg = false; @@ -298,7 +294,9 @@ report_fail(const struct format_info *tex_info, int i; fprintf(stderr, "Failure reading from %s to %s/%s\n", - format_name, read_info->format_name, read_info->type_name); + format_name, + piglit_get_gl_enum_name(read_info->format), + piglit_get_gl_enum_name(read_info->type)); /* 10/channel + 3 spaces. */ fprintf(stderr, " %43s", "expected RGBA in texels"); @@ -437,7 +435,8 @@ read_format(const struct format_info *tex_info, printf("Reading from %s to %s/%s\n", name, - read_info->format_name, read_info->type_name); + piglit_get_gl_enum_name(read_info->format), + piglit_get_gl_enum_name(read_info->type)); expected = (char *)malloc(texels_size); read = (char *)malloc(texels_size); diff --git a/tests/spec/glsl-1.50/execution/geometry/primitive-id-restart.c b/tests/spec/glsl-1.50/execution/geometry/primitive-id-restart.c index c83f2fd41..e3ee88784 100644 --- a/tests/spec/glsl-1.50/execution/geometry/primitive-id-restart.c +++ b/tests/spec/glsl-1.50/execution/geometry/primitive-id-restart.c @@ -112,24 +112,20 @@ static const char *varyings[] = { "primitive_id" }; struct prim_type_info { - const char *name; GLenum prim_type; const char *input_layout; } prim_types[] = { -#define PRIM_TYPE(prim_type, input_layout) \ - { #prim_type, prim_type, input_layout } - PRIM_TYPE(GL_POINTS, "points"), - PRIM_TYPE(GL_LINE_LOOP, "lines"), - PRIM_TYPE(GL_LINE_STRIP, "lines"), - PRIM_TYPE(GL_LINES, "lines"), - PRIM_TYPE(GL_TRIANGLES, "triangles"), - PRIM_TYPE(GL_TRIANGLE_STRIP, "triangles"), - PRIM_TYPE(GL_TRIANGLE_FAN, "triangles"), - PRIM_TYPE(GL_LINES_ADJACENCY, "lines_adjacency"), - PRIM_TYPE(GL_LINE_STRIP_ADJACENCY, "lines_adjacency"), - PRIM_TYPE(GL_TRIANGLES_ADJACENCY, "triangles_adjacency"), - PRIM_TYPE(GL_TRIANGLE_STRIP_ADJACENCY, "triangles_adjacency"), -#undef PRIM_TYPE + { GL_POINTS, "points" }, + { GL_LINE_LOOP, "lines" }, + { GL_LINE_STRIP, "lines" }, + { GL_LINES, "lines" }, + { GL_TRIANGLES, "triangles" }, + { GL_TRIANGLE_STRIP, "triangles" }, + { GL_TRIANGLE_FAN, "triangles" }, + { GL_LINES_ADJACENCY, "lines_adjacency" }, + { GL_LINE_STRIP_ADJACENCY, "lines_adjacency" }, + { GL_TRIANGLES_ADJACENCY, "triangles_adjacency" }, + { GL_TRIANGLE_STRIP_ADJACENCY, "triangles_adjacency" }, }; @@ -140,7 +136,8 @@ print_usage_and_exit(const char *prog_name) printf("Usage: %s <primitive> <restart-index>\n" " where <primitive> is one of the following:\n", prog_name); for(i = 0; i < ARRAY_SIZE(prim_types); i++) - printf(" %s\n", prim_types[i].name); + printf(" %s\n", + piglit_get_prim_name(prim_types[i].prim_type)); printf(" and <restart-index> is one of the following:\n" " ffs - use a primitive restart index that is all 0xffs\n" " other - use a different primitive restart index\n"); @@ -167,7 +164,8 @@ piglit_init(int argc, char **argv) if (argc != 3) print_usage_and_exit(argv[0]); for (i = 0; i < ARRAY_SIZE(prim_types); i++) { - if (strcmp(argv[1], prim_types[i].name) == 0) { + if (strcmp(piglit_get_prim_name(prim_types[i].prim_type), + argv[1]) == 0) { prim_type = prim_types[i].prim_type; input_layout = prim_types[i].input_layout; break; diff --git a/tests/spec/glsl-1.50/execution/geometry/primitive-types.c b/tests/spec/glsl-1.50/execution/geometry/primitive-types.c index 88e88283b..d243e7025 100644 --- a/tests/spec/glsl-1.50/execution/geometry/primitive-types.c +++ b/tests/spec/glsl-1.50/execution/geometry/primitive-types.c @@ -272,31 +272,25 @@ static const struct test_vector triangle_strip_adjacency_tests[] = { static const struct test_set { - const char *name; GLenum prim_type; const char *input_layout; unsigned vertices_per_prim; - unsigned num_test_vectors; const struct test_vector *test_vectors; } tests[] = { -#define TEST(prim_type, input_layout, vertices_per_prim, test_array) \ - { #prim_type, prim_type, input_layout, vertices_per_prim, \ - ARRAY_SIZE(test_array), test_array } - TEST(GL_POINTS, "points", 1, points_tests), - TEST(GL_LINE_LOOP, "lines", 2, line_loop_tests), - TEST(GL_LINE_STRIP, "lines", 2, line_strip_tests), - TEST(GL_LINES, "lines", 2, lines_tests), - TEST(GL_TRIANGLES, "triangles", 3, triangles_tests), - TEST(GL_TRIANGLE_STRIP, "triangles", 3, triangle_strip_tests), - TEST(GL_TRIANGLE_FAN, "triangles", 3, triangle_fan_tests), - TEST(GL_LINES_ADJACENCY, "lines_adjacency", 4, lines_adjacency_tests), - TEST(GL_LINE_STRIP_ADJACENCY, "lines_adjacency", 4, - line_strip_adjacency_tests), - TEST(GL_TRIANGLES_ADJACENCY, "triangles_adjacency", 6, - triangles_adjacency_tests), - TEST(GL_TRIANGLE_STRIP_ADJACENCY, "triangles_adjacency", 6, - triangle_strip_adjacency_tests), -#undef TEST + { GL_POINTS, "points", 1, points_tests }, + { GL_LINE_LOOP, "lines", 2, line_loop_tests }, + { GL_LINE_STRIP, "lines", 2, line_strip_tests }, + { GL_LINES, "lines", 2, lines_tests }, + { GL_TRIANGLES, "triangles", 3, triangles_tests }, + { GL_TRIANGLE_STRIP, "triangles", 3, triangle_strip_tests }, + { GL_TRIANGLE_FAN, "triangles", 3, triangle_fan_tests }, + { GL_LINES_ADJACENCY, "lines_adjacency", 4, lines_adjacency_tests }, + { GL_LINE_STRIP_ADJACENCY, "lines_adjacency", 4, + line_strip_adjacency_tests }, + { GL_TRIANGLES_ADJACENCY, "triangles_adjacency", 6, + triangles_adjacency_tests }, + { GL_TRIANGLE_STRIP_ADJACENCY, "triangles_adjacency", 6, + triangle_strip_adjacency_tests }, }; @@ -310,7 +304,7 @@ print_usage_and_exit(const char *prog_name) printf("Usage: %s <primitive>\n" " where <primitive> is one of the following:\n", prog_name); for (i = 0; i < ARRAY_SIZE(tests); i++) - printf(" %s\n", tests[i].name); + printf(" %s\n", piglit_get_prim_name(tests[i].prim_type)); piglit_report_result(PIGLIT_FAIL); } @@ -325,7 +319,8 @@ do_test_vector(const struct test_set *test, const struct test_vector *vector) unsigned actual_output_points; bool pass = true; - printf("Testing %s(%d vertices)\n", test->name, + printf("Testing %s(%d vertices)\n", + piglit_get_prim_name(tests->prim_type), vector->num_input_vertices); /* Run vertices through the pipeline */ @@ -385,7 +380,8 @@ piglit_init(int argc, char **argv) if (argc != 2) print_usage_and_exit(argv[0]); for (i = 0; i < ARRAY_SIZE(tests); i++) { - if (strcmp(argv[1], tests[i].name) == 0) { + if (strcmp(piglit_get_prim_name(tests[i].prim_type), + argv[1]) == 0) { test = &tests[i]; break; } @@ -420,7 +416,7 @@ piglit_init(int argc, char **argv) glGenQueries(1, &generated_query); glEnable(GL_RASTERIZER_DISCARD); - for (i = 0; i < test->num_test_vectors; i++) { + for (i = 0; i < ARRAY_SIZE(test->test_vectors); i++) { pass = do_test_vector(test, &test->test_vectors[i]) && pass; } |