[Piglit] [PATCH 12/18] arb_geometry_shader4: Test that adjacent vertices are ignored when no geometry shader is active.

Paul Berry stereotype441 at gmail.com
Sun Jun 16 21:46:35 PDT 2013


On 24 May 2013 19:49, Fabian Bieler <fabianbieler at fastmail.fm> wrote:

> Draw the adjacency version of a primitive in red and blend the normal
> version
> of that primitive in green on top of it. Check that the entire framebuffer
> is
> yellow or black.
>
> ARB_geometry_shader4 spec 2.6.1:
> "If a geometry shader is not active, the "adjacent" vertices are ignored."
> ---
>  tests/all.tests                                    |   2 +
>  .../execution/CMakeLists.gl.txt                    |  14 ++
>  .../execution/ignore-adjacent-vertices-indexed.c   | 223
> +++++++++++++++++++++
>  .../execution/ignore-adjacent-vertices.c           | 218
> ++++++++++++++++++++
>  4 files changed, 457 insertions(+)
>  create mode 100644
> tests/spec/arb_geometry_shader4/execution/CMakeLists.gl.txt
>  create mode 100644
> tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices-indexed.c
>  create mode 100644
> tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices.c
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 785c864..294c2b6 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -2297,6 +2297,8 @@ spec['ARB_map_buffer_alignment'] =
> arb_map_buffer_alignment
>  add_plain_test(arb_map_buffer_alignment,
> 'arb_map_buffer_alignment-sanity_test')
>
>  arb_geometry_shader4 = Group()
> +add_concurrent_test(arb_geometry_shader4, 'ignore-adjacent-vertices')
> +add_concurrent_test(arb_geometry_shader4,
> 'ignore-adjacent-vertices-indexed')
>  add_concurrent_test(arb_geometry_shader4, 'program-parameter-input-type')
>  add_concurrent_test(arb_geometry_shader4,
> 'program-parameter-input-type-draw')
>  add_concurrent_test(arb_geometry_shader4, 'program-parameter-output-type')
> diff --git a/tests/spec/arb_geometry_shader4/execution/CMakeLists.gl.txt
> b/tests/spec/arb_geometry_shader4/execution/CMakeLists.gl.txt
> new file mode 100644
> index 0000000..8a370b9
> --- /dev/null
> +++ b/tests/spec/arb_geometry_shader4/execution/CMakeLists.gl.txt
> @@ -0,0 +1,14 @@
> +include_directories(
> +       ${GLEXT_INCLUDE_DIR}
> +       ${OPENGL_INCLUDE_PATH}
> +       ${piglit_SOURCE_DIR}/tests/util
> +)
> +
> +link_libraries (
> +       piglitutil_${piglit_target_api}
> +       ${OPENGL_gl_LIBRARY}
> +       ${OPENGL_glu_LIBRARY}
> +)
> +
> +piglit_add_executable (ignore-adjacent-vertices
> ignore-adjacent-vertices.c)
> +piglit_add_executable (ignore-adjacent-vertices-indexed
> ignore-adjacent-vertices-indexed.c)
> diff --git
> a/tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices-indexed.c
> b/tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices-indexed.c
> new file mode 100644
> index 0000000..2ddee13
> --- /dev/null
> +++
> b/tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices-indexed.c
> @@ -0,0 +1,223 @@
> +/*
> + * Copyright © 2013 The Piglit project
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> "Software"),
> + * to deal in the Software without restriction, including without
> limitation
> + * the rights to use, copy, modify, merge, publish, distribute,
> sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> next
> + * paragraph) shall be included in all copies or substantial portions of
> the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
> SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/**
> + * \file ignore-adjacent-vertices-indexed.c
> + *
> + * Test that adjacent vertices are ignored when no geometry shader is
> active.
> + * Draw the adjacency primitive in red and blend the non adjacency
> version in
> + * green on top of it. Then test that the entire framebuffer is either
> yellow
> + * or black.
>

I really like this yellow/black idea.  Previously we have done this sort of
test by drawing images on the left and right side of the window and then
using piglit_probe_rect_halves_equal_rgba() to check that they're the same,
but that has two problems: (1) sometimes rounding errors in the GPU cause
slight variations between the two halves, which leads to false failures.
(2) when there are subtle differences between the left and right halves,
it's difficult to spot the differences visually, making debugging hard.
Your yellow/black technique neatly addresses both of these problems.

You might want to consider giving check_framebuffer() a more descriptive
name and moving it into tests/util/piglit-util-gl-common.c so that it can
be used by other tests.


> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +struct primitives {
> +       GLenum type_adjacency;
> +       int count_adjacency;
> +       GLenum type_base;
> +       int count_base;
> +};
> +
> +static const char vs_text[] =
> +       "void main()\n"
> +       "{\n"
> +       "       gl_Position = ftransform();\n"
>

I'm not thrilled with the use of ftransform() here, since it's only
available in compatibility profiles.  Most piglit tests require
compatibility profiles, but we're trying to gradually move ourselves away
from that.

Considering Brian's comments about fragility with resizes, and my comments
below about x_3, y_3, x2_3, and y2_3, I'd recommend just doing this instead:

attribute vec4 vertex;
void main()
{
  gl_Position = vertex;
}

>
> +       "}\n";
> +
> +static const char fs_text[] =
> +       "uniform vec4 color;\n"
> +       "void main()\n"
> +       "{\n"
> +       "       gl_FragColor = color;\n"
> +       "}\n";
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +       config.supports_gl_compat_version = 20;
> +       config.window_visual = PIGLIT_GL_VISUAL_DOUBLE |
> PIGLIT_GL_VISUAL_RGBA;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +GLuint color_uniform;
> +
> +/* Check that the framebuffer is yellow and black. */
> +static bool
> +check_framebuffer(void)
> +{
> +       static uint32_t* buffer = 0;
> +       int y, x;
> +       if (!buffer) buffer = malloc(sizeof(uint32_t) * piglit_width *
> piglit_height);
> +
> +       glReadPixels(0, 0, piglit_width, piglit_height, GL_RGBA,
> GL_UNSIGNED_INT_8_8_8_8, buffer);
> +
> +       for (y = 0; y < piglit_height; ++y) {
> +               for (x = 0; x < piglit_width; ++x) {
> +                       uint32_t val = buffer[y * piglit_width + x] &
> 0xFFFFFF00;
>

This looks like it will only work on little-endian systems.  Piglit
sometimes gets run on big-endian systems, so I would recommend changing
buffer to a GL_uchar * and just explicitly checking each color channel
individually.


> +
> +                       if (val != 0 && val != 0xFFFF0000) {
> +                               fprintf(stderr, "FAIL: Rendered primitives
> differ.\n");
> +                               return false;
> +                       }
> +               }
> +       }
> +
> +       return true;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       GLuint array_bufs[2];
> +       GLuint array;
> +       GLuint vs, fs, prog;
> +       const int w = piglit_width;
> +       const int h = piglit_height;
> +       const float x_3 = (int)(w / 3.0) + 0.5;
> +       const float y_3 = (int)(h / 3.0) + 0.5;
> +       const float x2_3 = (int)(w * 2.0 / 3.0) + 0.5;
> +       const float y2_3 = (int)(h * 2.0 / 3.0) + 0.5;
> +       const float vertex_data[] = {
> +               0, h, x_3, h, x2_3, h, w, h,
> +               0, y2_3, x_3, y2_3, x2_3, y2_3, w, y2_3,
> +               0, y_3, x_3, y_3, x2_3, y_3, w, y_3,
> +               0, 0, x_3, 0, x2_3, 0, w, 0,
> +       };
>

I find x_3, y_3, x2_3, and y2_3 unnecessarily confusing.  Instead of using
piglit_ortho_projection(), why not just specify the coordinates in clip
coordinates (the units used by gl_Position), which are already relative to
the window?  Then this would just reduce to:

const float vertex_data[] = {
  -1, 1,
  -1/3.0, 1,
  1/3.0, 1,
  1, 1,
  -1, 1/3.0,
  ...

(Note: this would result in a slightly different image being drawn, because
it doesn't round the coordinates to the nearest pixel.  But that's
fine--there should be no need to round to the nearest pixel).


> +       const unsigned short index_data[] = {
> +               /* lines_adjacency */
> +               4, 5, 6, 7, 8, 9, 10, 11,
> +
> +               /* lines */
> +               5, 6, 9, 10,
> +
> +               /* line_strip_adjacency */
> +               4, 5, 6, 10, 9, 8,
> +
> +               /* line_strip */
> +               5, 6, 10, 9,
> +
> +               /* triangles_adjacency */
> +               9, 4, 5, 6, 10, 14, 6, 11, 10, 9, 5, 1,
> +
> +               /* triangles */
> +               9, 5, 10, 6, 10, 5,
> +
> +               /* triangle_strip_adjacency */
> +               9, 4, 5, 14, 10, 1, 6, 11,
> +
> +               /* triangle_strip */
> +               9, 5, 10, 6,
> +       };
>

Nit pick: uploading a single index buffer containing all the test cases
makes this test a little hard to follow.  I'd recommend just uploading
fresh index data before each draw call.


> +
> +       /* Bind Vertex Data */
> +       glGenVertexArrays(1, &array);
> +       glBindVertexArray(array);
> +       glGenBuffers(2, array_bufs);
> +       glBindBuffer(GL_ARRAY_BUFFER, array_bufs[0]);
> +       glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data),
> +                    vertex_data, GL_STREAM_DRAW);
> +       glVertexPointer(2, GL_FLOAT, 0, NULL);
>

glVertexPointer is also compatibility-mode only.  Can we use a generic
attribute instead (glVertexAttribPointer/glEnableVertexAttribArray)?


> +       glBindBuffer(GL_ARRAY_BUFFER, 0);
> +       glEnableClientState(GL_VERTEX_ARRAY);
> +
> +       glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, array_bufs[1]);
> +       glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(index_data),
> +                    index_data, GL_STREAM_DRAW);
> +
> +       /* Create shader. */
> +       prog = glCreateProgram();
> +       vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
> +       fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
> +       glAttachShader(prog, vs);
> +       glAttachShader(prog, fs);
> +       glDeleteShader(vs);
> +       glDeleteShader(fs);
> +       glLinkProgram(prog);
> +       if (!piglit_link_check_status(prog) ||
> +           !piglit_check_gl_error(GL_NO_ERROR)) {
> +               piglit_report_result(PIGLIT_FAIL);
> +       }
> +       color_uniform = glGetUniformLocation(prog, "color");
> +       glUseProgram(prog);
> +
> +       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
> +
> +       /* Enable blending. */
> +       glEnable(GL_BLEND);
> +       glBlendEquation(GL_FUNC_ADD);
> +       glBlendFunc(GL_ONE, GL_ONE);
> +}
> +
> +static bool
> +run_test(const struct primitives test, int *first)
> +{
> +       const float red[] = {1, 0, 0, 1};
> +       const float green[] = {0, 1, 0, 1};
> +       bool pass = true;
> +
> +       printf("Testing %s and %s.\n",
> piglit_get_prim_name(test.type_adjacency),
> +
>  piglit_get_prim_name(test.type_base));
> +
> +       glClear(GL_COLOR_BUFFER_BIT);
> +
> +       /* Draw adjacency primitive red. */
> +       glUniform4fv(color_uniform, 1, red);
> +       glDrawElements(test.type_adjacency, test.count_adjacency,
> GL_UNSIGNED_SHORT, NULL + *first * 2);
> +       *first += test.count_adjacency;
> +
> +       /* Draw normal primitive green. */
> +       glUniform4fv(color_uniform, 1, green);
> +       glDrawElements(test.type_base, test.count_base, GL_UNSIGNED_SHORT,
> NULL + *first * 2);
> +       *first += test.count_base;
> +
> +       pass = check_framebuffer() && pass;
> +       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
> +
> +       return pass;
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +       bool pass = true;
> +       int first = 0;
> +       int i = 0;
> +       const struct primitives tests[] = {
> +               {GL_LINES_ADJACENCY, 8, GL_LINES, 4},
> +               {GL_LINE_STRIP_ADJACENCY, 6, GL_LINE_STRIP, 4},
> +               {GL_TRIANGLES_ADJACENCY, 12, GL_TRIANGLES, 6},
> +               {GL_TRIANGLE_STRIP_ADJACENCY, 8, GL_TRIANGLE_STRIP, 4},
> +       };
> +
> +       for (i = 0; i < ARRAY_SIZE(tests); i++) {
> +               pass = run_test(tests[i], &first) && pass;
> +
> +               if (!piglit_automatic && !pass) {
> +                       piglit_present_results();
> +                       return PIGLIT_FAIL;
> +               }
> +       }
>

This loop is going to make the test much harder to debug visually, since
running the test in manual mode will only show the TRIANGLE_STRIP_ADJACENCY
test.  I'd recommend breaking this up into 4 sub-tests which are selectable
by a command line parameter.


> +
> +       if (!piglit_automatic)
> +               piglit_present_results();
> +
> +       return (pass ? PIGLIT_PASS : PIGLIT_FAIL);
> +}
> diff --git
> a/tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices.c
> b/tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices.c
> new file mode 100644
> index 0000000..6136151
> --- /dev/null
> +++ b/tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices.c
>

I'm not comfortable with the amount of code duplication between this file
and the previous.  I'd recommend either:

(a) consolidate the two variations of the test into a single .c file, and
select whether the test uses DrawElements or DrawArrays using a
command-line parameter.  Or:

(b) it seems highly unlikely that an implementation would have a bug
causing it to get DrawElements right but DrawArrays wrong, or vice versa.
I think it would be ok to just eliminate ignore-adjacent-vertices.c
entirely and let ignore-adjacent-vertices-indexed.c be the only test of
this behaviour.


> @@ -0,0 +1,218 @@
> +/*
> + * Copyright © 2013 The Piglit project
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> "Software"),
> + * to deal in the Software without restriction, including without
> limitation
> + * the rights to use, copy, modify, merge, publish, distribute,
> sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> next
> + * paragraph) shall be included in all copies or substantial portions of
> the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
> SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/**
> + * \file ignore-adjacent-vertices.c
> + *
> + * Test that adjacent vertices are ignored when no geometry shader is
> active.
> + * Draw the adjacency primitive in red and blend the non adjacency
> version in
> + * green on top of it. Then test that the entire framebuffer is either
> yellow
> + * or black.
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +struct primitives {
> +       GLenum type_adjacency;
> +       int count_adjacency;
> +       GLenum type_base;
> +       int count_base;
> +};
> +
> +static const char vs_text[] =
> +       "void main()\n"
> +       "{\n"
> +       "       gl_Position = ftransform();\n"
> +       "}\n";
> +
> +static const char fs_text[] =
> +       "uniform vec4 color;\n"
> +       "void main()\n"
> +       "{\n"
> +       "       gl_FragColor = color;\n"
> +       "}\n";
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +       config.supports_gl_compat_version = 20;
> +       config.window_visual = PIGLIT_GL_VISUAL_DOUBLE |
> PIGLIT_GL_VISUAL_RGBA;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +GLuint color_uniform;
> +
> +/* Check that the framebuffer is yellow and black. */
> +static bool
> +check_framebuffer(void)
> +{
> +       static uint32_t* buffer = 0;
> +       int y, x;
> +       if (!buffer) buffer = malloc(sizeof(uint32_t) * piglit_width *
> piglit_height);
> +
> +       glReadPixels(0, 0, piglit_width, piglit_height, GL_RGBA,
> GL_UNSIGNED_INT_8_8_8_8, buffer);
> +
> +       for (y = 0; y < piglit_height; ++y) {
> +               for (x = 0; x < piglit_width; ++x) {
> +                       uint32_t val = buffer[y * piglit_width + x] &
> 0xFFFFFF00;
> +
> +                       if (val != 0 && val != 0xFFFF0000) {
> +                               fprintf(stderr, "FAIL: Rendered primitives
> differ.\n");
> +                               return false;
> +                       }
> +               }
> +       }
> +
> +       return true;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       GLuint array_buf;
> +       GLuint array;
> +       GLuint vs, fs, prog;
> +       const int w = piglit_width;
> +       const int h = piglit_height;
> +       const float x_3 = (int)(w / 3.0) + 0.5;
> +       const float y_3 = (int)(h / 3.0) + 0.5;
> +       const float x2_3 = (int)(w * 2.0 / 3.0) + 0.5;
> +       const float y2_3 = (int)(h * 2.0 / 3.0) + 0.5;
> +       const float vertex_data[] = {
> +               /* lines_adjacency */
> +               0, y2_3, x_3, y2_3, x2_3, y2_3, w, y2_3,
> +               0, y_3, x_3, y_3, x2_3, y_3, w, y_3,
> +
> +               /* lines */
> +               x_3, y2_3, x2_3, y2_3,
> +               x_3, y_3, x2_3, y_3,
> +
> +               /* line_strip_adjacency */
> +               0, y2_3, x_3, y2_3, x2_3, y2_3,
> +               x2_3, y_3, x_3, y_3, 0, y_3,
> +
> +               /* line_strip */
> +               x_3, y2_3, x2_3, y2_3, x2_3, y_3, x_3, y_3,
> +
> +               /* triangles_adjacency */
> +               x_3, y_3, 0, y2_3, x_3, y2_3, x2_3, y2_3, x2_3, y_3, x2_3,
> 0,
> +               x2_3, y2_3, w, y_3, x2_3, y_3, x_3, y_3, x_3, y2_3, x_3, h,
> +
> +               /* triangles */
> +               x_3, y_3, x_3, y2_3, x2_3, y_3,
> +               x2_3, y2_3, x2_3, y_3, x_3, y2_3,
> +
> +               /* triangle_strip_adjacency */
> +               x_3, y_3, 0, y2_3, x_3, y2_3, x2_3, 0, x2_3, y_3, x_3, h,
> x2_3, y2_3, w, y_3,
> +
> +               /* triangle_strip */
> +               x_3, y_3, x_3, y2_3, x2_3, y_3, x2_3, y2_3,
> +       };
> +
> +       /* Bind Vertex Data */
> +       glGenVertexArrays(1, &array);
> +       glBindVertexArray(array);
> +       glGenBuffers(1, &array_buf);
> +       glBindBuffer(GL_ARRAY_BUFFER, array_buf);
> +       glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data),
> +                    vertex_data, GL_STREAM_DRAW);
> +       glVertexPointer(2, GL_FLOAT, 0, NULL);
> +       glEnableClientState(GL_VERTEX_ARRAY);
> +       glBindBuffer(GL_ARRAY_BUFFER, 0);
> +
> +       /* Create shader. */
> +       prog = glCreateProgram();
> +       vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
> +       fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
> +       glAttachShader(prog, vs);
> +       glAttachShader(prog, fs);
> +       glDeleteShader(vs);
> +       glDeleteShader(fs);
> +       glLinkProgram(prog);
> +       if (!piglit_link_check_status(prog) ||
> +           !piglit_check_gl_error(GL_NO_ERROR)) {
> +               piglit_report_result(PIGLIT_FAIL);
> +       }
> +       color_uniform = glGetUniformLocation(prog, "color");
> +       glUseProgram(prog);
> +
> +       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
> +
> +       /* Enable blending. */
> +       glEnable(GL_BLEND);
> +       glBlendEquation(GL_FUNC_ADD);
> +       glBlendFunc(GL_ONE, GL_ONE);
> +}
> +
> +static bool
> +run_test(const struct primitives test, int *first)
> +{
> +       const float red[] = {1, 0, 0, 1};
> +       const float green[] = {0, 1, 0, 1};
> +       bool pass = true;
> +
> +       printf("Testing %s and %s.\n",
> piglit_get_prim_name(test.type_adjacency),
> +
>  piglit_get_prim_name(test.type_base));
> +
> +       glClear(GL_COLOR_BUFFER_BIT);
> +
> +       /* Draw adjacency primitive red. */
> +       glUniform4fv(color_uniform, 1, red);
> +       glDrawArrays(test.type_adjacency, *first, test.count_adjacency);
> +       *first += test.count_adjacency;
> +
> +       /* Draw normal primitive green. */
> +       glUniform4fv(color_uniform, 1, green);
> +       glDrawArrays(test.type_base, *first, test.count_base);
> +       *first += test.count_base;
> +
> +       pass = check_framebuffer() && pass;
> +       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
> +
> +       return pass;
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +       bool pass = true;
> +       int first = 0;
> +       int i = 0;
> +       const struct primitives tests[] = {
> +               {GL_LINES_ADJACENCY, 8, GL_LINES, 4},
> +               {GL_LINE_STRIP_ADJACENCY, 6, GL_LINE_STRIP, 4},
> +               {GL_TRIANGLES_ADJACENCY, 12, GL_TRIANGLES, 6},
> +               {GL_TRIANGLE_STRIP_ADJACENCY, 8, GL_TRIANGLE_STRIP, 4},
> +       };
> +
> +       for (i = 0; i < ARRAY_SIZE(tests); i++) {
> +               pass = run_test(tests[i], &first) && pass;
> +
> +               if (!piglit_automatic && !pass) {
> +                       piglit_present_results();
> +                       return PIGLIT_FAIL;
> +               }
> +       }
> +
> +       if (!piglit_automatic)
> +               piglit_present_results();
> +
> +       return (pass ? PIGLIT_PASS : PIGLIT_FAIL);
> +}
> --
> 1.8.1.2
>
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130617/50c4f698/attachment-0001.html>


More information about the Piglit mailing list