[Piglit] [V2 5/8] ARB_explicit_uniform_location: test overlapping locations

Ian Romanick idr at freedesktop.org
Fri Mar 14 08:12:40 PDT 2014


Same comment here as on patch 4.

On 03/14/2014 04:23 AM, Tapani Pälli wrote:
> This test tests overlapping uniform locations across shader stages.
> 
> v2: fix style issues (Anuj)
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>  tests/all.py                                       |  1 +
>  .../CMakeLists.gl.txt                              |  1 +
>  .../arb_explicit_uniform_location/loc-overlap.c    | 83 ++++++++++++++++++++++
>  3 files changed, 85 insertions(+)
>  create mode 100644 tests/spec/arb_explicit_uniform_location/loc-overlap.c
> 
> diff --git a/tests/all.py b/tests/all.py
> index 0cfffc2..26b8818 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -1929,6 +1929,7 @@ add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-bou
>  add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-array-elements')
>  add_plain_test(arb_explicit_uniform_location, 'arb_explicit_uniform_location-array-toobig')
>  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')
>  
>  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 e985160..992127e 100644
> --- a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
> +++ b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
> @@ -14,3 +14,4 @@ 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-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)
> diff --git a/tests/spec/arb_explicit_uniform_location/loc-overlap.c b/tests/spec/arb_explicit_uniform_location/loc-overlap.c
> new file mode 100644
> index 0000000..2d330da
> --- /dev/null
> +++ b/tests/spec/arb_explicit_uniform_location/loc-overlap.c
> @@ -0,0 +1,83 @@
> +/*
> + * 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-overlap.c
> + *
> + *  Tests overlapping uniform location among 2 shader stages, both shaders
> + *  define same explicit location. Note, this test does not include testing
> + *  for overlaps with unused uniform locations.
> + *
> + *  https://www.opengl.org/registry/specs/ARB/explicit_uniform_location.txt
> + *
> + *  Specification states : "No two default-block uniform variables in the
> + *                          program can have the same location, even if they are
> + *                          unused, otherwise a compiler or linker error will be
> + *                          generated."
> + */
> +#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 offset;\n"
> +	"vec4 vertex;\n"
> +	"void main() {\n"
> +		"gl_Position = vertex + offset;\n"
> +	"}";
> +
> +const char f_sha[] =
> +	"#extension GL_ARB_explicit_uniform_location: require\n"
> +	"layout(location = 42) uniform vec4 color;\n"
> +	"void main() {\n"
> +		"gl_FragColor = color;\n"
> +	"}";
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +	GLuint prog;
> +	GLint link_status;
> +	piglit_require_extension("GL_ARB_explicit_uniform_location");
> +
> +	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_FALSE */
> +	piglit_report_result(link_status ? PIGLIT_FAIL : PIGLIT_PASS);
> +}
> 



More information about the Piglit mailing list