[Piglit] [PATCH 4/6] glsl-1.50: test instancing with a geometry shader

Marek Olšák maraeo at gmail.com
Sun Apr 30 14:58:37 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 .../glsl-1.50/execution/gs-instance-id.shader_test | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/execution/gs-instance-id.shader_test

diff --git a/tests/spec/glsl-1.50/execution/gs-instance-id.shader_test b/tests/spec/glsl-1.50/execution/gs-instance-id.shader_test
new file mode 100644
index 0000000..8a7caa3
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/gs-instance-id.shader_test
@@ -0,0 +1,58 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+uniform vec4 instance_colors[] = vec4[](vec4(0.0, 1.0, 0.0, 1.0),
+					vec4(0.0, 0.5, 0.5, 1.0),
+					vec4(0.0, 0.0, 1.0, 1.0));
+in vec4 piglit_vertex;
+out vec4 color, pos;
+
+void main()
+{
+  color = instance_colors[gl_InstanceID];
+
+  vec4 v = piglit_vertex;
+  v.x += 20.0 * float(gl_InstanceID) / 125.0;
+
+  pos = v;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+in vec4 color[], pos[];
+out vec4 fs_color;
+
+void main()
+{
+  for (int i = 0; i < 3; i++) {
+    gl_Position = pos[i];
+    fs_color = color[i];
+    EmitVertex();
+  }
+}
+
+[fragment shader]
+#version 150
+
+in vec4 fs_color;
+
+void main()
+{
+  gl_FragColor = fs_color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+
+draw instanced rect ortho 3 10 10 10 10
+probe rgb 15 15 0.0 1.0 0.0
+probe rgb 35 15 0.0 0.5 0.5
+probe rgb 55 15 0.0 0.0 1.0
-- 
2.7.4



More information about the Piglit mailing list