[Mesa-stable] [Mesa-dev] [PATCH] glsl: Don't lose precision qualifiers when encountering "centroid".

Ian Romanick idr at freedesktop.org
Thu Feb 6 16:04:16 PST 2014


On 02/05/2014 09:42 PM, Kenneth Graunke wrote:
> Mesa fails to retain the precision qualifier when parsing:
> 
>    #version 300 es
>    centroid in mediump vec2 v;
> 
> Consider how the parser's type_qualifier production is applied.
> First, the precision_qualifier rule creates a new ast_type_qualifier:
> 
>     <precision: mediump>
> 
> Then the storage_qualifier rule creates a second one:
> 
>     <flags: in>
> 
> and calls merge_qualifier() to fold in any previous qualifications,
> returning:
> 
>     <flags: in, precision: mediump>
> 
> Finally, the auxiliary_storage_qualifier creates one for "centroid":
> 
>     <flags: centroid>
> 
> it then does $$ = $1 and $$.flags |= $2.flags, resulting in:
> 
>     <flags: centroid, in>
> 
> Since precision isn't stored in the flags bitfield, it is lost.  We need
> to instead call merge_qualifier to combine all the fields.
> 
> Cc: mesa-stable at lists.freedesktop.org
> Reported-by: Kevin Rogovin <kevin.rogovin at intel.com>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

Good catch!

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>  src/glsl/glsl_parser.yy | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index b26c203..dc35c1a 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -1494,7 +1494,7 @@ type_qualifier:
>                            "just before storage qualifiers");
>        }
>        $$ = $1;
> -      $$.flags.i |= $2.flags.i;
> +      $$.merge_qualifier(&@1, state, $2);
>     }
>     | storage_qualifier type_qualifier
>     {
> 



More information about the mesa-stable mailing list