[Piglit] [PATCH 15/15] arb_tessellation_shader: add a test with an array in a struct in a per-vertex TCS out

Marek Olšák maraeo at gmail.com
Mon Mar 26 23:32:55 UTC 2018


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

This currently hits a bug in Mesa's GLSL-to-TGSI conversion.
---
 .../tcs-tes-array-in-struct.shader_test            | 78 ++++++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 tests/spec/arb_tessellation_shader/execution/variable-indexing/tcs-tes-array-in-struct.shader_test

diff --git a/tests/spec/arb_tessellation_shader/execution/variable-indexing/tcs-tes-array-in-struct.shader_test b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tcs-tes-array-in-struct.shader_test
new file mode 100644
index 000000000..8611bdfa7
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tcs-tes-array-in-struct.shader_test
@@ -0,0 +1,78 @@
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader passthrough]
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(vertices = 4) out;
+
+struct S {
+    int v[2];
+};
+
+out S tcs_tes_s[];
+
+void main()
+{
+    for (int i = 0; i < 2; ++i)
+       tcs_tes_s[gl_InvocationID].v[i] = gl_InvocationID * 2 + i;
+
+//    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+    gl_TessLevelOuter = float[4](3.0, 3.0, 3.0, 3.0);
+    gl_TessLevelInner = float[2](3.0, 3.0);
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+struct S {
+    int v[2];
+};
+
+in S tcs_tes_s[];
+
+out vec4 color;
+
+void main()
+{
+    gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+
+    for (int i = 0; i < 4; ++i) {
+        for (int j = 0; j < 2; ++j) {
+            int expected = i * 2 + j;
+            int actual = tcs_tes_s[i].v[j];
+            if (expected != actual) {
+                color = vec4(1.0, float(expected) / 255.0, float(actual) / 255.0, 0.0);
+                return;
+            }
+        }
+    }
+
+    color = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 150
+in vec4 color;
+out vec4 outcolor;
+
+void main()
+{
+    outcolor = color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+
+probe all rgba 0 1 0 1
-- 
2.15.1



More information about the Piglit mailing list