[Piglit] [PATCH 8/8] sso: Verify that rendezvous by location also works

Ian Romanick idr at freedesktop.org
Mon Jul 15 16:14:30 PDT 2013


On 07/15/2013 03:25 PM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Separate shader objects can either connect outputs to inputs by matching
> names (rendezvous by name) or by assigning explicit locations via the
> layout(location=...) (rendezvous by location).  This is a simple test
> that a vertex shader with a different name than the fragment shader
> input can by matched by the location.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>   tests/all.tests                                    |  1 +
>   .../arb_separate_shader_objects/CMakeLists.gl.txt  |  1 +
>   .../rendezvous_by_location.c                       | 90 ++++++++++++++++++++++
>   3 files changed, 92 insertions(+)
>   create mode 100644 tests/spec/arb_separate_shader_objects/rendezvous_by_location.c
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 2681e39..93431ba 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1147,6 +1147,7 @@ arb_separate_shader_objects['GetProgramPipelineiv'] = concurrent_test('arb_separ
>   arb_separate_shader_objects['IsProgramPipeline'] = concurrent_test('arb_separate_shader_object-IsProgramPipeline')
>   arb_separate_shader_objects['UseProgramStages - non-separable program'] = concurrent_test('arb_separate_shader_object-UseProgramStages-non-separable')
>   arb_separate_shader_objects['Mix BindProgramPipeline and UseProgram'] = concurrent_test('arb_separate_shader_object-mix_pipeline_useprogram')
> +arb_separate_shader_objects['Rendezvous by location'] = plain_test('arb_separate_shader_object-rendezvous_by_location -fbo')
>   arb_separate_shader_objects['ValidateProgramPipeline'] = concurrent_test('arb_separate_shader_object-ValidateProgramPipeline')
>
>   # Group ARB_sampler_objects
> diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> index ad22987..66176f1 100644
> --- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> +++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> @@ -12,5 +12,6 @@ link_libraries (
>   piglit_add_executable (arb_separate_shader_object-GetProgramPipelineiv GetProgramPipelineiv.c)
>   piglit_add_executable (arb_separate_shader_object-IsProgramPipeline IsProgramPipeline.c)
>   piglit_add_executable (arb_separate_shader_object-mix_pipeline_useprogram mix_pipeline_useprogram.c)
> +piglit_add_executable (arb_separate_shader_object-rendezvous_by_location rendezvous_by_location.c)
>   piglit_add_executable (arb_separate_shader_object-UseProgramStages-non-separable UseProgramStages-non-separable.c)
>   piglit_add_executable (arb_separate_shader_object-ValidateProgramPipeline ValidateProgramPipeline.c)
> diff --git a/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c b/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c
> new file mode 100644
> index 0000000..e6db364
> --- /dev/null
> +++ b/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c
> @@ -0,0 +1,90 @@
> +/*
> + * Copyright © 2013 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.
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +	config.supports_gl_compat_version = 10;
> +	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static const char *vs_code =
> +	"#version 110\n"
> +	"#extension GL_ARB_explicit_attrib_location: require\n"

This, of course, should be:

+	"#extension GL_ARB_separate_shader_objects: require\n"

> +	"layout(location = 2) out vec4 a;\n"
> +	"void main()\n"
> +	"{\n"
> +	"    gl_Position = gl_Vertex;\n"
> +	"    a = vec4(0, 1, 0, 1);\n"
> +	"}\n"
> +	;
> +
> +static const char *fs_code =
> +	"#version 110\n"
> +	"#extension GL_ARB_separate_shader_objects: require\n"
> +	"layout(location = 2) in vec4 b;\n"
> +	"void main()\n"
> +	"{\n"
> +	"    gl_FragColor = b;\n"
> +	"}\n"
> +	;
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +	static const float expected[] = {
> +		0.0f, 1.0f, 0.0f, 1.0f
> +	};
> +
> +	piglit_draw_rect(-1, -1, 2, 2);
> +	return piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
> +				      expected);
> +}
> +
> +void piglit_init(int argc, char **argv)
> +{
> +	GLuint vs_prog;
> +	GLuint fs_prog;
> +	GLuint pipeline;
> +
> +	piglit_require_vertex_shader();
> +	piglit_require_extension("GL_ARB_separate_shader_objects");
> +
> +	vs_prog = glCreateShaderProgramv(GL_VERTEX_SHADER, 1, &vs_code);
> +	piglit_link_check_status(vs_prog);
> +
> +	fs_prog = glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1, &fs_code);
> +	piglit_link_check_status(fs_prog);
> +
> +	glGenProgramPipelines(1, &pipeline);
> +	glUseProgramStages(pipeline, GL_VERTEX_SHADER_BIT, vs_prog);
> +	glUseProgramStages(pipeline, GL_FRAGMENT_SHADER_BIT, fs_prog);
> +	piglit_program_pipeline_check_status(pipeline);
> +
> +	if (!piglit_check_gl_error(0))
> +		piglit_report_result(PIGLIT_FAIL);
> +
> +	glBindProgramPipeline(pipeline);
> +}
>



More information about the Piglit mailing list