%type <node> simple_statement
%type <n> precision_qualifier
%type <type_qualifier> type_qualifier
+%type <type_qualifier> auxiliary_storage_qualifier
%type <type_qualifier> storage_qualifier
%type <type_qualifier> interpolation_qualifier
%type <type_qualifier> layout_qualifier
memset(& $$, 0, sizeof($$));
$$.flags.q.invariant = 1;
}
+ | auxiliary_storage_qualifier
| storage_qualifier
| interpolation_qualifier
| layout_qualifier
* In GLSL 4.20, these can be specified in any order. In earlier versions,
* they appear in this order (see GLSL 1.50 section 4.7 & comments below):
*
- * invariant interpolation storage precision ...or...
+ * invariant interpolation auxiliary storage precision ...or...
* layout storage precision
*
* Each qualifier's rule ensures that the accumulated qualifiers on the right
* side don't contain any that must appear on the left hand side.
* For example, when processing a storage qualifier, we check that there are
- * no interpolation, layout, or invariant qualifiers to the right.
+ * no auxiliary, interpolation, layout, or invariant qualifiers to the right.
*/
| INVARIANT type_qualifier
{
$$ = $1;
$$.merge_qualifier(&@1, state, $2);
}
+ | auxiliary_storage_qualifier type_qualifier
+ {
+ if ($2.has_auxiliary_storage()) {
+ _mesa_glsl_error(&@1, state,
+ "Duplicate auxiliary storage qualifier (centroid).\n");
+ }
+
+ if ($2.flags.q.invariant || $2.has_interpolation() || $2.has_layout()) {
+ _mesa_glsl_error(&@1, state, "Auxiliary storage qualifiers must come "
+ "just before storage qualifiers.\n");
+ }
+ $$ = $1;
+ $$.flags.i |= $2.flags.i;
+ }
| storage_qualifier type_qualifier
{
/* Section 4.3 of the GLSL 1.20 specification states:
_mesa_glsl_error(&@1, state, "Duplicate storage qualifier.\n");
if (!state->ARB_shading_language_420pack_enable &&
- ($2.flags.q.invariant || $2.has_interpolation() || $2.has_layout())) {
+ ($2.flags.q.invariant || $2.has_interpolation() || $2.has_layout() ||
+ $2.has_auxiliary_storage())) {
_mesa_glsl_error(&@1, state, "Storage qualifiers must come after "
- "invariant, interpolation, and layout qualifiers.\n");
+ "invariant, interpolation, layout and auxiliary "
+ "storage qualifiers.\n");
}
$$ = $1;
}
;
+auxiliary_storage_qualifier:
+ CENTROID
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.centroid = 1;
+ }
+ /* TODO: "sample" and "patch" also go here someday. */
+
storage_qualifier:
CONST_TOK
{
memset(& $$, 0, sizeof($$));
$$.flags.q.varying = 1;
}
- | CENTROID VARYING
- {
- memset(& $$, 0, sizeof($$));
- $$.flags.q.centroid = 1;
- $$.flags.q.varying = 1;
- }
| IN_TOK
{
memset(& $$, 0, sizeof($$));
memset(& $$, 0, sizeof($$));
$$.flags.q.out = 1;
}
- | CENTROID IN_TOK
- {
- memset(& $$, 0, sizeof($$));
- $$.flags.q.centroid = 1; $$.flags.q.in = 1;
- }
- | CENTROID OUT_TOK
- {
- memset(& $$, 0, sizeof($$));
- $$.flags.q.centroid = 1; $$.flags.q.out = 1;
- }
| UNIFORM
{
memset(& $$, 0, sizeof($$));