[Piglit] [PATCH 06/18] arb_geometry_shader4: Test valid output primitives.

Paul Berry stereotype441 at gmail.com
Sat Jun 15 22:42:07 PDT 2013


Sorry for the delay--I've been travelling.

On 7 June 2013 21:15, Fabian Bieler <fabianbieler at fastmail.fm> wrote:

> Test that glProgramParameter() triggers the required errors.
>
> The geometry shader output primitive type is limited to a subset
> of OpenGL primitive types.
>
> >From the ARB_geometry_shader4 spec (section Errors):
> "The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is
> GEOMETRY_OUTPUT_TYPE_ARB and <value> is not one of POINTS, LINE_STRIP or
> TRIANGLE_STRIP."
> ---
>  tests/all.tests                                    |  1 +
>  .../execution/program-parameter/CMakeLists.gl.txt  |  1 +
>  .../execution/program-parameter/output-type.c      | 87
> ++++++++++++++++++++++
>  3 files changed, 89 insertions(+)
>  create mode 100644
> tests/spec/arb_geometry_shader4/execution/program-parameter/output-type.c
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 897542e..f21666a 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -2298,6 +2298,7 @@ add_plain_test(arb_map_buffer_alignment,
> 'arb_map_buffer_alignment-sanity_test')
>
>  arb_geometry_shader4 = Group()
>  add_concurrent_test(arb_geometry_shader4, 'program-parameter-input-type')
> +add_concurrent_test(arb_geometry_shader4, 'program-parameter-output-type')
>  spec['ARB_geometry_shader4'] = arb_geometry_shader4
>  add_shader_test_dir(spec['ARB_geometry_shader4'],
>                      os.path.join(testsDir, 'spec',
> 'arb_geometry_shader4'),
> diff --git
> a/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt
> b/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt
> index 786eb31..aee7a98 100644
> ---
> a/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt
> +++
> b/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt
> @@ -11,3 +11,4 @@ link_libraries (
>  )
>
>  piglit_add_executable (program-parameter-input-type input-type.c)
> +piglit_add_executable (program-parameter-output-type output-type.c)
> diff --git
> a/tests/spec/arb_geometry_shader4/execution/program-parameter/output-type.c
> b/tests/spec/arb_geometry_shader4/execution/program-parameter/output-type.c
> new file mode 100644
> index 0000000..66d57ab
> --- /dev/null
> +++
> b/tests/spec/arb_geometry_shader4/execution/program-parameter/output-type.c
> @@ -0,0 +1,87 @@
> +/*
> + * 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 output-type.c
> + *
> + * Test required errors for wrong GL_GEOMETRY_OUTPUT_TYPE parameters.
> + */
> +
> +#include "common.h"
> +
> +
> +static const struct primitive_geom_info primitives_out[] = {
> +       {GL_POINTS, GL_NO_ERROR},
> +
> +       {GL_LINES, GL_INVALID_VALUE},
> +       {GL_LINE_STRIP, GL_NO_ERROR},
> +       {GL_LINE_LOOP, GL_INVALID_VALUE},
> +
> +       {GL_TRIANGLES, GL_INVALID_VALUE},
> +       {GL_TRIANGLE_STRIP, GL_NO_ERROR},
> +       {GL_TRIANGLE_FAN, GL_INVALID_VALUE},
> +
> +       {GL_LINES_ADJACENCY, GL_INVALID_VALUE},
> +       {GL_LINE_STRIP_ADJACENCY, GL_INVALID_VALUE},
> +
> +       {GL_TRIANGLES_ADJACENCY, GL_INVALID_VALUE},
> +       {GL_TRIANGLE_STRIP_ADJACENCY, GL_INVALID_VALUE},
> +
> +       {GL_QUADS, GL_INVALID_VALUE},
> +       {GL_QUAD_STRIP, GL_INVALID_VALUE},
> +       {GL_POLYGON, GL_INVALID_VALUE},
> +};
> +
> +
> +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
> +
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       bool pass = true;
> +       GLuint prog;
> +       int i;
>

This test needs

piglit_require_extension("GL_ARB_geometry_shader4");

With that change, this patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


> +
> +       /* Create shader. */
> +       prog = create_shader(vs_text, gs_text4, fs_text4);
> +
> +       for (i = 0; i < ARRAY_SIZE(primitives_out); i++) {
> +               const struct primitive_geom_info p = primitives_out[i];
> +               printf("Testing %s.\n", piglit_get_prim_name(p.type));
> +               glProgramParameteri(prog, GL_GEOMETRY_OUTPUT_TYPE_ARB,
> p.type);
> +               pass = piglit_check_gl_error(p.error) && pass;
> +       }
> +
> +       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +       /* Should never be reached */
> +       return 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/20130616/c1cfa9f4/attachment.html>


More information about the Piglit mailing list