[Piglit] [PATCH piglit] glsl-1.50: fix glsl-1.50-geometry-primitive-types

Lionel Landwerlin lionel.g.landwerlin at intel.com
Tue Jun 12 09:13:19 UTC 2018


On 11/06/18 18:38, Eric Engestrom wrote:
> ARRAY_SIZE() on a pointer results in `sizeof(pointer) / sizeof(pointer)`,
> which means the loop only ever executed the first test.
>
> Effectively revert most of fc189b7ff1160e3adc067 for this file to fix it.
>
> Fixes: fc189b7ff1160e3adc067 "Remove GLenum stringification macros."
> Cc: Fabian Bieler <fabianbieler at fastmail.fm>
> Cc: Brian Paul <brianp at vmware.com>
> Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

> ---
>   .../execution/geometry/primitive-types.c      | 35 +++++++++++--------
>   1 file changed, 20 insertions(+), 15 deletions(-)
>
> 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 d243e70251daab331365..4be5332be10753491dfd 100644
> --- a/tests/spec/glsl-1.50/execution/geometry/primitive-types.c
> +++ b/tests/spec/glsl-1.50/execution/geometry/primitive-types.c
> @@ -275,22 +275,27 @@ static const struct test_set
>   	GLenum prim_type;
>   	const char *input_layout;
>   	unsigned vertices_per_prim;
> +	unsigned num_test_vectors;
>   	const struct test_vector *test_vectors;
>   } tests[] = {
> -	{ 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 },
> +#define TEST(prim_type, input_layout, vertices_per_prim, test_array) \
> +	{ 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
>   };
>   
>   
> @@ -416,7 +421,7 @@ piglit_init(int argc, char **argv)
>   	glGenQueries(1, &generated_query);
>   	glEnable(GL_RASTERIZER_DISCARD);
>   
> -	for (i = 0; i < ARRAY_SIZE(test->test_vectors); i++) {
> +	for (i = 0; i < test->num_test_vectors; i++) {
>   		pass = do_test_vector(test, &test->test_vectors[i]) && pass;
>   	}
>   




More information about the Piglit mailing list