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 <fabianbie...@fastmail.fm>
Cc: Brian Paul <bri...@vmware.com>
Signed-off-by: Eric Engestrom <eric.engest...@intel.com>

Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@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;
        }


_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to