[Piglit] [PATCH] Test unsized arrays in interface blocks
Jordan Justen
jljusten at gmail.com
Wed Oct 16 09:08:58 CEST 2013
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
On Fri, Sep 27, 2013 at 9:02 AM, Paul Berry <stereotype441 at gmail.com> wrote:
> These tests verify that unsized arrays appearing inside interface
> blocks obey the same rules as unsized arrays appearing outside
> interface blocks. Namely, their size is inferred from the largest
> constant integer index used to access them across all compilation
> units for the same shader stage, and this inferred size is used to
> validate that interface blocks are properly matched between one shader
> stage and the next.
> ---
> ...unsized-in-named-interface-block-gs.shader_test | 67 +++++++++
> ...d-in-named-interface-block-multiple.shader_test | 154 ++++++++++++++++++++
> .../unsized-in-named-interface-block.shader_test | 50 +++++++
> ...sized-in-unnamed-interface-block-gs.shader_test | 67 +++++++++
> ...in-unnamed-interface-block-multiple.shader_test | 155 +++++++++++++++++++++
> .../unsized-in-unnamed-interface-block.shader_test | 51 +++++++
> ...unsized-in-named-interface-block-gs.shader_test | 56 ++++++++
> .../unsized-in-named-interface-block.shader_test | 39 ++++++
> ...sized-in-unnamed-interface-block-gs.shader_test | 57 ++++++++
> .../unsized-in-unnamed-interface-block.shader_test | 40 ++++++
> 10 files changed, 736 insertions(+)
> create mode 100644 tests/spec/glsl-1.50/execution/unsized-in-named-interface-block-gs.shader_test
> create mode 100644 tests/spec/glsl-1.50/execution/unsized-in-named-interface-block-multiple.shader_test
> create mode 100644 tests/spec/glsl-1.50/execution/unsized-in-named-interface-block.shader_test
> create mode 100644 tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block-gs.shader_test
> create mode 100644 tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block-multiple.shader_test
> create mode 100644 tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block.shader_test
> create mode 100644 tests/spec/glsl-1.50/linker/unsized-in-named-interface-block-gs.shader_test
> create mode 100644 tests/spec/glsl-1.50/linker/unsized-in-named-interface-block.shader_test
> create mode 100644 tests/spec/glsl-1.50/linker/unsized-in-unnamed-interface-block-gs.shader_test
> create mode 100644 tests/spec/glsl-1.50/linker/unsized-in-unnamed-interface-block.shader_test
>
> diff --git a/tests/spec/glsl-1.50/execution/unsized-in-named-interface-block-gs.shader_test b/tests/spec/glsl-1.50/execution/unsized-in-named-interface-block-gs.shader_test
> new file mode 100644
> index 0000000..d2f3ff1
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/unsized-in-named-interface-block-gs.shader_test
> @@ -0,0 +1,67 @@
> +# Test that when an interface block contains members which are unsized
> +# arrays, the standard rules are applied in order to determine the
> +# array sizes (namely, the sizes should be inferred from the maximum
> +# array element accessed).
> +#
> +# In this test, there is a vertex shader output which uses an array
> +# size of 2, and a geometry shader input that uses an array size of 2,
> +# so there should be no error.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out blk {
> + float foo[];
> +} ifc_name;
> +
> +void main()
> +{
> + ifc_name.foo[0] = 1.0;
> + ifc_name.foo[1] = 10.0;
> + gl_Position = piglit_vertex;
> +}
> +
> +[geometry shader]
> +#version 150
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +in blk {
> + float foo[];
> +} ifc_name[];
> +out float ok;
> +
> +void main()
> +{
> + bool pass = true;
> + for (int i = 0; i < 3; i++) {
> + if (ifc_name[i].foo[0] != 1.0)
> + pass = false;
> + if (ifc_name[i].foo[1] != 10.0)
> + pass = false;
> + }
> + for (int i = 0; i < 3; i++) {
> + gl_Position = gl_in[i].gl_Position;
> + ok = pass ? 1.0 : 0.0;
> + EmitVertex();
> + }
> +}
> +
> +[fragment shader]
> +#version 150
> +in float ok;
> +
> +void main()
> +{
> + bool pass = true;
> + if (ok == 1.0)
> + gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
> + else
> + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/spec/glsl-1.50/execution/unsized-in-named-interface-block-multiple.shader_test b/tests/spec/glsl-1.50/execution/unsized-in-named-interface-block-multiple.shader_test
> new file mode 100644
> index 0000000..b0a730f
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/unsized-in-named-interface-block-multiple.shader_test
> @@ -0,0 +1,154 @@
> +# Test that when an interface block contains members which are unsized
> +# arrays, and that interface block is used across multiple shaders of
> +# the same type, the size of the array is inferred from the maximum
> +# array element accessed *across all shaders*.
> +#
> +# This test uses a vertex shader and a geometry shader (the geometry
> +# shader allows us to conveniently test an array of interface blocks).
> +# There are four varyings, all of which are float arrays:
> +#
> +# - blk1.var1
> +# - blk1.var2
> +# - blk2.var1
> +# - blk2.var2
> +#
> +# The varyings in blk1 are declared unsized in the vs and declared
> +# with size 2 in the gs. The varyings in blk2 are declared unsized in
> +# the gs and declared with size 2 in the vs.
> +#
> +# There are two vertex shader compilation units and two fragment
> +# shader compilation units. In each case, var1 has element 0 accessed
> +# in the first compilation unit and element 1 accessed in the second
> +# compilation unit; var2 has the reverse pattern. This ensures that
> +# the linker should infer a size of 2 for all varyings.
> +#
> +# This means that linking should only succeed if the linker properly
> +# tracks the maximum array element accessed across all shaders.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out blk1 {
> + float var1[];
> + float var2[];
> +} ifc1;
> +out blk2 {
> + float var1[2];
> + float var2[2];
> +} ifc2;
> +
> +void foo();
> +
> +void main()
> +{
> + foo();
> + ifc1.var1[0] = 1.0;
> + ifc1.var2[1] = 2.0;
> + ifc2.var1[0] = 3.0;
> + ifc2.var2[1] = 4.0;
> + gl_Position = piglit_vertex;
> +}
> +
> +[vertex shader]
> +#version 150
> +out blk1 {
> + float var1[];
> + float var2[];
> +} ifc1;
> +out blk2 {
> + float var1[2];
> + float var2[2];
> +} ifc2;
> +
> +void foo()
> +{
> + ifc1.var1[1] = 5.0;
> + ifc1.var2[0] = 6.0;
> + ifc2.var1[1] = 7.0;
> + ifc2.var2[0] = 8.0;
> +}
> +
> +[geometry shader]
> +#version 150
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +in blk1 {
> + float var1[2];
> + float var2[2];
> +} ifc1[];
> +in blk2 {
> + float var1[];
> + float var2[];
> +} ifc2[];
> +out float ok;
> +
> +bool foo(int i);
> +
> +void main()
> +{
> + bool pass = true;
> + for (int i = 0; i < 3; i++) {
> + if (!foo(i))
> + pass = false;
> + if (ifc1[i].var1[0] != 1.0)
> + pass = false;
> + if (ifc1[i].var2[1] != 2.0)
> + pass = false;
> + if (ifc2[i].var1[0] != 3.0)
> + pass = false;
> + if (ifc2[i].var2[1] != 4.0)
> + pass = false;
> + }
> + for (int i = 0; i < 3; i++) {
> + gl_Position = gl_in[i].gl_Position;
> + ok = pass ? 1.0 : 0.0;
> + EmitVertex();
> + }
> +}
> +
> +[geometry shader]
> +#version 150
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +in blk1 {
> + float var1[2];
> + float var2[2];
> +} ifc1[];
> +in blk2 {
> + float var1[];
> + float var2[];
> +} ifc2[];
> +
> +bool foo(int i)
> +{
> + bool pass = true;
> + if (ifc1[i].var1[1] != 5.0)
> + pass = false;
> + if (ifc1[i].var2[0] != 6.0)
> + pass = false;
> + if (ifc2[i].var1[1] != 7.0)
> + pass = false;
> + if (ifc2[i].var2[0] != 8.0)
> + pass = false;
> + return pass;
> +}
> +
> +[fragment shader]
> +#version 150
> +in float ok;
> +
> +void main()
> +{
> + bool pass = true;
> + if (ok == 1.0)
> + gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
> + else
> + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/spec/glsl-1.50/execution/unsized-in-named-interface-block.shader_test b/tests/spec/glsl-1.50/execution/unsized-in-named-interface-block.shader_test
> new file mode 100644
> index 0000000..ab58cf0
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/unsized-in-named-interface-block.shader_test
> @@ -0,0 +1,50 @@
> +# Test that when an interface block contains members which are unsized
> +# arrays, the standard rules are applied in order to determine the
> +# array sizes (namely, the sizes should be inferred from the maximum
> +# array element accessed).
> +#
> +# In this test, both the vertex shader and the fragment shader use an
> +# array size of 3, so there should be no error.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out blk {
> + float foo[];
> +} ifc_name;
> +
> +void main()
> +{
> + ifc_name.foo[0] = 1.0;
> + ifc_name.foo[1] = 10.0;
> + ifc_name.foo[2] = 100.0;
> + gl_Position = piglit_vertex;
> +}
> +
> +[fragment shader]
> +#version 150
> +in blk {
> + float foo[];
> +} ifc_name;
> +
> +void main()
> +{
> + bool pass = true;
> + if (ifc_name.foo[0] != 1.0)
> + pass = false;
> + if (ifc_name.foo[1] != 10.0)
> + pass = false;
> + if (ifc_name.foo[2] != 100.0)
> + pass = false;
> + if (pass)
> + gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
> + else
> + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block-gs.shader_test b/tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block-gs.shader_test
> new file mode 100644
> index 0000000..6f389c0
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block-gs.shader_test
> @@ -0,0 +1,67 @@
> +# Test that when an interface block contains members which are unsized
> +# arrays, the standard rules are applied in order to determine the
> +# array sizes (namely, the sizes should be inferred from the maximum
> +# array element accessed).
> +#
> +# In this test, there is a vertex shader output which an unnamed
> +# interface block and an array size of 2, and a geometry shader input
> +# that uses an array size of 2, so there should be no error.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out blk {
> + float foo[];
> +};
> +
> +void main()
> +{
> + foo[0] = 1.0;
> + foo[1] = 10.0;
> + gl_Position = piglit_vertex;
> +}
> +
> +[geometry shader]
> +#version 150
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +in blk {
> + float foo[];
> +} ifc_name[];
> +out float ok;
> +
> +void main()
> +{
> + bool pass = true;
> + for (int i = 0; i < 3; i++) {
> + if (ifc_name[i].foo[0] != 1.0)
> + pass = false;
> + if (ifc_name[i].foo[1] != 10.0)
> + pass = false;
> + }
> + for (int i = 0; i < 3; i++) {
> + gl_Position = gl_in[i].gl_Position;
> + ok = pass ? 1.0 : 0.0;
> + EmitVertex();
> + }
> +}
> +
> +[fragment shader]
> +#version 150
> +in float ok;
> +
> +void main()
> +{
> + bool pass = true;
> + if (ok == 1.0)
> + gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
> + else
> + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block-multiple.shader_test b/tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block-multiple.shader_test
> new file mode 100644
> index 0000000..853db65
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block-multiple.shader_test
> @@ -0,0 +1,155 @@
> +# Test that when an interface block contains members which are unsized
> +# arrays, and that interface block is used across multiple shaders of
> +# the same type, the size of the array is inferred from the maximum
> +# array element accessed *across all shaders*.
> +#
> +# This test uses a vertex shader and a geometry shader (the geometry
> +# shader allows us to conveniently test an array of interface blocks).
> +# There are four varyings, all of which are float arrays:
> +#
> +# - blk1.var1_1
> +# - blk1.var1_2
> +# - blk2.var2_1
> +# - blk2.var2_2
> +#
> +# The varyings in blk1 are declared unsized in the vs and declared
> +# with size 2 in the gs. The varyings in blk2 are declared unsized in
> +# the gs and declared with size 2 in the vs. All the interface blocks
> +# are unnamed in the vertex shader.
> +#
> +# There are two vertex shader compilation units and two fragment
> +# shader compilation units. In each case, var1 has element 0 accessed
> +# in the first compilation unit and element 1 accessed in the second
> +# compilation unit; var2 has the reverse pattern. This ensures that
> +# the linker should infer a size of 2 for all varyings.
> +#
> +# This means that linking should only succeed if the linker properly
> +# tracks the maximum array element accessed across all shaders.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out blk1 {
> + float var1_1[];
> + float var1_2[];
> +};
> +out blk2 {
> + float var2_1[2];
> + float var2_2[2];
> +};
> +
> +void foo();
> +
> +void main()
> +{
> + foo();
> + var1_1[0] = 1.0;
> + var1_2[1] = 2.0;
> + var2_1[0] = 3.0;
> + var2_2[1] = 4.0;
> + gl_Position = piglit_vertex;
> +}
> +
> +[vertex shader]
> +#version 150
> +out blk1 {
> + float var1_1[];
> + float var1_2[];
> +};
> +out blk2 {
> + float var2_1[2];
> + float var2_2[2];
> +};
> +
> +void foo()
> +{
> + var1_1[1] = 5.0;
> + var1_2[0] = 6.0;
> + var2_1[1] = 7.0;
> + var2_2[0] = 8.0;
> +}
> +
> +[geometry shader]
> +#version 150
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +in blk1 {
> + float var1_1[2];
> + float var1_2[2];
> +} ifc1[];
> +in blk2 {
> + float var2_1[];
> + float var2_2[];
> +} ifc2[];
> +out float ok;
> +
> +bool foo(int i);
> +
> +void main()
> +{
> + bool pass = true;
> + for (int i = 0; i < 3; i++) {
> + if (!foo(i))
> + pass = false;
> + if (ifc1[i].var1_1[0] != 1.0)
> + pass = false;
> + if (ifc1[i].var1_2[1] != 2.0)
> + pass = false;
> + if (ifc2[i].var2_1[0] != 3.0)
> + pass = false;
> + if (ifc2[i].var2_2[1] != 4.0)
> + pass = false;
> + }
> + for (int i = 0; i < 3; i++) {
> + gl_Position = gl_in[i].gl_Position;
> + ok = pass ? 1.0 : 0.0;
> + EmitVertex();
> + }
> +}
> +
> +[geometry shader]
> +#version 150
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +in blk1 {
> + float var1_1[2];
> + float var1_2[2];
> +} ifc1[];
> +in blk2 {
> + float var2_1[];
> + float var2_2[];
> +} ifc2[];
> +
> +bool foo(int i)
> +{
> + bool pass = true;
> + if (ifc1[i].var1_1[1] != 5.0)
> + pass = false;
> + if (ifc1[i].var1_2[0] != 6.0)
> + pass = false;
> + if (ifc2[i].var2_1[1] != 7.0)
> + pass = false;
> + if (ifc2[i].var2_2[0] != 8.0)
> + pass = false;
> + return pass;
> +}
> +
> +[fragment shader]
> +#version 150
> +in float ok;
> +
> +void main()
> +{
> + bool pass = true;
> + if (ok == 1.0)
> + gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
> + else
> + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block.shader_test b/tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block.shader_test
> new file mode 100644
> index 0000000..3619758
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/unsized-in-unnamed-interface-block.shader_test
> @@ -0,0 +1,51 @@
> +# Test that when an interface block contains members which are unsized
> +# arrays, the standard rules are applied in order to determine the
> +# array sizes (namely, the sizes should be inferred from the maximum
> +# array element accessed).
> +#
> +# In this test, both the vertex shader and the fragment shader use
> +# unnamed interface blocks containing an array size of 3, so there
> +# should be no error.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out blk {
> + float foo[];
> +};
> +
> +void main()
> +{
> + foo[0] = 1.0;
> + foo[1] = 10.0;
> + foo[2] = 100.0;
> + gl_Position = piglit_vertex;
> +}
> +
> +[fragment shader]
> +#version 150
> +in blk {
> + float foo[];
> +};
> +
> +void main()
> +{
> + bool pass = true;
> + if (foo[0] != 1.0)
> + pass = false;
> + if (foo[1] != 10.0)
> + pass = false;
> + if (foo[2] != 100.0)
> + pass = false;
> + if (pass)
> + gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
> + else
> + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/spec/glsl-1.50/linker/unsized-in-named-interface-block-gs.shader_test b/tests/spec/glsl-1.50/linker/unsized-in-named-interface-block-gs.shader_test
> new file mode 100644
> index 0000000..43b267f
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/linker/unsized-in-named-interface-block-gs.shader_test
> @@ -0,0 +1,56 @@
> +# Test that when an interface block contains members which are unsized
> +# arrays, the standard rules are applied in order to determine the
> +# array sizes (namely, the sizes should be inferred from the maximum
> +# array element accessed).
> +#
> +# In this test, there is a vertex shader output which uses an array
> +# size of 3, and a geometry shader input that uses an array size of 2,
> +# so link error should be produced.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out blk {
> + float foo[];
> +} ifc_name;
> +
> +void main()
> +{
> + ifc_name.foo[0] = 0.0;
> + ifc_name.foo[1] = 0.0;
> + ifc_name.foo[2] = 0.0;
> + gl_Position = piglit_vertex;
> +}
> +
> +[geometry shader]
> +#version 150
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +in blk {
> + float foo[];
> +} ifc_name[];
> +out vec2 bar;
> +
> +void main()
> +{
> + for (int i = 0; i < 3; i++) {
> + gl_Position = gl_in[i].gl_Position;
> + bar = vec2(ifc_name[i].foo[0], ifc_name[i].foo[1]);
> + EmitVertex();
> + }
> +}
> +
> +[fragment shader]
> +#version 150
> +in vec2 bar;
> +
> +void main()
> +{
> + gl_FragColor = vec4(bar, 0.0, 1.0);
> +}
> +
> +[test]
> +link error
> diff --git a/tests/spec/glsl-1.50/linker/unsized-in-named-interface-block.shader_test b/tests/spec/glsl-1.50/linker/unsized-in-named-interface-block.shader_test
> new file mode 100644
> index 0000000..f288014
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/linker/unsized-in-named-interface-block.shader_test
> @@ -0,0 +1,39 @@
> +# Test that when an interface block contains members which are unsized
> +# arrays, the standard rules are applied in order to determine the
> +# array sizes (namely, the sizes should be inferred from the maximum
> +# array element accessed).
> +#
> +# In this test, the vertex shader uses an array size of 2, and the
> +# fragment shader uses an array size of 3, so link error should be
> +# produced.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out blk {
> + float foo[];
> +} ifc_name;
> +
> +void main()
> +{
> + ifc_name.foo[0] = 0.0;
> + ifc_name.foo[1] = 0.0;
> + gl_Position = piglit_vertex;
> +}
> +
> +[fragment shader]
> +#version 150
> +in blk {
> + float foo[];
> +} ifc_name;
> +
> +void main()
> +{
> + gl_FragColor = vec4(ifc_name.foo[0], ifc_name.foo[1], ifc_name.foo[2], 1.0);
> +}
> +
> +[test]
> +link error
> diff --git a/tests/spec/glsl-1.50/linker/unsized-in-unnamed-interface-block-gs.shader_test b/tests/spec/glsl-1.50/linker/unsized-in-unnamed-interface-block-gs.shader_test
> new file mode 100644
> index 0000000..366c085
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/linker/unsized-in-unnamed-interface-block-gs.shader_test
> @@ -0,0 +1,57 @@
> +# Test that when an interface block contains members which are unsized
> +# arrays, the standard rules are applied in order to determine the
> +# array sizes (namely, the sizes should be inferred from the maximum
> +# array element accessed).
> +#
> +# In this test, there is a vertex shader output which uses an array
> +# size of 3, and a geometry shader input that uses an array size of 2,
> +# so link error should be produced. The vertex shader uses an unnamed
> +# interface block.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out blk {
> + float foo[];
> +};
> +
> +void main()
> +{
> + foo[0] = 0.0;
> + foo[1] = 0.0;
> + foo[2] = 0.0;
> + gl_Position = piglit_vertex;
> +}
> +
> +[geometry shader]
> +#version 150
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +in blk {
> + float foo[];
> +} ifc_name[];
> +out vec2 bar;
> +
> +void main()
> +{
> + for (int i = 0; i < 3; i++) {
> + gl_Position = gl_in[i].gl_Position;
> + bar = vec2(ifc_name[i].foo[0], ifc_name[i].foo[1]);
> + EmitVertex();
> + }
> +}
> +
> +[fragment shader]
> +#version 150
> +in vec2 bar;
> +
> +void main()
> +{
> + gl_FragColor = vec4(bar, 0.0, 1.0);
> +}
> +
> +[test]
> +link error
> diff --git a/tests/spec/glsl-1.50/linker/unsized-in-unnamed-interface-block.shader_test b/tests/spec/glsl-1.50/linker/unsized-in-unnamed-interface-block.shader_test
> new file mode 100644
> index 0000000..742edb9
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/linker/unsized-in-unnamed-interface-block.shader_test
> @@ -0,0 +1,40 @@
> +# Test that when an interface block contains members which are unsized
> +# arrays, the standard rules are applied in order to determine the
> +# array sizes (namely, the sizes should be inferred from the maximum
> +# array element accessed).
> +#
> +# In this test, the vertex shader uses an array size of 2, and the
> +# fragment shader uses an array size of 3, so link error should be
> +# produced. Both the vertex and fragment shader use unnamed interface
> +# blocks.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +out blk {
> + float foo[];
> +};
> +
> +void main()
> +{
> + foo[0] = 0.0;
> + foo[1] = 0.0;
> + gl_Position = piglit_vertex;
> +}
> +
> +[fragment shader]
> +#version 150
> +in blk {
> + float foo[];
> +};
> +
> +void main()
> +{
> + gl_FragColor = vec4(foo[0], foo[1], foo[2], 1.0);
> +}
> +
> +[test]
> +link error
> --
> 1.8.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list