glsl: Don't lose precision qualifiers when encountering "centroid".
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 6 Feb 2014 05:42:00 +0000 (21:42 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 7 Feb 2014 20:36:38 +0000 (12:36 -0800)
commit2062f40d81de4743758851b03dad506f9cb6f306
tree14d9247cb17765c46d9f52a599cf2d300ae602e2
parentf47e5962885d9f7de23a8c9c9ba035017e24ffd6
glsl: Don't lose precision qualifiers when encountering "centroid".

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@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reported-by: Kevin Rogovin <kevin.rogovin@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/glsl_parser.yy