[Piglit] [PATCH 7/7] ARB_explicit_uniform_location: set location once but decl twice

Anuj Phogat anuj.phogat at gmail.com
Thu Mar 13 17:17:45 PDT 2014


On Thu, Mar 13, 2014 at 5:41 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
> This test sets explicit location in vertex shader but does not set it
> for same uniform in the fragment shader.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>  tests/all.py                                       |  1 +
>  .../CMakeLists.gl.txt                              |  1 +
>  .../arb_explicit_uniform_location/loc-setonce.c    | 84 ++++++++++++++++++++++
>  3 files changed, 86 insertions(+)
>  create mode 100644 tests/spec/arb_explicit_uniform_location/loc-setonce.c
>
> diff --git a/tests/all.py b/tests/all.py
> index 557d1f3..f4e867c 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -1931,6 +1931,7 @@ add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-arr
>  add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-array-overlap')
>  add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-loc-overlap')
>  add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-loc-2different')
> +add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-loc-setonce')
>
>  arb_texture_buffer_object = Group()
>  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 b27980d..10543b6 100644
> --- a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
> +++ b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
> @@ -16,3 +16,4 @@ piglit_add_executable (arb_explicit_uniform_location-array-toobig array-toobig.c
>  piglit_add_executable (arb_explicit_uniform_location-array-overlap array-overlap.c)
>  piglit_add_executable (arb_explicit_uniform_location-loc-overlap loc-overlap.c)
>  piglit_add_executable (arb_explicit_uniform_location-loc-2different loc-2different.c)
> +piglit_add_executable (arb_explicit_uniform_location-loc-setonce loc-setonce.c)
> diff --git a/tests/spec/arb_explicit_uniform_location/loc-setonce.c b/tests/spec/arb_explicit_uniform_location/loc-setonce.c
> new file mode 100644
> index 0000000..1a4b419
> --- /dev/null
> +++ b/tests/spec/arb_explicit_uniform_location/loc-setonce.c
> @@ -0,0 +1,84 @@
> +/*
> + * 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 loc-setonce.c
> + *
> + *  Tests setting explicit location to uniform in vertex stage and declaring
> + *  same uniform without explicit location in fragment stage.
> + *
> + *  https://www.opengl.org/registry/specs/ARB/explicit_uniform_location.txt
> + *
> + */
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +       config.supports_gl_compat_version = 20;
> +       config.window_visual = PIGLIT_GL_VISUAL_RGB;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +       return PIGLIT_FAIL;
> +}
> +
> +const char v_sha[] =
> +"#extension GL_ARB_explicit_uniform_location: require\n"
> +"layout(location = 42) uniform vec4 foo;\n"
maybe smaller number for location?
> +"vec4 vertex;\n"
> +"void main() {\n"
> +"gl_Position = vertex + foo;\n"
> +"}";
> +
> +const char f_sha[] =
> +"#extension GL_ARB_explicit_uniform_location: require\n"
> +"uniform vec4 foo;\n"
> +"void main() {\n"
> +"gl_FragColor = foo;\n"
> +"}";
> +
> +static bool
> +test()
> +{
> +       GLuint prog;
> +       GLint link_status;
> +
> +       prog = piglit_build_simple_program_unlinked(v_sha, f_sha);
> +
> +        glLinkProgram(prog);
> +       glGetProgramiv(prog, GL_LINK_STATUS, &link_status);
> +       glDeleteProgram(prog);
> +
> +       /* link_status is expected to be GL_TRUE */
> +        return link_status;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       piglit_require_extension("GL_ARB_explicit_uniform_location");
> +        piglit_report_result(test() ? PIGLIT_PASS : PIGLIT_FAIL);
> +}
same comments as in Patch 4/7.
> --
> 1.8.3.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list