[Piglit] [PATCH] gs: Test that input arrays can be accessed dynamically.
Paul Berry
stereotype441 at gmail.com
Wed Sep 4 14:22:58 PDT 2013
Most geometry shaders access their input arrays using a constant index
(or an index that is constant after loop unrolling). This test checks
that we get the right results if we access a geometry shader input
array using a non-constant index.
---
.../geometry/dynamic_input_array_index.shader_test | 67 ++++++++++++++++++++++
1 file changed, 67 insertions(+)
create mode 100644 tests/spec/glsl-1.50/execution/geometry/dynamic_input_array_index.shader_test
diff --git a/tests/spec/glsl-1.50/execution/geometry/dynamic_input_array_index.shader_test b/tests/spec/glsl-1.50/execution/geometry/dynamic_input_array_index.shader_test
new file mode 100644
index 0000000..685a66a
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/geometry/dynamic_input_array_index.shader_test
@@ -0,0 +1,67 @@
+# Verify that a geometry shader can access an input array using a
+# dynamic index rather than a constant index.
+
+[require]
+GL >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+in vec4 color;
+in int index;
+out vec4 vertex_to_gs;
+out vec4 color_to_gs;
+out int index_to_gs;
+
+void main()
+{
+ vertex_to_gs = vertex;
+ color_to_gs = color;
+ index_to_gs = index;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+in vec4 vertex_to_gs[3];
+in vec4 color_to_gs[3];
+in int index_to_gs[3];
+out vec4 color_to_fs;
+
+void main()
+{
+ for (int i = 0; i < 3; i++) {
+ gl_Position = vertex_to_gs[i];
+ color_to_fs = color_to_gs[index_to_gs[i]];
+ EmitVertex();
+ }
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color_to_fs;
+out vec4 color;
+
+void main()
+{
+ color = color_to_fs;
+}
+
+[vertex data]
+vertex/float/2 color/float/4 index/int/1
+-1.0 -1.0 1.0 0.0 0.0 1.0 1
+ 1.0 -1.0 0.0 1.0 0.0 1.0 1
+ 1.0 1.0 0.0 0.0 1.0 1.0 1
+-1.0 -1.0 1.0 0.0 0.0 1.0 2
+ 1.0 1.0 0.0 0.0 1.0 1.0 2
+-1.0 1.0 0.0 1.0 0.0 1.0 2
+
+[test]
+draw arrays GL_TRIANGLES 0 6
+probe all rgba 0.0 1.0 0.0 1.0
--
1.8.4
More information about the Piglit
mailing list