[Piglit] [PATCH] arb_explicit_uniform_location: test unused location

Anuj Phogat anuj.phogat at gmail.com
Thu Aug 28 12:24:11 PDT 2014


On Thu, Aug 28, 2014 at 1:05 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
> add a test for unused location when explicit locations are in use.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>  tests/all.py                                       |  1 +
>  .../CMakeLists.gl.txt                              |  1 +
>  .../use-of-unused-loc.c                            | 74 ++++++++++++++++++++++
>  3 files changed, 76 insertions(+)
>  create mode 100644 tests/spec/arb_explicit_uniform_location/use-of-unused-loc.c
>
> diff --git a/tests/all.py b/tests/all.py
> index 20ebec2..7ff3d1e 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2127,6 +2127,7 @@ add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-min
>  add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-boundaries')
>  add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-array-elements')
>  add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-inactive-uniform')
> +add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-use-of-unused-loc')
>
>  arb_texture_buffer_object = {}
>  spec['ARB_texture_buffer_object'] = arb_texture_buffer_object
> diff --git a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
> index 1a8488c..8ba0ab6 100644
> --- a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
> +++ b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
> @@ -13,3 +13,4 @@ piglit_add_executable (arb_explicit_uniform_location-minmax minmax.c)
>  piglit_add_executable (arb_explicit_uniform_location-boundaries loc-boundaries.c)
>  piglit_add_executable (arb_explicit_uniform_location-array-elements array-elements.c)
>  piglit_add_executable (arb_explicit_uniform_location-inactive-uniform inactive-uniform.c)
> +piglit_add_executable (arb_explicit_uniform_location-use-of-unused-loc use-of-unused-loc.c)
> diff --git a/tests/spec/arb_explicit_uniform_location/use-of-unused-loc.c b/tests/spec/arb_explicit_uniform_location/use-of-unused-loc.c
> new file mode 100644
> index 0000000..f553603
> --- /dev/null
> +++ b/tests/spec/arb_explicit_uniform_location/use-of-unused-loc.c
> @@ -0,0 +1,74 @@
> +/*
> + * Copyright © 2014 Intel Corporation
> + *
> + * 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 use-of-unused-loc.c
> + *
> + * Tests that unused locations will return proper error
> + */
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +       config.supports_gl_core_version = 33;
> +       config.window_visual = PIGLIT_GL_VISUAL_RGB;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +       return PIGLIT_FAIL;
> +}
> +
> +static const char vs_text[] =
> +       "vec4 vertex;\n"
> +       "void main() {\n"
> +               "gl_Position = vertex;\n"
> +       "}";
> +
> +static const char fs_text[] =
> +       "#version 330\n"
> +       "#extension GL_ARB_explicit_uniform_location: require\n"
> +       "layout(location = 1) uniform float red;\n"
> +       "void main() {\n"
> +               "gl_FragColor = vec4(red, 0.0, 0.0, 1.0);\n"
> +       "}";
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       GLuint prog;
> +
> +       piglit_require_extension("GL_ARB_explicit_uniform_location");
> +       prog = piglit_build_simple_program(vs_text, fs_text);
> +
> +       glUseProgram(prog);
> +       glUniform1i(0, 1);
> +
> +       if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> +               piglit_report_result(PIGLIT_FAIL);
> +
> +       glDeleteProgram(prog);
> +       piglit_report_result(PIGLIT_PASS);
> +}
> --
> 1.8.3.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

A comment by Chris on another patch also applies here:
"Lower the  version requirements [to ~1.30 + ARB_explicit_attrib_location
 + ARB_explicit_uniform_location] "

With the suggested changes:
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the Piglit mailing list