[Mesa-dev] [PATCH V2 08/12] glsl: add process_qualifier_constant() helper

Timothy Arceri t_arceri at yahoo.com.au
Tue Nov 10 12:24:32 PST 2015


On Tue, 2015-11-10 at 13:46 +0000, Emil Velikov wrote:
> On 8 November 2015 at 22:34, Timothy Arceri <t_arceri at yahoo.com.au> wrote:
> > From: Timothy Arceri <timothy.arceri at collabora.com>
> > 
> > This helper is similar to the function added as part of the
> > ast_layout_expression class but will be used when only the
> > ast_expression type is required for the qualifier.
> > 
> > ast_expression is used if qualifier can't have mulitple declorations
> > or if all but he newest qualifier is simply ignored.
> > ---
> >  src/glsl/ast_to_hir.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 42 insertions(+)
> > 
> > diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> > index 5643c86..21a956d 100644
> > --- a/src/glsl/ast_to_hir.cpp
> > +++ b/src/glsl/ast_to_hir.cpp
> > @@ -2261,6 +2261,48 @@ validate_matrix_layout_for_type(struct
> > _mesa_glsl_parse_state *state,
> >     }
> >  }
> > 
> > +bool
> > +process_qualifier_constant(struct _mesa_glsl_parse_state *state,
> > +                           YYLTYPE *loc,
> > +                           const char *qual_indentifier,
> > +                           ast_expression *const_expression,
> > +                           unsigned *value, int minimum_value)
> Unless I missed any patches, minimum_value is always 0 (same goes for
> the process_qualifier_constant in previous patch). Perhaps just drop
> the argument ?

Nice spotting :) It's only the types that apply to ast_layout_expression that
can also be 1. I guess even in that case it might be nicer to use a boolean to
toggle the minimum then I can get rid of the assert and there are no magic
looking numbers.  

>  Obviously can be done on top of the series as resolving
> the conflicts might be a bit painful.
> 
> -Emil


More information about the mesa-dev mailing list