[Piglit] [PATCH] gs: Test that gl_MaxGeometryInputComponents can actually be achieved.

Paul Berry stereotype441 at gmail.com
Wed Oct 16 16:06:39 CEST 2013


---
 .../geometry/max-input-components.shader_test      | 66 ++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/execution/geometry/max-input-components.shader_test

diff --git a/tests/spec/glsl-1.50/execution/geometry/max-input-components.shader_test b/tests/spec/glsl-1.50/execution/geometry/max-input-components.shader_test
new file mode 100644
index 0000000..fcd1e7a
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/geometry/max-input-components.shader_test
@@ -0,0 +1,66 @@
+# Verify that gl_MaxGeometryInputComponents (or
+# gl_MaxVertexOutputComponents, if smaller) floats can be exchanged
+# between the vertex and geometry shader.  Use a geometry shader input
+# type of triangles_adjacency so that the total number of inputs
+# received by the geometry shader is as large as possible.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out blk {
+  float f[min(gl_MaxGeometryInputComponents, gl_MaxVertexOutputComponents)];
+} outs;
+
+void main()
+{
+  for (int i = 0; i < outs.f.length(); i++)
+    outs.f[i] = float(gl_VertexID * 1000 + i + 1);
+}
+
+[geometry shader]
+layout(triangles_adjacency) in;
+layout(triangle_strip, max_vertices = 4) out;
+
+in blk {
+  float f[min(gl_MaxGeometryInputComponents, gl_MaxVertexOutputComponents)];
+} ins[];
+out vec4 color;
+
+void main()
+{
+  const vec4 vertices[4] = vec4[4](
+    vec4(-1.0, -1.0, 0.0, 1.0),
+    vec4(-1.0,  1.0, 0.0, 1.0),
+    vec4( 1.0, -1.0, 0.0, 1.0),
+    vec4( 1.0,  1.0, 0.0, 1.0)
+  );
+
+  bool ok = true;
+  for (int i = 0; i < 6; i++) {
+    for (int j = 0; j < ins[i].f.length(); j++) {
+      if (ins[i].f[j] != float(i * 1000 + j + 1))
+        ok = false;
+    }
+  }
+
+  for (int i = 0; i < 4; i++) {
+    gl_Position = vertices[i];
+    color = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+    EmitVertex();
+  }
+}
+
+[fragment shader]
+in vec4 color;
+
+void main()
+{
+  gl_FragColor = color;
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLES_ADJACENCY 0 6
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.8.4



More information about the Piglit mailing list