[Mesa-dev] [PATCH] glsl: dont allow undefined array sizes in ES

Timothy Arceri timothy.arceri at collabora.com
Wed Mar 9 23:24:00 UTC 2016


On Wed, 2016-03-09 at 16:04 +0100, Iago Toral wrote:
> On Tue, 2016-03-08 at 20:35 +1100, Timothy Arceri wrote:
> > This applies the rule to empty declarations.
> > 
> > Fixes:
> > dEQP-
> > GLES3.functional.shaders.arrays.invalid.empty_declaration_without_v
> > ar_name_vertex
> > dEQP-
> > GLES3.functional.shaders.arrays.invalid.empty_declaration_without_v
> > ar_name_fragment
> > ---
> >  src/compiler/glsl/ast_to_hir.cpp | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/src/compiler/glsl/ast_to_hir.cpp
> > b/src/compiler/glsl/ast_to_hir.cpp
> > index d755a11..8918981 100644
> > --- a/src/compiler/glsl/ast_to_hir.cpp
> > +++ b/src/compiler/glsl/ast_to_hir.cpp
> > @@ -4223,6 +4223,17 @@ ast_declarator_list::hir(exec_list
> > *instructions,
> >                            type_name);
> >        } else {
> >           if (decl_type->base_type == GLSL_TYPE_ARRAY) {
> > +            /* From Section 13.22 (Array Declarations) of the GLSL
> > ES 3.2
> > +             * spec:
> > +             *
> > +             *    "... any declaration that leaves the size
> > undefined is
> > +             *    disallowed as this would add complexity and
> > there are no
> > +             *    use-cases."
> > +             */
> > +            if (state->es_shader && decl_type->is_unsized_array())
> > +               _mesa_glsl_error(&loc, state, "array size must be
> > explicitly "
> > +                                "or implicitly defined");
> 
> What about unsized arrays in SSBOs? Unsized arrays are allowed as the
> last element in a SSBO declaration. This is a special case because
> the
> size of the array is implicitly set by the size of the underlying
> buffer
> object.

This is only for empty declarations e.g int[]; so it shouldn't have any
impact on valid SSBOs.

> 
> Iago
> 
> >              /* From Section 4.12 (Empty Declarations) of the GLSL
> > 4.5 spec:
> >               *
> >               *    "The combinations of types and qualifiers that
> > cause
> 
> 


More information about the mesa-dev mailing list