[Piglit] [PATCH] gs: Test core GS inputs on GLSL 1.50

Paul Berry stereotype441 at gmail.com
Sat Sep 14 10:44:54 PDT 2013


---
 .../execution/geometry/core-inputs.shader_test     | 98 ++++++++++++++++++++++
 1 file changed, 98 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/execution/geometry/core-inputs.shader_test

diff --git a/tests/spec/glsl-1.50/execution/geometry/core-inputs.shader_test b/tests/spec/glsl-1.50/execution/geometry/core-inputs.shader_test
new file mode 100644
index 0000000..f0df9f2
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/geometry/core-inputs.shader_test
@@ -0,0 +1,98 @@
+# Check proper functioning of the following geometry shader inputs
+# (which are available in both core and compatibility profiles):
+#
+# - gl_Position
+# - gl_PointSize
+# - gl_ClipDistance (when accessed using constant array indices)
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in float offset;
+
+void main()
+{
+  gl_Position = offset + vec4(0.0, 1.0, 2.0, 3.0);
+  gl_PointSize = offset + 4.0;
+  gl_ClipDistance[0] = offset + 5.0;
+  gl_ClipDistance[1] = offset + 6.0;
+  gl_ClipDistance[2] = offset + 7.0;
+  gl_ClipDistance[3] = offset + 8.0;
+  gl_ClipDistance[4] = offset + 9.0;
+  gl_ClipDistance[5] = offset + 10.0;
+  gl_ClipDistance[6] = offset + 11.0;
+  gl_ClipDistance[7] = offset + 12.0;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 4) out;
+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 < 3; i++) {
+    float offset = 100.0 * float(i);
+    if (gl_in[i].gl_Position != offset + vec4(0.0, 1.0, 2.0, 3.0))
+      ok = false;
+    if (gl_in[i].gl_PointSize != offset + 4.0)
+      ok = false;
+    if (gl_in[i].gl_ClipDistance[0] != offset + 5.0)
+      ok = false;
+    if (gl_in[i].gl_ClipDistance[1] != offset + 6.0)
+      ok = false;
+    if (gl_in[i].gl_ClipDistance[2] != offset + 7.0)
+      ok = false;
+    if (gl_in[i].gl_ClipDistance[3] != offset + 8.0)
+      ok = false;
+    if (gl_in[i].gl_ClipDistance[4] != offset + 9.0)
+      ok = false;
+    if (gl_in[i].gl_ClipDistance[5] != offset + 10.0)
+      ok = false;
+    if (gl_in[i].gl_ClipDistance[6] != offset + 11.0)
+      ok = false;
+    if (gl_in[i].gl_ClipDistance[7] != offset + 12.0)
+      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]
+#version 150
+
+in vec4 color;
+
+void main()
+{
+  gl_FragColor = color;
+}
+
+[vertex data]
+offset/float/1
+0
+100
+200
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLES 0 3
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.8.4



More information about the Piglit mailing list