[Piglit] [PATCH] sso: Verify that rendezvous by location also works
Ian Romanick
idr at freedesktop.org
Wed Jul 17 18:15:07 PDT 2013
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.
v2: Fix some dumb bugs in the test. Use multiple values to ensure we're
not matching using rendezvous-by-dumb-luck.
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 | 97 ++++++++++++++++++++++
3 files changed, 99 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 a11db51..cedc32c 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..00a8cf9
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c
@@ -0,0 +1,97 @@
+/*
+ * 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_separate_shader_objects: require\n"
+ "layout(location = 2) out vec3 a;\n"
+ "layout(location = 3) out vec3 b;\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = gl_Vertex;\n"
+ " a = vec3(0, 0, 1);\n"
+ " b = vec3(1, 0, 0);\n"
+ "}\n"
+ ;
+
+static const char *fs_code =
+ "#version 110\n"
+ "#extension GL_ARB_separate_shader_objects: require\n"
+ "layout(location = 3) in vec3 a;\n"
+ "layout(location = 2) in vec3 b;\n"
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = vec4(cross(a, b), 1);\n"
+ "}\n"
+ ;
+
+enum piglit_result
+piglit_display(void)
+{
+ static const float expected[] = {
+ 0.0f, 1.0f, 0.0f, 1.0f
+ };
+ bool pass;
+
+ piglit_draw_rect(-1, -1, 2, 2);
+ pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
+ expected);
+
+ piglit_present_results();
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+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);
+}
--
1.8.1.4
More information about the Piglit
mailing list