[Piglit] [PATCH 1/2] glsl-1.50 compiler: Test that arrays can be used as inputs to vertex shader

Paul Berry stereotype441 at gmail.com
Wed Jul 17 10:03:48 PDT 2013


On 15 July 2013 16:12, Steve Miller <dervishx at gmail.com> wrote:

> Test all types.
> ---
>  .../glsl-1.50/compiler/input-arrays-float.vert     | 20 +++++++++++++
>  .../spec/glsl-1.50/compiler/input-arrays-int.vert  | 31
> +++++++++++++++++++
>  .../spec/glsl-1.50/compiler/input-arrays-mat.vert  | 35
> ++++++++++++++++++++++
>  .../spec/glsl-1.50/compiler/input-arrays-uint.vert | 26 ++++++++++++++++
>  4 files changed, 112 insertions(+)
>  create mode 100644 tests/spec/glsl-1.50/compiler/input-arrays-float.vert
>  create mode 100644 tests/spec/glsl-1.50/compiler/input-arrays-int.vert
>  create mode 100644 tests/spec/glsl-1.50/compiler/input-arrays-mat.vert
>  create mode 100644 tests/spec/glsl-1.50/compiler/input-arrays-uint.vert
>
> diff --git a/tests/spec/glsl-1.50/compiler/input-arrays-float.vert
> b/tests/spec/glsl-1.50/compiler/input-arrays-float.vert
> new file mode 100644
> index 0000000..f5cf79a
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/compiler/input-arrays-float.vert
> @@ -0,0 +1,20 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// check_link: false
> +// [end config]
> +
> +#version 150
> +
> +in float a[2];
> +in vec2 b[2];
> +in vec3 c[2];
> +in vec4 d[2];
> +
> +void main()
> +{
> +       gl_Position = vec4(a[0] + a[1] +
> +                       b[0].x + b[1].x +
> +                       c[0].x + c[1].x +
> +                       d[0].x + d[1].x);
> +}
> diff --git a/tests/spec/glsl-1.50/compiler/input-arrays-int.vert
> b/tests/spec/glsl-1.50/compiler/input-arrays-int.vert
> new file mode 100644
> index 0000000..b8eb5d4
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/compiler/input-arrays-int.vert
> @@ -0,0 +1,31 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// check_link: false
> +// [end config]
> +//
> +// Tests that arrays can be inputs to the vertex shader
> +/*
> +* GLSLLangSpec.1.50.09 Inputs:
> +*
> +* Vertex shader inputs can only be float, floating-point
> +* vectors, matrices, signed and unsigned integers and integer vectors.
> +* Vertex shader inputs can also form arrays of these types, but not
> +* structures.
> +*
> +*/
> +
> +#version 150
> +                       //slots
> +in int a[2];           //2
> +in ivec2 b[2];         //4
> +in ivec3 c[2];         //6
> +in ivec4 d[2];         //8
>

Where vertex shader inputs are concerned, the number of slots used is
actually detemined by the number of vectors, so each of the above variables
only takes up 2 slots.

Which is fortunate, because this makes the total number of slots used by
your tests 8 instead of 20, and MAX_VERTEX_ATTRIBS isn't guaranteed to be
greater than 16 :)


>
> +
> +void main()
> +{
> +       gl_Position = vec4(a[0] + a[1] +
> +                       b[0].x + b[1].x +
> +                       c[0].x + c[1].x +
> +                       d[0].x + d[1].x);
> +}
> diff --git a/tests/spec/glsl-1.50/compiler/input-arrays-mat.vert
> b/tests/spec/glsl-1.50/compiler/input-arrays-mat.vert
> new file mode 100644
> index 0000000..370cf2a
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/compiler/input-arrays-mat.vert
> @@ -0,0 +1,35 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// check_link: false
> +// [end config]
> +//
> +// Tests that arrays (of matrices) can be inputs to the vertex shader
> +/*
> +* GLSLLangSpec.1.50.09 Inputs:
> +*
> +* Vertex shader inputs can only be float, floating-point
> +* vectors, matrices, signed and unsigned integers and integer vectors.
> +* Vertex shader inputs can also form arrays of these types, but not
> +* structures.
> +*
> +*/
> +
> +#version 150
> +
> +in mat2 a[2];          //2x2x2         8
> +in mat3 b[2];          //3x2x2         12
> +in mat4 c[2];          //4x2x2         16
> +//                             =       36
>

For vertex shader input matrices, each column takes up a separate slot, so
the number of slots in use is actually 2*2 + 3*2 + 4*2 = 18.  That's a
problem since MAX_VERTEX_ATTRIBS might be as small as 16.

I'd recommend just dropping "in mat2 a[2]" from the test.  If arrays of
mat3's work and arrays of mat4's work, then arrays of mat2's are almost
certain to work too.


> +
> +void main()
> +{
> +       gl_Position = vec4(
> +                       a[0][0].x + a[0][1].x +
> +                       a[1][0].x + a[1][1].x +
> +                       b[0][0].x + b[0][1].x +
> +                       b[1][0].x + b[1][1].x +
> +                       c[0][0].x + c[0][1].x +
> +                       c[1][0].x + c[1][1].x
> +                       );
> +}
> diff --git a/tests/spec/glsl-1.50/compiler/input-arrays-uint.vert
> b/tests/spec/glsl-1.50/compiler/input-arrays-uint.vert
> new file mode 100644
> index 0000000..0d834b4
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/compiler/input-arrays-uint.vert
> @@ -0,0 +1,26 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// check_link: false
> +// [end config]
> +
> +// Section 4.3.4 (Inputs) of GLSL 1.50 spec states:
> +//     "Vertex shader inputs can only be float, floating-point
> +//     vectors, matrices, signed and unsigned integers and integer
> +//     vectors. Vertex shader inputs can also form
> +//     arrays of these types, but not structures."
> +
> +#version 150
> +
> +in uint  a[2];
> +in uvec2 b[2];
> +in uvec3 c[2];
> +in uvec4 d[2];
> +
> +void main()
> +{
> +    gl_Position = vec4(a[0] + a[1]
> +                       + b[0].x + b[1].x
> +                       + c[0].x + c[1].x
> +                       + d[0].x + d[1].x);
> +}
> --
> 1.8.3.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130717/5331f815/attachment.html>


More information about the Piglit mailing list