[Piglit] [PATCH 10/10] arb_tessellation_shader: add tests for indirect addressing of all TES inputs (v2)

Marek Olšák maraeo at gmail.com
Thu Apr 30 05:36:25 PDT 2015


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

i.e. both patch and non-patch types.

This tests 64 inputs and outputs - more than any other shader can have.

v2: - use do {} while(0) for the macro
    - only use 120 patch output components
---
 ...tes-both-input-array-float-index-rd.shader_test | 247 +++++++++++++++++++++
 .../tes-both-input-array-vec2-index-rd.shader_test | 247 +++++++++++++++++++++
 .../tes-both-input-array-vec3-index-rd.shader_test | 247 +++++++++++++++++++++
 .../tes-both-input-array-vec4-index-rd.shader_test | 246 ++++++++++++++++++++
 4 files changed, 987 insertions(+)
 create mode 100644 tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-float-index-rd.shader_test
 create mode 100644 tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec2-index-rd.shader_test
 create mode 100644 tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec3-index-rd.shader_test
 create mode 100644 tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec4-index-rd.shader_test

diff --git a/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-float-index-rd.shader_test b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-float-index-rd.shader_test
new file mode 100644
index 0000000..80d4ad4
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-float-index-rd.shader_test
@@ -0,0 +1,247 @@
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+in vec4 piglit_vertex;
+
+void main()
+{
+    gl_Position = piglit_vertex;
+}
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+layout(vertices = 4) out;
+
+out block {
+  float m1[16];
+  float m2[15];
+} blk[];
+patch out float p1[16];
+patch out float p2[14];
+
+void main()
+{
+    for (int i = 0; i < 16; i++)
+        blk[gl_InvocationID].m1[i] = 1.0 + float(i);
+
+    for (int i = 0; i < 15; i++)
+        blk[gl_InvocationID].m2[i] = 1.0 + float(16+i);
+
+    for (int i = 0; i < 16; i++)
+        p1[i] = 1.0 + float(31+i);
+
+    for (int i = 0; i < 14; i++)
+        p2[i] = 1.0 + float(47+i);
+
+    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+    gl_TessLevelInner = float[2](1.0, 1.0);
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+layout(quads, equal_spacing) in;
+
+uniform int index;
+uniform vec4 expect;
+in block {
+    float m1[16];
+    float m2[15];
+} blk[];
+patch in float p1[16];
+patch in float p2[14];
+out vec4 color;
+
+#define INTERP_QUAD(INi, OUT) do { \
+    vec4 v[4]; \
+    for (int i = 0; i < 4; i++) v[i] = INi; \
+    OUT = mix(mix(v[0], v[1], gl_TessCoord[0]), mix(v[2], v[3], gl_TessCoord[0]), \
+              gl_TessCoord[1]); \
+} while(false)
+
+void main() {
+    vec4 m;
+    float p;
+
+    if (index >= 16) {
+        INTERP_QUAD(vec4(blk[i].m2[index-16]), m);
+        p = p2[index-16];
+    } else {
+        INTERP_QUAD(vec4(blk[i].m1[index]), m);
+        p = p1[index];
+    }
+
+    color = m.x == expect.x && p == expect.x+31 ?
+        vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+    INTERP_QUAD(gl_in[i].gl_Position, gl_Position);
+}
+
+[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
+
+uniform int index 0
+uniform vec4 expect 1 1.1 1.2 1.3
+draw rect patch -1 -1 0.09 0.09
+probe rgb 6 6 0.0 1.0 0.0
+
+uniform int index 1
+uniform vec4 expect 2 2.1 2.2 2.3
+draw rect patch -0.9 -1 0.09 0.09
+probe rgb 18 6 0.0 1.0 0.0
+
+uniform int index 2
+uniform vec4 expect 3 3.1 3.2 3.3
+draw rect patch -0.8 -1 0.09 0.09
+probe rgb 31 6 0.0 1.0 0.0
+
+uniform int index 3
+uniform vec4 expect 4 4.1 4.2 4.3
+draw rect patch -0.7 -1 0.09 0.09
+probe rgb 43 6 0.0 1.0 0.0
+
+uniform int index 4
+uniform vec4 expect 5 5.1 5.2 5.3
+draw rect patch -0.6 -1 0.09 0.09
+probe rgb 56 6 0.0 1.0 0.0
+
+uniform int index 5
+uniform vec4 expect 6 6.1 6.2 6.3
+draw rect patch -0.5 -1 0.09 0.09
+probe rgb 68 6 0.0 1.0 0.0
+
+uniform int index 6
+uniform vec4 expect 7 7.1 7.2 7.3
+draw rect patch -0.4 -1 0.09 0.09
+probe rgb 81 6 0.0 1.0 0.0
+
+uniform int index 7
+uniform vec4 expect 8 8.1 8.2 8.3
+draw rect patch -0.3 -1 0.09 0.09
+probe rgb 93 6 0.0 1.0 0.0
+
+uniform int index 8
+uniform vec4 expect 9 9.1 9.2 9.3
+draw rect patch -0.2 -1 0.09 0.09
+probe rgb 106 6 0.0 1.0 0.0
+
+uniform int index 9
+uniform vec4 expect 10 10.1 10.2 10.3
+draw rect patch -0.1 -1 0.09 0.09
+probe rgb 118 6 0.0 1.0 0.0
+
+uniform int index 10
+uniform vec4 expect 11 11.1 11.2 11.3
+draw rect patch 0 -1 0.09 0.09
+probe rgb 131 6 0.0 1.0 0.0
+
+uniform int index 11
+uniform vec4 expect 12 12.1 12.2 12.3
+draw rect patch 0.1 -1 0.09 0.09
+probe rgb 143 6 0.0 1.0 0.0
+
+uniform int index 12
+uniform vec4 expect 13 13.1 13.2 13.3
+draw rect patch 0.2 -1 0.09 0.09
+probe rgb 156 6 0.0 1.0 0.0
+
+uniform int index 13
+uniform vec4 expect 14 14.1 14.2 14.3
+draw rect patch 0.3 -1 0.09 0.09
+probe rgb 168 6 0.0 1.0 0.0
+
+uniform int index 14
+uniform vec4 expect 15 15.1 15.2 15.3
+draw rect patch 0.4 -1 0.09 0.09
+probe rgb 181 6 0.0 1.0 0.0
+
+uniform int index 15
+uniform vec4 expect 16 16.1 16.2 16.3
+draw rect patch 0.5 -1.0 0.09 0.09
+probe rgb 193 6 0.0 1.0 0.0
+
+uniform int index 16
+uniform vec4 expect 17 17.1 17.2 17.3
+draw rect patch -1 -0.9 0.09 0.09
+probe rgb 6 18 0.0 1.0 0.0
+
+uniform int index 17
+uniform vec4 expect 18 18.1 18.2 18.3
+draw rect patch -0.9 -0.9 0.09 0.09
+probe rgb 18 18 0.0 1.0 0.0
+
+uniform int index 18
+uniform vec4 expect 19 19.1 19.2 19.3
+draw rect patch -0.8 -0.9 0.09 0.09
+probe rgb 31 18 0.0 1.0 0.0
+
+uniform int index 19
+uniform vec4 expect 20 20.1 20.2 20.3
+draw rect patch -0.7 -0.9 0.09 0.09
+probe rgb 43 18 0.0 1.0 0.0
+
+uniform int index 20
+uniform vec4 expect 21 21.1 21.2 21.3
+draw rect patch -0.6 -0.9 0.09 0.09
+probe rgb 56 18 0.0 1.0 0.0
+
+uniform int index 21
+uniform vec4 expect 22 22.1 22.2 22.3
+draw rect patch -0.5 -0.9 0.09 0.09
+probe rgb 68 18 0.0 1.0 0.0
+
+uniform int index 22
+uniform vec4 expect 23 23.1 23.2 23.3
+draw rect patch -0.4 -0.9 0.09 0.09
+probe rgb 81 18 0.0 1.0 0.0
+
+uniform int index 23
+uniform vec4 expect 24 24.1 24.2 24.3
+draw rect patch -0.3 -0.9 0.09 0.09
+probe rgb 93 18 0.0 1.0 0.0
+
+uniform int index 24
+uniform vec4 expect 25 25.1 25.2 25.3
+draw rect patch -0.2 -0.9 0.09 0.09
+probe rgb 106 18 0.0 1.0 0.0
+
+uniform int index 25
+uniform vec4 expect 26 26.1 26.2 26.3
+draw rect patch -0.1 -0.9 0.09 0.09
+probe rgb 118 18 0.0 1.0 0.0
+
+uniform int index 26
+uniform vec4 expect 27 27.1 27.2 27.3
+draw rect patch 0 -0.9 0.09 0.09
+probe rgb 131 18 0.0 1.0 0.0
+
+uniform int index 27
+uniform vec4 expect 28 28.1 28.2 28.3
+draw rect patch 0.1 -0.9 0.09 0.09
+probe rgb 143 18 0.0 1.0 0.0
+
+uniform int index 28
+uniform vec4 expect 29 29.1 29.2 29.3
+draw rect patch 0.2 -0.9 0.09 0.09
+probe rgb 156 18 0.0 1.0 0.0
+
+uniform int index 29
+uniform vec4 expect 30 30.1 30.2 30.3
+draw rect patch 0.3 -0.9 0.09 0.09
+probe rgb 168 18 0.0 1.0 0.0
diff --git a/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec2-index-rd.shader_test b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec2-index-rd.shader_test
new file mode 100644
index 0000000..4a1508c
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec2-index-rd.shader_test
@@ -0,0 +1,247 @@
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+in vec4 piglit_vertex;
+
+void main()
+{
+    gl_Position = piglit_vertex;
+}
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+layout(vertices = 4) out;
+
+out block {
+  vec2 m1[16];
+  vec2 m2[15];
+} blk[];
+patch out vec2 p1[16];
+patch out vec2 p2[14];
+
+void main()
+{
+    for (int i = 0; i < 16; i++)
+        blk[gl_InvocationID].m1[i] = vec2(1.0, 1.1) + vec2(i);
+
+    for (int i = 0; i < 15; i++)
+        blk[gl_InvocationID].m2[i] = vec2(1.0, 1.1) + vec2(16+i);
+
+    for (int i = 0; i < 16; i++)
+        p1[i] = vec2(1.0, 1.1) + vec2(31+i);
+
+    for (int i = 0; i < 14; i++)
+        p2[i] = vec2(1.0, 1.1) + vec2(47+i);
+
+    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+    gl_TessLevelInner = float[2](1.0, 1.0);
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+layout(quads, equal_spacing) in;
+
+uniform int index;
+uniform vec4 expect;
+in block {
+    vec2 m1[16];
+    vec2 m2[15];
+} blk[];
+patch in vec2 p1[16];
+patch in vec2 p2[14];
+out vec4 color;
+
+#define INTERP_QUAD(INi, OUT) do { \
+    vec4 v[4]; \
+    for (int i = 0; i < 4; i++) v[i] = INi; \
+    OUT = mix(mix(v[0], v[1], gl_TessCoord[0]), mix(v[2], v[3], gl_TessCoord[0]), \
+              gl_TessCoord[1]); \
+} while(false)
+
+void main() {
+    vec4 m;
+    vec2 p;
+
+    if (index >= 16) {
+        INTERP_QUAD(blk[i].m2[index-16].xyyy, m);
+        p = p2[index-16];
+    } else {
+        INTERP_QUAD(blk[i].m1[index].xyyy, m);
+        p = p1[index];
+    }
+
+    color = m.xy == expect.xy && p == expect.xy+vec2(31) ?
+        vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+    INTERP_QUAD(gl_in[i].gl_Position, gl_Position);
+}
+
+[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
+
+uniform int index 0
+uniform vec4 expect 1 1.1 1.2 1.3
+draw rect patch -1 -1 0.09 0.09
+probe rgb 6 6 0.0 1.0 0.0
+
+uniform int index 1
+uniform vec4 expect 2 2.1 2.2 2.3
+draw rect patch -0.9 -1 0.09 0.09
+probe rgb 18 6 0.0 1.0 0.0
+
+uniform int index 2
+uniform vec4 expect 3 3.1 3.2 3.3
+draw rect patch -0.8 -1 0.09 0.09
+probe rgb 31 6 0.0 1.0 0.0
+
+uniform int index 3
+uniform vec4 expect 4 4.1 4.2 4.3
+draw rect patch -0.7 -1 0.09 0.09
+probe rgb 43 6 0.0 1.0 0.0
+
+uniform int index 4
+uniform vec4 expect 5 5.1 5.2 5.3
+draw rect patch -0.6 -1 0.09 0.09
+probe rgb 56 6 0.0 1.0 0.0
+
+uniform int index 5
+uniform vec4 expect 6 6.1 6.2 6.3
+draw rect patch -0.5 -1 0.09 0.09
+probe rgb 68 6 0.0 1.0 0.0
+
+uniform int index 6
+uniform vec4 expect 7 7.1 7.2 7.3
+draw rect patch -0.4 -1 0.09 0.09
+probe rgb 81 6 0.0 1.0 0.0
+
+uniform int index 7
+uniform vec4 expect 8 8.1 8.2 8.3
+draw rect patch -0.3 -1 0.09 0.09
+probe rgb 93 6 0.0 1.0 0.0
+
+uniform int index 8
+uniform vec4 expect 9 9.1 9.2 9.3
+draw rect patch -0.2 -1 0.09 0.09
+probe rgb 106 6 0.0 1.0 0.0
+
+uniform int index 9
+uniform vec4 expect 10 10.1 10.2 10.3
+draw rect patch -0.1 -1 0.09 0.09
+probe rgb 118 6 0.0 1.0 0.0
+
+uniform int index 10
+uniform vec4 expect 11 11.1 11.2 11.3
+draw rect patch 0 -1 0.09 0.09
+probe rgb 131 6 0.0 1.0 0.0
+
+uniform int index 11
+uniform vec4 expect 12 12.1 12.2 12.3
+draw rect patch 0.1 -1 0.09 0.09
+probe rgb 143 6 0.0 1.0 0.0
+
+uniform int index 12
+uniform vec4 expect 13 13.1 13.2 13.3
+draw rect patch 0.2 -1 0.09 0.09
+probe rgb 156 6 0.0 1.0 0.0
+
+uniform int index 13
+uniform vec4 expect 14 14.1 14.2 14.3
+draw rect patch 0.3 -1 0.09 0.09
+probe rgb 168 6 0.0 1.0 0.0
+
+uniform int index 14
+uniform vec4 expect 15 15.1 15.2 15.3
+draw rect patch 0.4 -1 0.09 0.09
+probe rgb 181 6 0.0 1.0 0.0
+
+uniform int index 15
+uniform vec4 expect 16 16.1 16.2 16.3
+draw rect patch 0.5 -1.0 0.09 0.09
+probe rgb 193 6 0.0 1.0 0.0
+
+uniform int index 16
+uniform vec4 expect 17 17.1 17.2 17.3
+draw rect patch -1 -0.9 0.09 0.09
+probe rgb 6 18 0.0 1.0 0.0
+
+uniform int index 17
+uniform vec4 expect 18 18.1 18.2 18.3
+draw rect patch -0.9 -0.9 0.09 0.09
+probe rgb 18 18 0.0 1.0 0.0
+
+uniform int index 18
+uniform vec4 expect 19 19.1 19.2 19.3
+draw rect patch -0.8 -0.9 0.09 0.09
+probe rgb 31 18 0.0 1.0 0.0
+
+uniform int index 19
+uniform vec4 expect 20 20.1 20.2 20.3
+draw rect patch -0.7 -0.9 0.09 0.09
+probe rgb 43 18 0.0 1.0 0.0
+
+uniform int index 20
+uniform vec4 expect 21 21.1 21.2 21.3
+draw rect patch -0.6 -0.9 0.09 0.09
+probe rgb 56 18 0.0 1.0 0.0
+
+uniform int index 21
+uniform vec4 expect 22 22.1 22.2 22.3
+draw rect patch -0.5 -0.9 0.09 0.09
+probe rgb 68 18 0.0 1.0 0.0
+
+uniform int index 22
+uniform vec4 expect 23 23.1 23.2 23.3
+draw rect patch -0.4 -0.9 0.09 0.09
+probe rgb 81 18 0.0 1.0 0.0
+
+uniform int index 23
+uniform vec4 expect 24 24.1 24.2 24.3
+draw rect patch -0.3 -0.9 0.09 0.09
+probe rgb 93 18 0.0 1.0 0.0
+
+uniform int index 24
+uniform vec4 expect 25 25.1 25.2 25.3
+draw rect patch -0.2 -0.9 0.09 0.09
+probe rgb 106 18 0.0 1.0 0.0
+
+uniform int index 25
+uniform vec4 expect 26 26.1 26.2 26.3
+draw rect patch -0.1 -0.9 0.09 0.09
+probe rgb 118 18 0.0 1.0 0.0
+
+uniform int index 26
+uniform vec4 expect 27 27.1 27.2 27.3
+draw rect patch 0 -0.9 0.09 0.09
+probe rgb 131 18 0.0 1.0 0.0
+
+uniform int index 27
+uniform vec4 expect 28 28.1 28.2 28.3
+draw rect patch 0.1 -0.9 0.09 0.09
+probe rgb 143 18 0.0 1.0 0.0
+
+uniform int index 28
+uniform vec4 expect 29 29.1 29.2 29.3
+draw rect patch 0.2 -0.9 0.09 0.09
+probe rgb 156 18 0.0 1.0 0.0
+
+uniform int index 29
+uniform vec4 expect 30 30.1 30.2 30.3
+draw rect patch 0.3 -0.9 0.09 0.09
+probe rgb 168 18 0.0 1.0 0.0
diff --git a/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec3-index-rd.shader_test b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec3-index-rd.shader_test
new file mode 100644
index 0000000..d37f236
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec3-index-rd.shader_test
@@ -0,0 +1,247 @@
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+in vec4 piglit_vertex;
+
+void main()
+{
+    gl_Position = piglit_vertex;
+}
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+layout(vertices = 4) out;
+
+out block {
+  vec3 m1[16];
+  vec3 m2[15];
+} blk[];
+patch out vec3 p1[16];
+patch out vec3 p2[14];
+
+void main()
+{
+    for (int i = 0; i < 16; i++)
+        blk[gl_InvocationID].m1[i] = vec3(1.0, 1.1, 1.2) + vec3(i);
+
+    for (int i = 0; i < 15; i++)
+        blk[gl_InvocationID].m2[i] = vec3(1.0, 1.1, 1.2) + vec3(16+i);
+
+    for (int i = 0; i < 16; i++)
+        p1[i] = vec3(1.0, 1.1, 1.2) + vec3(31+i);
+
+    for (int i = 0; i < 14; i++)
+        p2[i] = vec3(1.0, 1.1, 1.2) + vec3(47+i);
+
+    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+    gl_TessLevelInner = float[2](1.0, 1.0);
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+layout(quads, equal_spacing) in;
+
+uniform int index;
+uniform vec4 expect;
+in block {
+    vec3 m1[16];
+    vec3 m2[15];
+} blk[];
+patch in vec3 p1[16];
+patch in vec3 p2[14];
+out vec4 color;
+
+#define INTERP_QUAD(INi, OUT) do { \
+    vec4 v[4]; \
+    for (int i = 0; i < 4; i++) v[i] = INi; \
+    OUT = mix(mix(v[0], v[1], gl_TessCoord[0]), mix(v[2], v[3], gl_TessCoord[0]), \
+              gl_TessCoord[1]); \
+} while(false)
+
+void main() {
+    vec4 m;
+    vec3 p;
+
+    if (index >= 16) {
+        INTERP_QUAD(blk[i].m2[index-16].xyzz, m);
+        p = p2[index-16];
+    } else {
+        INTERP_QUAD(blk[i].m1[index].xyzz, m);
+        p = p1[index];
+    }
+
+    color = m.xyz == expect.xyz && p == expect.xyz+vec3(31) ?
+        vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+    INTERP_QUAD(gl_in[i].gl_Position, gl_Position);
+}
+
+[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
+
+uniform int index 0
+uniform vec4 expect 1 1.1 1.2 1.3
+draw rect patch -1 -1 0.09 0.09
+probe rgb 6 6 0.0 1.0 0.0
+
+uniform int index 1
+uniform vec4 expect 2 2.1 2.2 2.3
+draw rect patch -0.9 -1 0.09 0.09
+probe rgb 18 6 0.0 1.0 0.0
+
+uniform int index 2
+uniform vec4 expect 3 3.1 3.2 3.3
+draw rect patch -0.8 -1 0.09 0.09
+probe rgb 31 6 0.0 1.0 0.0
+
+uniform int index 3
+uniform vec4 expect 4 4.1 4.2 4.3
+draw rect patch -0.7 -1 0.09 0.09
+probe rgb 43 6 0.0 1.0 0.0
+
+uniform int index 4
+uniform vec4 expect 5 5.1 5.2 5.3
+draw rect patch -0.6 -1 0.09 0.09
+probe rgb 56 6 0.0 1.0 0.0
+
+uniform int index 5
+uniform vec4 expect 6 6.1 6.2 6.3
+draw rect patch -0.5 -1 0.09 0.09
+probe rgb 68 6 0.0 1.0 0.0
+
+uniform int index 6
+uniform vec4 expect 7 7.1 7.2 7.3
+draw rect patch -0.4 -1 0.09 0.09
+probe rgb 81 6 0.0 1.0 0.0
+
+uniform int index 7
+uniform vec4 expect 8 8.1 8.2 8.3
+draw rect patch -0.3 -1 0.09 0.09
+probe rgb 93 6 0.0 1.0 0.0
+
+uniform int index 8
+uniform vec4 expect 9 9.1 9.2 9.3
+draw rect patch -0.2 -1 0.09 0.09
+probe rgb 106 6 0.0 1.0 0.0
+
+uniform int index 9
+uniform vec4 expect 10 10.1 10.2 10.3
+draw rect patch -0.1 -1 0.09 0.09
+probe rgb 118 6 0.0 1.0 0.0
+
+uniform int index 10
+uniform vec4 expect 11 11.1 11.2 11.3
+draw rect patch 0 -1 0.09 0.09
+probe rgb 131 6 0.0 1.0 0.0
+
+uniform int index 11
+uniform vec4 expect 12 12.1 12.2 12.3
+draw rect patch 0.1 -1 0.09 0.09
+probe rgb 143 6 0.0 1.0 0.0
+
+uniform int index 12
+uniform vec4 expect 13 13.1 13.2 13.3
+draw rect patch 0.2 -1 0.09 0.09
+probe rgb 156 6 0.0 1.0 0.0
+
+uniform int index 13
+uniform vec4 expect 14 14.1 14.2 14.3
+draw rect patch 0.3 -1 0.09 0.09
+probe rgb 168 6 0.0 1.0 0.0
+
+uniform int index 14
+uniform vec4 expect 15 15.1 15.2 15.3
+draw rect patch 0.4 -1 0.09 0.09
+probe rgb 181 6 0.0 1.0 0.0
+
+uniform int index 15
+uniform vec4 expect 16 16.1 16.2 16.3
+draw rect patch 0.5 -1.0 0.09 0.09
+probe rgb 193 6 0.0 1.0 0.0
+
+uniform int index 16
+uniform vec4 expect 17 17.1 17.2 17.3
+draw rect patch -1 -0.9 0.09 0.09
+probe rgb 6 18 0.0 1.0 0.0
+
+uniform int index 17
+uniform vec4 expect 18 18.1 18.2 18.3
+draw rect patch -0.9 -0.9 0.09 0.09
+probe rgb 18 18 0.0 1.0 0.0
+
+uniform int index 18
+uniform vec4 expect 19 19.1 19.2 19.3
+draw rect patch -0.8 -0.9 0.09 0.09
+probe rgb 31 18 0.0 1.0 0.0
+
+uniform int index 19
+uniform vec4 expect 20 20.1 20.2 20.3
+draw rect patch -0.7 -0.9 0.09 0.09
+probe rgb 43 18 0.0 1.0 0.0
+
+uniform int index 20
+uniform vec4 expect 21 21.1 21.2 21.3
+draw rect patch -0.6 -0.9 0.09 0.09
+probe rgb 56 18 0.0 1.0 0.0
+
+uniform int index 21
+uniform vec4 expect 22 22.1 22.2 22.3
+draw rect patch -0.5 -0.9 0.09 0.09
+probe rgb 68 18 0.0 1.0 0.0
+
+uniform int index 22
+uniform vec4 expect 23 23.1 23.2 23.3
+draw rect patch -0.4 -0.9 0.09 0.09
+probe rgb 81 18 0.0 1.0 0.0
+
+uniform int index 23
+uniform vec4 expect 24 24.1 24.2 24.3
+draw rect patch -0.3 -0.9 0.09 0.09
+probe rgb 93 18 0.0 1.0 0.0
+
+uniform int index 24
+uniform vec4 expect 25 25.1 25.2 25.3
+draw rect patch -0.2 -0.9 0.09 0.09
+probe rgb 106 18 0.0 1.0 0.0
+
+uniform int index 25
+uniform vec4 expect 26 26.1 26.2 26.3
+draw rect patch -0.1 -0.9 0.09 0.09
+probe rgb 118 18 0.0 1.0 0.0
+
+uniform int index 26
+uniform vec4 expect 27 27.1 27.2 27.3
+draw rect patch 0 -0.9 0.09 0.09
+probe rgb 131 18 0.0 1.0 0.0
+
+uniform int index 27
+uniform vec4 expect 28 28.1 28.2 28.3
+draw rect patch 0.1 -0.9 0.09 0.09
+probe rgb 143 18 0.0 1.0 0.0
+
+uniform int index 28
+uniform vec4 expect 29 29.1 29.2 29.3
+draw rect patch 0.2 -0.9 0.09 0.09
+probe rgb 156 18 0.0 1.0 0.0
+
+uniform int index 29
+uniform vec4 expect 30 30.1 30.2 30.3
+draw rect patch 0.3 -0.9 0.09 0.09
+probe rgb 168 18 0.0 1.0 0.0
diff --git a/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec4-index-rd.shader_test b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec4-index-rd.shader_test
new file mode 100644
index 0000000..5ace64f
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec4-index-rd.shader_test
@@ -0,0 +1,246 @@
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+in vec4 piglit_vertex;
+
+void main()
+{
+    gl_Position = piglit_vertex;
+}
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+layout(vertices = 4) out;
+
+out block {
+  vec4 m1[16];
+  vec4 m2[15];
+} blk[];
+patch out vec4 p1[16];
+patch out vec4 p2[14];
+
+void main()
+{
+    for (int i = 0; i < 16; i++)
+        blk[gl_InvocationID].m1[i] = vec4(1.0, 1.1, 1.2, 1.3) + vec4(i);
+
+    for (int i = 0; i < 15; i++)
+        blk[gl_InvocationID].m2[i] = vec4(1.0, 1.1, 1.2, 1.3) + vec4(16+i);
+
+    for (int i = 0; i < 16; i++)
+        p1[i] = vec4(1.0, 1.1, 1.2, 1.3) + vec4(31+i);
+
+    for (int i = 0; i < 14; i++)
+        p2[i] = vec4(1.0, 1.1, 1.2, 1.3) + vec4(47+i);
+
+    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+    gl_TessLevelInner = float[2](1.0, 1.0);
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+layout(quads, equal_spacing) in;
+
+uniform int index;
+uniform vec4 expect;
+in block {
+    vec4 m1[16];
+    vec4 m2[15];
+} blk[];
+patch in vec4 p1[16];
+patch in vec4 p2[14];
+out vec4 color;
+
+#define INTERP_QUAD(INi, OUT) do { \
+    vec4 v[4]; \
+    for (int i = 0; i < 4; i++) v[i] = INi; \
+    OUT = mix(mix(v[0], v[1], gl_TessCoord[0]), mix(v[2], v[3], gl_TessCoord[0]), \
+              gl_TessCoord[1]); \
+} while(false)
+
+void main() {
+    vec4 m, p;
+
+    if (index >= 16) {
+        INTERP_QUAD(blk[i].m2[index-16], m);
+        p = p2[index-16];
+    } else {
+        INTERP_QUAD(blk[i].m1[index], m);
+        p = p1[index];
+    }
+
+    color = m == expect && p == expect+vec4(31) ?
+        vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+    INTERP_QUAD(gl_in[i].gl_Position, gl_Position);
+}
+
+[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
+
+uniform int index 0
+uniform vec4 expect 1 1.1 1.2 1.3
+draw rect patch -1 -1 0.09 0.09
+probe rgb 6 6 0.0 1.0 0.0
+
+uniform int index 1
+uniform vec4 expect 2 2.1 2.2 2.3
+draw rect patch -0.9 -1 0.09 0.09
+probe rgb 18 6 0.0 1.0 0.0
+
+uniform int index 2
+uniform vec4 expect 3 3.1 3.2 3.3
+draw rect patch -0.8 -1 0.09 0.09
+probe rgb 31 6 0.0 1.0 0.0
+
+uniform int index 3
+uniform vec4 expect 4 4.1 4.2 4.3
+draw rect patch -0.7 -1 0.09 0.09
+probe rgb 43 6 0.0 1.0 0.0
+
+uniform int index 4
+uniform vec4 expect 5 5.1 5.2 5.3
+draw rect patch -0.6 -1 0.09 0.09
+probe rgb 56 6 0.0 1.0 0.0
+
+uniform int index 5
+uniform vec4 expect 6 6.1 6.2 6.3
+draw rect patch -0.5 -1 0.09 0.09
+probe rgb 68 6 0.0 1.0 0.0
+
+uniform int index 6
+uniform vec4 expect 7 7.1 7.2 7.3
+draw rect patch -0.4 -1 0.09 0.09
+probe rgb 81 6 0.0 1.0 0.0
+
+uniform int index 7
+uniform vec4 expect 8 8.1 8.2 8.3
+draw rect patch -0.3 -1 0.09 0.09
+probe rgb 93 6 0.0 1.0 0.0
+
+uniform int index 8
+uniform vec4 expect 9 9.1 9.2 9.3
+draw rect patch -0.2 -1 0.09 0.09
+probe rgb 106 6 0.0 1.0 0.0
+
+uniform int index 9
+uniform vec4 expect 10 10.1 10.2 10.3
+draw rect patch -0.1 -1 0.09 0.09
+probe rgb 118 6 0.0 1.0 0.0
+
+uniform int index 10
+uniform vec4 expect 11 11.1 11.2 11.3
+draw rect patch 0 -1 0.09 0.09
+probe rgb 131 6 0.0 1.0 0.0
+
+uniform int index 11
+uniform vec4 expect 12 12.1 12.2 12.3
+draw rect patch 0.1 -1 0.09 0.09
+probe rgb 143 6 0.0 1.0 0.0
+
+uniform int index 12
+uniform vec4 expect 13 13.1 13.2 13.3
+draw rect patch 0.2 -1 0.09 0.09
+probe rgb 156 6 0.0 1.0 0.0
+
+uniform int index 13
+uniform vec4 expect 14 14.1 14.2 14.3
+draw rect patch 0.3 -1 0.09 0.09
+probe rgb 168 6 0.0 1.0 0.0
+
+uniform int index 14
+uniform vec4 expect 15 15.1 15.2 15.3
+draw rect patch 0.4 -1 0.09 0.09
+probe rgb 181 6 0.0 1.0 0.0
+
+uniform int index 15
+uniform vec4 expect 16 16.1 16.2 16.3
+draw rect patch 0.5 -1.0 0.09 0.09
+probe rgb 193 6 0.0 1.0 0.0
+
+uniform int index 16
+uniform vec4 expect 17 17.1 17.2 17.3
+draw rect patch -1 -0.9 0.09 0.09
+probe rgb 6 18 0.0 1.0 0.0
+
+uniform int index 17
+uniform vec4 expect 18 18.1 18.2 18.3
+draw rect patch -0.9 -0.9 0.09 0.09
+probe rgb 18 18 0.0 1.0 0.0
+
+uniform int index 18
+uniform vec4 expect 19 19.1 19.2 19.3
+draw rect patch -0.8 -0.9 0.09 0.09
+probe rgb 31 18 0.0 1.0 0.0
+
+uniform int index 19
+uniform vec4 expect 20 20.1 20.2 20.3
+draw rect patch -0.7 -0.9 0.09 0.09
+probe rgb 43 18 0.0 1.0 0.0
+
+uniform int index 20
+uniform vec4 expect 21 21.1 21.2 21.3
+draw rect patch -0.6 -0.9 0.09 0.09
+probe rgb 56 18 0.0 1.0 0.0
+
+uniform int index 21
+uniform vec4 expect 22 22.1 22.2 22.3
+draw rect patch -0.5 -0.9 0.09 0.09
+probe rgb 68 18 0.0 1.0 0.0
+
+uniform int index 22
+uniform vec4 expect 23 23.1 23.2 23.3
+draw rect patch -0.4 -0.9 0.09 0.09
+probe rgb 81 18 0.0 1.0 0.0
+
+uniform int index 23
+uniform vec4 expect 24 24.1 24.2 24.3
+draw rect patch -0.3 -0.9 0.09 0.09
+probe rgb 93 18 0.0 1.0 0.0
+
+uniform int index 24
+uniform vec4 expect 25 25.1 25.2 25.3
+draw rect patch -0.2 -0.9 0.09 0.09
+probe rgb 106 18 0.0 1.0 0.0
+
+uniform int index 25
+uniform vec4 expect 26 26.1 26.2 26.3
+draw rect patch -0.1 -0.9 0.09 0.09
+probe rgb 118 18 0.0 1.0 0.0
+
+uniform int index 26
+uniform vec4 expect 27 27.1 27.2 27.3
+draw rect patch 0 -0.9 0.09 0.09
+probe rgb 131 18 0.0 1.0 0.0
+
+uniform int index 27
+uniform vec4 expect 28 28.1 28.2 28.3
+draw rect patch 0.1 -0.9 0.09 0.09
+probe rgb 143 18 0.0 1.0 0.0
+
+uniform int index 28
+uniform vec4 expect 29 29.1 29.2 29.3
+draw rect patch 0.2 -0.9 0.09 0.09
+probe rgb 156 18 0.0 1.0 0.0
+
+uniform int index 29
+uniform vec4 expect 30 30.1 30.2 30.3
+draw rect patch 0.3 -0.9 0.09 0.09
+probe rgb 168 18 0.0 1.0 0.0
-- 
2.1.0



More information about the Piglit mailing list