[Piglit] [PATCH 07/13] arb_tessellation_shader: add tests for indirect addressing of VS outputs w/ TCS

Ian Romanick idr at freedesktop.org
Mon Apr 6 18:51:32 PDT 2015


On 04/06/2015 04:39 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>  ...put-array-float-index-wr-before-tcs.shader_test | 224 +++++++++++++++++++++
>  ...tput-array-vec2-index-wr-before-tcs.shader_test | 224 +++++++++++++++++++++
>  ...tput-array-vec3-index-wr-before-tcs.shader_test | 224 +++++++++++++++++++++
>  ...tput-array-vec4-index-wr-before-tcs.shader_test | 224 +++++++++++++++++++++
>  4 files changed, 896 insertions(+)
>  create mode 100644 tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-float-index-wr-before-tcs.shader_test
>  create mode 100644 tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec2-index-wr-before-tcs.shader_test
>  create mode 100644 tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec3-index-wr-before-tcs.shader_test
>  create mode 100644 tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec4-index-wr-before-tcs.shader_test
> 
> diff --git a/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-float-index-wr-before-tcs.shader_test b/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-float-index-wr-before-tcs.shader_test
> new file mode 100644
> index 0000000..fc0e2eb
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-float-index-wr-before-tcs.shader_test
> @@ -0,0 +1,224 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_tessellation_shader
> +
> +[vertex shader]
> +#version 150
> +
> +uniform int index;
> +in vec4 piglit_vertex;
> +
> +out block {
> +  float m1[16];
> +  float m2[15];
> +} vs;
> +
> +void main()
> +{
> +    gl_Position = piglit_vertex;
> +
> +    for (int i = 0; i < 16; i++)
> +        vs.m1[i] = 1.0 + float(i);
> +
> +    for (int i = 0; i < 15; i++)
> +        vs.m2[i] = 1.0 + float(16+i);
> +
> +    if (index >= 16)
> +        vs.m2[index-16] = 0.0;
> +    else
> +        vs.m1[index] = 0.0;
> +}
> +
> +[tessellation control shader]
> +#version 150
> +#extension GL_ARB_tessellation_shader : require
> +layout(vertices = 4) out;
> +
> +uniform int index;
> +in block {
> +    float m1[16];
> +    float m2[15];
> +} vs[];
> +out vec4 color[];
> +
> +void main()
> +{
> +    bool pass = true;
> +
> +    for (int i = 0; i < 16; i++)
> +        pass = pass && vs[gl_InvocationID].m1[i] == (index == i ?
> +                                       0.0 :
> +                                       1.0 + float(i));
> +
> +    for (int i = 0; i < 15; i++)
> +        pass = pass && vs[gl_InvocationID].m2[i] == (index == 16+i ?
> +                                       0.0 :
> +                                       17.0 + float(i));
> +
> +    color[gl_InvocationID] = pass ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> +
> +    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;
> +
> +in vec4 color[];
> +out vec4 fscolor;
> +
> +#define INTERP_QUAD(INi, OUT) { \
> +    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]); \
> +}

Should use the 'do { } while (false)' idiom here.  My brain keeps
screaming, "What about the missing semicolons?!?!?"

> +
> +void main() {
> +    INTERP_QUAD(gl_in[i].gl_Position, gl_Position)
> +    INTERP_QUAD(color[i], fscolor)
> +}
> +
> +[fragment shader]
> +#version 150
> +in vec4 fscolor;
> +out vec4 outcolor;
> +
> +void main()
> +{
> +    outcolor = fscolor;
> +}
> +
> +[test]
> +clear color 0.5 0.5 0.5 0.5
> +clear
> +
> +patch parameter vertices 4
> +
> +uniform int index 0
> +draw rect patch -1 -1 0.09 0.09
> +#draw arrays GL_PATCHES 0 4
> +probe rgb 6 6 0.0 1.0 0.0
> +
> +uniform int index 1
> +draw rect patch -0.9 -1 0.09 0.09
> +probe rgb 18 6 0.0 1.0 0.0
> +
> +uniform int index 2
> +draw rect patch -0.8 -1 0.09 0.09
> +probe rgb 31 6 0.0 1.0 0.0
> +
> +uniform int index 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
> +draw rect patch -0.6 -1 0.09 0.09
> +probe rgb 56 6 0.0 1.0 0.0
> +
> +uniform int index 5
> +draw rect patch -0.5 -1 0.09 0.09
> +probe rgb 68 6 0.0 1.0 0.0
> +
> +uniform int index 6
> +draw rect patch -0.4 -1 0.09 0.09
> +probe rgb 81 6 0.0 1.0 0.0
> +
> +uniform int index 7
> +draw rect patch -0.3 -1 0.09 0.09
> +probe rgb 93 6 0.0 1.0 0.0
> +
> +uniform int index 8
> +draw rect patch -0.2 -1 0.09 0.09
> +probe rgb 106 6 0.0 1.0 0.0
> +
> +uniform int index 9
> +draw rect patch -0.1 -1 0.09 0.09
> +probe rgb 118 6 0.0 1.0 0.0
> +
> +uniform int index 10
> +draw rect patch 0 -1 0.09 0.09
> +probe rgb 131 6 0.0 1.0 0.0
> +
> +uniform int index 11
> +draw rect patch 0.1 -1 0.09 0.09
> +probe rgb 143 6 0.0 1.0 0.0
> +
> +uniform int index 12
> +draw rect patch 0.2 -1 0.09 0.09
> +probe rgb 156 6 0.0 1.0 0.0
> +
> +uniform int index 13
> +draw rect patch 0.3 -1 0.09 0.09
> +probe rgb 168 6 0.0 1.0 0.0
> +
> +uniform int index 14
> +draw rect patch 0.4 -1 0.09 0.09
> +probe rgb 181 6 0.0 1.0 0.0
> +
> +uniform int index 15
> +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
> +draw rect patch -1 -0.9 0.09 0.09
> +probe rgb 6 18 0.0 1.0 0.0
> +
> +uniform int index 17
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +draw rect patch 0 -0.9 0.09 0.09
> +probe rgb 131 18 0.0 1.0 0.0
> +
> +uniform int index 27
> +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
> +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
> +draw rect patch 0.3 -0.9 0.09 0.09
> +probe rgb 168 18 0.0 1.0 0.0
> +
> +uniform int index 30
> +draw rect patch 0.4 -0.9 0.09 0.09
> +probe rgb 181 18 0.0 1.0 0.0
> diff --git a/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec2-index-wr-before-tcs.shader_test b/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec2-index-wr-before-tcs.shader_test
> new file mode 100644
> index 0000000..f3c2315
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec2-index-wr-before-tcs.shader_test
> @@ -0,0 +1,224 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_tessellation_shader
> +
> +[vertex shader]
> +#version 150
> +
> +uniform int index;
> +in vec4 piglit_vertex;
> +
> +out block {
> +  vec2 m1[16];
> +  vec2 m2[15];
> +} vs;
> +
> +void main()
> +{
> +    gl_Position = piglit_vertex;
> +
> +    for (int i = 0; i < 16; i++)
> +        vs.m1[i] = vec2(1.0, 1.1) + vec2(i);
> +
> +    for (int i = 0; i < 15; i++)
> +        vs.m2[i] = vec2(1.0, 1.1) + vec2(16+i);
> +
> +    if (index >= 16)
> +        vs.m2[index-16] = vec2(0.0, 0.1);
> +    else
> +        vs.m1[index] = vec2(0.0, 0.1);
> +}
> +
> +[tessellation control shader]
> +#version 150
> +#extension GL_ARB_tessellation_shader : require
> +layout(vertices = 4) out;
> +
> +uniform int index;
> +in block {
> +    vec2 m1[16];
> +    vec2 m2[15];
> +} vs[];
> +out vec4 color[];
> +
> +void main()
> +{
> +    bool pass = true;
> +
> +    for (int i = 0; i < 16; i++)
> +        pass = pass && vs[gl_InvocationID].m1[i] == (index == i ?
> +                                       vec2(0.0, 0.1) :
> +                                       vec2(1.0, 1.1) + vec2(i));
> +
> +    for (int i = 0; i < 15; i++)
> +        pass = pass && vs[gl_InvocationID].m2[i] == (index == 16+i ?
> +                                       vec2(0.0, 0.1) :
> +                                       vec2(17.0, 17.1) + vec2(i));
> +
> +    color[gl_InvocationID] = pass ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> +
> +    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;
> +
> +in vec4 color[];
> +out vec4 fscolor;
> +
> +#define INTERP_QUAD(INi, OUT) { \
> +    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]); \
> +}
> +
> +void main() {
> +    INTERP_QUAD(gl_in[i].gl_Position, gl_Position)
> +    INTERP_QUAD(color[i], fscolor)
> +}
> +
> +[fragment shader]
> +#version 150
> +in vec4 fscolor;
> +out vec4 outcolor;
> +
> +void main()
> +{
> +    outcolor = fscolor;
> +}
> +
> +[test]
> +clear color 0.5 0.5 0.5 0.5
> +clear
> +
> +patch parameter vertices 4
> +
> +uniform int index 0
> +draw rect patch -1 -1 0.09 0.09
> +#draw arrays GL_PATCHES 0 4
> +probe rgb 6 6 0.0 1.0 0.0
> +
> +uniform int index 1
> +draw rect patch -0.9 -1 0.09 0.09
> +probe rgb 18 6 0.0 1.0 0.0
> +
> +uniform int index 2
> +draw rect patch -0.8 -1 0.09 0.09
> +probe rgb 31 6 0.0 1.0 0.0
> +
> +uniform int index 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
> +draw rect patch -0.6 -1 0.09 0.09
> +probe rgb 56 6 0.0 1.0 0.0
> +
> +uniform int index 5
> +draw rect patch -0.5 -1 0.09 0.09
> +probe rgb 68 6 0.0 1.0 0.0
> +
> +uniform int index 6
> +draw rect patch -0.4 -1 0.09 0.09
> +probe rgb 81 6 0.0 1.0 0.0
> +
> +uniform int index 7
> +draw rect patch -0.3 -1 0.09 0.09
> +probe rgb 93 6 0.0 1.0 0.0
> +
> +uniform int index 8
> +draw rect patch -0.2 -1 0.09 0.09
> +probe rgb 106 6 0.0 1.0 0.0
> +
> +uniform int index 9
> +draw rect patch -0.1 -1 0.09 0.09
> +probe rgb 118 6 0.0 1.0 0.0
> +
> +uniform int index 10
> +draw rect patch 0 -1 0.09 0.09
> +probe rgb 131 6 0.0 1.0 0.0
> +
> +uniform int index 11
> +draw rect patch 0.1 -1 0.09 0.09
> +probe rgb 143 6 0.0 1.0 0.0
> +
> +uniform int index 12
> +draw rect patch 0.2 -1 0.09 0.09
> +probe rgb 156 6 0.0 1.0 0.0
> +
> +uniform int index 13
> +draw rect patch 0.3 -1 0.09 0.09
> +probe rgb 168 6 0.0 1.0 0.0
> +
> +uniform int index 14
> +draw rect patch 0.4 -1 0.09 0.09
> +probe rgb 181 6 0.0 1.0 0.0
> +
> +uniform int index 15
> +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
> +draw rect patch -1 -0.9 0.09 0.09
> +probe rgb 6 18 0.0 1.0 0.0
> +
> +uniform int index 17
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +draw rect patch 0 -0.9 0.09 0.09
> +probe rgb 131 18 0.0 1.0 0.0
> +
> +uniform int index 27
> +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
> +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
> +draw rect patch 0.3 -0.9 0.09 0.09
> +probe rgb 168 18 0.0 1.0 0.0
> +
> +uniform int index 30
> +draw rect patch 0.4 -0.9 0.09 0.09
> +probe rgb 181 18 0.0 1.0 0.0
> diff --git a/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec3-index-wr-before-tcs.shader_test b/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec3-index-wr-before-tcs.shader_test
> new file mode 100644
> index 0000000..3c53ce1
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec3-index-wr-before-tcs.shader_test
> @@ -0,0 +1,224 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_tessellation_shader
> +
> +[vertex shader]
> +#version 150
> +
> +uniform int index;
> +in vec4 piglit_vertex;
> +
> +out block {
> +  vec3 m1[16];
> +  vec3 m2[15];
> +} vs;
> +
> +void main()
> +{
> +    gl_Position = piglit_vertex;
> +
> +    for (int i = 0; i < 16; i++)
> +        vs.m1[i] = vec3(1.0, 1.1, 1.2) + vec3(i);
> +
> +    for (int i = 0; i < 15; i++)
> +        vs.m2[i] = vec3(1.0, 1.1, 1.2) + vec3(16+i);
> +
> +    if (index >= 16)
> +        vs.m2[index-16] = vec3(0.0, 0.1, 0.2);
> +    else
> +        vs.m1[index] = vec3(0.0, 0.1, 0.2);
> +}
> +
> +[tessellation control shader]
> +#version 150
> +#extension GL_ARB_tessellation_shader : require
> +layout(vertices = 4) out;
> +
> +uniform int index;
> +in block {
> +    vec3 m1[16];
> +    vec3 m2[15];
> +} vs[];
> +out vec4 color[];
> +
> +void main()
> +{
> +    bool pass = true;
> +
> +    for (int i = 0; i < 16; i++)
> +        pass = pass && vs[gl_InvocationID].m1[i] == (index == i ?
> +                                       vec3(0.0, 0.1, 0.2) :
> +                                       vec3(1.0, 1.1, 1.2) + vec3(i));
> +
> +    for (int i = 0; i < 15; i++)
> +        pass = pass && vs[gl_InvocationID].m2[i] == (index == 16+i ?
> +                                       vec3(0.0, 0.1, 0.2) :
> +                                       vec3(17.0, 17.1, 17.2) + vec3(i));
> +
> +    color[gl_InvocationID] = pass ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> +
> +    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;
> +
> +in vec4 color[];
> +out vec4 fscolor;
> +
> +#define INTERP_QUAD(INi, OUT) { \
> +    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]); \
> +}
> +
> +void main() {
> +    INTERP_QUAD(gl_in[i].gl_Position, gl_Position)
> +    INTERP_QUAD(color[i], fscolor)
> +}
> +
> +[fragment shader]
> +#version 150
> +in vec4 fscolor;
> +out vec4 outcolor;
> +
> +void main()
> +{
> +    outcolor = fscolor;
> +}
> +
> +[test]
> +clear color 0.5 0.5 0.5 0.5
> +clear
> +
> +patch parameter vertices 4
> +
> +uniform int index 0
> +draw rect patch -1 -1 0.09 0.09
> +#draw arrays GL_PATCHES 0 4
> +probe rgb 6 6 0.0 1.0 0.0
> +
> +uniform int index 1
> +draw rect patch -0.9 -1 0.09 0.09
> +probe rgb 18 6 0.0 1.0 0.0
> +
> +uniform int index 2
> +draw rect patch -0.8 -1 0.09 0.09
> +probe rgb 31 6 0.0 1.0 0.0
> +
> +uniform int index 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
> +draw rect patch -0.6 -1 0.09 0.09
> +probe rgb 56 6 0.0 1.0 0.0
> +
> +uniform int index 5
> +draw rect patch -0.5 -1 0.09 0.09
> +probe rgb 68 6 0.0 1.0 0.0
> +
> +uniform int index 6
> +draw rect patch -0.4 -1 0.09 0.09
> +probe rgb 81 6 0.0 1.0 0.0
> +
> +uniform int index 7
> +draw rect patch -0.3 -1 0.09 0.09
> +probe rgb 93 6 0.0 1.0 0.0
> +
> +uniform int index 8
> +draw rect patch -0.2 -1 0.09 0.09
> +probe rgb 106 6 0.0 1.0 0.0
> +
> +uniform int index 9
> +draw rect patch -0.1 -1 0.09 0.09
> +probe rgb 118 6 0.0 1.0 0.0
> +
> +uniform int index 10
> +draw rect patch 0 -1 0.09 0.09
> +probe rgb 131 6 0.0 1.0 0.0
> +
> +uniform int index 11
> +draw rect patch 0.1 -1 0.09 0.09
> +probe rgb 143 6 0.0 1.0 0.0
> +
> +uniform int index 12
> +draw rect patch 0.2 -1 0.09 0.09
> +probe rgb 156 6 0.0 1.0 0.0
> +
> +uniform int index 13
> +draw rect patch 0.3 -1 0.09 0.09
> +probe rgb 168 6 0.0 1.0 0.0
> +
> +uniform int index 14
> +draw rect patch 0.4 -1 0.09 0.09
> +probe rgb 181 6 0.0 1.0 0.0
> +
> +uniform int index 15
> +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
> +draw rect patch -1 -0.9 0.09 0.09
> +probe rgb 6 18 0.0 1.0 0.0
> +
> +uniform int index 17
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +draw rect patch 0 -0.9 0.09 0.09
> +probe rgb 131 18 0.0 1.0 0.0
> +
> +uniform int index 27
> +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
> +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
> +draw rect patch 0.3 -0.9 0.09 0.09
> +probe rgb 168 18 0.0 1.0 0.0
> +
> +uniform int index 30
> +draw rect patch 0.4 -0.9 0.09 0.09
> +probe rgb 181 18 0.0 1.0 0.0
> diff --git a/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec4-index-wr-before-tcs.shader_test b/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec4-index-wr-before-tcs.shader_test
> new file mode 100644
> index 0000000..1dd1a5c
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/execution/variable-indexing/vs-output-array-vec4-index-wr-before-tcs.shader_test
> @@ -0,0 +1,224 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_tessellation_shader
> +
> +[vertex shader]
> +#version 150
> +
> +uniform int index;
> +in vec4 piglit_vertex;
> +
> +out block {
> +  vec4 m1[16];
> +  vec4 m2[15];
> +} vs;
> +
> +void main()
> +{
> +    gl_Position = piglit_vertex;
> +
> +    for (int i = 0; i < 16; i++)
> +        vs.m1[i] = vec4(1.0, 1.1, 1.2, 1.3) + vec4(i);
> +
> +    for (int i = 0; i < 15; i++)
> +        vs.m2[i] = vec4(1.0, 1.1, 1.2, 1.3) + vec4(16+i);
> +
> +    if (index >= 16)
> +        vs.m2[index-16] = vec4(0.0, 0.1, 0.2, 0.3);
> +    else
> +        vs.m1[index] = vec4(0.0, 0.1, 0.2, 0.3);
> +}
> +
> +[tessellation control shader]
> +#version 150
> +#extension GL_ARB_tessellation_shader : require
> +layout(vertices = 4) out;
> +
> +uniform int index;
> +in block {
> +    vec4 m1[16];
> +    vec4 m2[15];
> +} vs[];
> +out vec4 color[];
> +
> +void main()
> +{
> +    bool pass = true;
> +
> +    for (int i = 0; i < 16; i++)
> +        pass = pass && vs[gl_InvocationID].m1[i] == (index == i ?
> +                                       vec4(0.0, 0.1, 0.2, 0.3) :
> +                                       vec4(1.0, 1.1, 1.2, 1.3) + vec4(i));
> +
> +    for (int i = 0; i < 15; i++)
> +        pass = pass && vs[gl_InvocationID].m2[i] == (index == 16+i ?
> +                                       vec4(0.0, 0.1, 0.2, 0.3) :
> +                                       vec4(17.0, 17.1, 17.2, 17.3) + vec4(i));
> +
> +    color[gl_InvocationID] = pass ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> +
> +    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;
> +
> +in vec4 color[];
> +out vec4 fscolor;
> +
> +#define INTERP_QUAD(INi, OUT) { \
> +    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]); \
> +}
> +
> +void main() {
> +    INTERP_QUAD(gl_in[i].gl_Position, gl_Position)
> +    INTERP_QUAD(color[i], fscolor)
> +}
> +
> +[fragment shader]
> +#version 150
> +in vec4 fscolor;
> +out vec4 outcolor;
> +
> +void main()
> +{
> +    outcolor = fscolor;
> +}
> +
> +[test]
> +clear color 0.5 0.5 0.5 0.5
> +clear
> +
> +patch parameter vertices 4
> +
> +uniform int index 0
> +draw rect patch -1 -1 0.09 0.09
> +#draw arrays GL_PATCHES 0 4
> +probe rgb 6 6 0.0 1.0 0.0
> +
> +uniform int index 1
> +draw rect patch -0.9 -1 0.09 0.09
> +probe rgb 18 6 0.0 1.0 0.0
> +
> +uniform int index 2
> +draw rect patch -0.8 -1 0.09 0.09
> +probe rgb 31 6 0.0 1.0 0.0
> +
> +uniform int index 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
> +draw rect patch -0.6 -1 0.09 0.09
> +probe rgb 56 6 0.0 1.0 0.0
> +
> +uniform int index 5
> +draw rect patch -0.5 -1 0.09 0.09
> +probe rgb 68 6 0.0 1.0 0.0
> +
> +uniform int index 6
> +draw rect patch -0.4 -1 0.09 0.09
> +probe rgb 81 6 0.0 1.0 0.0
> +
> +uniform int index 7
> +draw rect patch -0.3 -1 0.09 0.09
> +probe rgb 93 6 0.0 1.0 0.0
> +
> +uniform int index 8
> +draw rect patch -0.2 -1 0.09 0.09
> +probe rgb 106 6 0.0 1.0 0.0
> +
> +uniform int index 9
> +draw rect patch -0.1 -1 0.09 0.09
> +probe rgb 118 6 0.0 1.0 0.0
> +
> +uniform int index 10
> +draw rect patch 0 -1 0.09 0.09
> +probe rgb 131 6 0.0 1.0 0.0
> +
> +uniform int index 11
> +draw rect patch 0.1 -1 0.09 0.09
> +probe rgb 143 6 0.0 1.0 0.0
> +
> +uniform int index 12
> +draw rect patch 0.2 -1 0.09 0.09
> +probe rgb 156 6 0.0 1.0 0.0
> +
> +uniform int index 13
> +draw rect patch 0.3 -1 0.09 0.09
> +probe rgb 168 6 0.0 1.0 0.0
> +
> +uniform int index 14
> +draw rect patch 0.4 -1 0.09 0.09
> +probe rgb 181 6 0.0 1.0 0.0
> +
> +uniform int index 15
> +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
> +draw rect patch -1 -0.9 0.09 0.09
> +probe rgb 6 18 0.0 1.0 0.0
> +
> +uniform int index 17
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +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
> +draw rect patch 0 -0.9 0.09 0.09
> +probe rgb 131 18 0.0 1.0 0.0
> +
> +uniform int index 27
> +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
> +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
> +draw rect patch 0.3 -0.9 0.09 0.09
> +probe rgb 168 18 0.0 1.0 0.0
> +
> +uniform int index 30
> +draw rect patch 0.4 -0.9 0.09 0.09
> +probe rgb 181 18 0.0 1.0 0.0
> 



More information about the Piglit mailing list