[Piglit] [PATCH] glsl-1.50: Test illegal uses of unsized arrays in interface blocks.

Paul Berry stereotype441 at gmail.com
Tue Oct 1 10:55:15 PDT 2013


On 27 September 2013 14:04, Ian Romanick <idr at freedesktop.org> wrote:

> On 09/27/2013 01:37 PM, Paul Berry wrote:
> > These tests verify that unsized arrays appearing inside interface
> > blocks are subject to the same restrictions as unsized arrays
> > appearing outside interface blocks (e.g. they can't be used in bulk
> > assignment, they don't support .length(), and they can't be accessed
> > using a non-constant index).
> >
> > Since it's likely that these restrictions are enforced by the same
> > code as for unsized arrays appearing outside of interface blocks,
> > these are just a few touch tests; we don't exhaustively test all
> > possible types of access in every shader type.
>
> The last two tests look great as-is.  The first one needs a minor
> change, I think.  With that,
>
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
>
> > ---
> >  ...ment-to-unsized-array-in-unnamed-ifc-block.vert | 27
> ++++++++++++++++++++++
> >  ...length-of-unsized-array-in-array-ifc-block.geom | 27
> ++++++++++++++++++++++
> >  ...access-to-unsized-array-in-named-ifc-block.frag | 23
> ++++++++++++++++++
> >  3 files changed, 77 insertions(+)
> >  create mode 100644
> tests/spec/glsl-1.50/compiler/illegal-assignment-to-unsized-array-in-unnamed-ifc-block.vert
> >  create mode 100644
> tests/spec/glsl-1.50/compiler/illegal-length-of-unsized-array-in-array-ifc-block.geom
> >  create mode 100644
> tests/spec/glsl-1.50/compiler/illegal-nonconst-access-to-unsized-array-in-named-ifc-block.frag
> >
> > diff --git
> a/tests/spec/glsl-1.50/compiler/illegal-assignment-to-unsized-array-in-unnamed-ifc-block.vert
> b/tests/spec/glsl-1.50/compiler/illegal-assignment-to-unsized-array-in-unnamed-ifc-block.vert
> > new file mode 100644
> > index 0000000..7df2868
> > --- /dev/null
> > +++
> b/tests/spec/glsl-1.50/compiler/illegal-assignment-to-unsized-array-in-unnamed-ifc-block.vert
> > @@ -0,0 +1,27 @@
> > +// [config]
> > +// expect_result: fail
> > +// glsl_version: 1.50
> > +// check_link: true
> > +// [end config]
> > +//
> > +// Test that if an interface block contains an unsized array, it is
> > +// illegal to use it as the LHS of a bulk assignment (even if both the
> > +// LHS and the RHS of the assignment have the same implied array
> > +// size).
> > +//
> > +// This test uses an unnamed interface block.
> > +
> > +#version 150
> > +
> > +out block {
> > +  float foo[];
> > +};
> > +
> > +void main()
> > +{
> > +  float bar[];
> > +  bar[0] = 1.0;
> > +  bar[1] = 2.0;
> > +  foo = bar;
> > +  foo[1] = 3.0;
> > +}
>
> This should fail regardless due to bar.  Maybe put a size on bar so that
> only foo is unsized?
>

Yeah, that seems reasonable.  Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131001/e1a317e9/attachment.html>


More information about the Piglit mailing list