glsl: Handle most qualifier ordering in C code rather than the grammar.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 13 Jul 2013 22:27:52 +0000 (15:27 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 18 Jul 2013 23:57:22 +0000 (16:57 -0700)
commit48e3bd33dc28aedcd9fccf4ba3bdc5e8a894b27b
treec136bc4cdf4750ef0bb5c826c6b9baf18897f53a
parent1b719df14dcde947f3d9c43282866a65cf3a3fd2
glsl: Handle most qualifier ordering in C code rather than the grammar.

The GL_ARB_shading_language_420pack extension/GLSL 4.20 allow qualifiers
to be specified in (basically) any order.  In order to support this, we
can't hardcode the ordering restrictions in the grammar.

This patch alters the grammar to accept invariant, storage, layout, and
interpolation qualifiers in any order, but adds C code to enforce the
ordering requirements.  In the 420pack case, we should be able to simply
skip the error checks.

As a bonus, this also lets us generate decent error messages, rather
than Bison's awful "unexpected TOKEN" errors.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/glsl/glsl_parser.yy