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

Submitted by Marek Olšák on March 26, 2018, 11:32 p.m.

Details

Message ID 20180326233255.18529-15-maraeo@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Marek Olšák March 26, 2018, 11:32 p.m.
From: Nicolai Hähnle <nicolai.haehnle@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

Patch hide | download patch | download mbox

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

Comments

On 27/03/18 10:32, Marek Olšák wrote:
> From: Nicolai Hähnle <nicolai.haehnle@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;

remove ???


> +    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
>
On Tue, Apr 3, 2018 at 9:16 PM, Timothy Arceri <tarceri@itsqueeze.com>
wrote:

>
>
> On 27/03/18 10:32, Marek Olšák wrote:
>
>> From: Nicolai Hähnle <nicolai.haehnle@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_sh
>> ader/execution/variable-indexing/tcs-tes-array-in-struct.shader_test
>>
>> diff --git a/tests/spec/arb_tessellation_shader/execution/variable-inde
>> xing/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-inde
>> xing/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;
>>
>
> remove ???


Yes. That can be removed.

Marek