diff options
author | Chris Forbes <[email protected]> | 2014-04-27 16:03:53 +1200 |
---|---|---|
committer | Chris Forbes <[email protected]> | 2014-06-04 18:56:03 +1200 |
commit | 4b756b20c446bbaf0911d1b66c5a405ab3b133ef (patch) | |
tree | 67b52b3734b059baf0e2e8fbd603977704781c1b /src/glsl/glsl_parser.yy | |
parent | 37ab3ddbf8ecc691b784fc2145242369f0b094f6 (diff) |
glsl: add support for `precise` in type_qualifier
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser.yy')
-rw-r--r-- | src/glsl/glsl_parser.yy | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index b6f61467555..83cbb902b5d 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -166,7 +166,7 @@ static bool match_layout_qualifier(const char *s1, const char *s2, %token AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN %token MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN %token SUB_ASSIGN -%token INVARIANT +%token INVARIANT PRECISE %token LOWP MEDIUMP HIGHP SUPERP PRECISION %token VERSION_TOK EXTENSION LINE COLON EOL INTERFACE OUTPUT @@ -1498,6 +1498,11 @@ type_qualifier: memset(& $$, 0, sizeof($$)); $$.flags.q.invariant = 1; } + | PRECISE + { + memset(& $$, 0, sizeof($$)); + $$.flags.q.precise = 1; + } | auxiliary_storage_qualifier | storage_qualifier | interpolation_qualifier @@ -1518,8 +1523,16 @@ type_qualifier: * 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 auxiliary, interpolation, layout, or invariant qualifiers to the right. + * no auxiliary, interpolation, layout, invariant, or precise qualifiers to the right. */ + | PRECISE type_qualifier + { + if ($2.flags.q.precise) + _mesa_glsl_error(&@1, state, "duplicate \"precise\" qualifier"); + + $$ = $2; + $$.flags.q.precise = 1; + } | INVARIANT type_qualifier { if ($2.flags.q.invariant) @@ -1530,6 +1543,10 @@ type_qualifier: "\"invariant\" cannot be used with layout(...)"); } + if (!state->ARB_shading_language_420pack_enable && $2.flags.q.precise) + _mesa_glsl_error(&@1, state, + "\"invariant\" must come after \"precise\""); + $$ = $2; $$.flags.q.invariant = 1; } @@ -1553,9 +1570,10 @@ type_qualifier: "with layout(...)"); } - if (!state->ARB_shading_language_420pack_enable && $2.flags.q.invariant) { + if (!state->ARB_shading_language_420pack_enable && + ($2.flags.q.precise || $2.flags.q.invariant)) { _mesa_glsl_error(&@1, state, "interpolation qualifiers must come " - "after \"invariant\""); + "after \"precise\" or \"invariant\""); } $$ = $1; @@ -1576,6 +1594,10 @@ type_qualifier: _mesa_glsl_error(&@1, state, "layout(...) cannot be used with " "the \"invariant\" qualifier"); + if ($2.flags.q.precise) + _mesa_glsl_error(&@1, state, "layout(...) cannot be used with " + "the \"precise\" qualifier"); + if ($2.has_interpolation()) { _mesa_glsl_error(&@1, state, "layout(...) cannot be used with " "interpolation qualifiers"); @@ -1592,7 +1614,8 @@ type_qualifier: } if (!state->ARB_shading_language_420pack_enable && - ($2.flags.q.invariant || $2.has_interpolation() || $2.has_layout())) { + ($2.flags.q.precise || $2.flags.q.invariant || + $2.has_interpolation() || $2.has_layout())) { _mesa_glsl_error(&@1, state, "auxiliary storage qualifiers must come " "just before storage qualifiers"); } @@ -1609,10 +1632,10 @@ type_qualifier: _mesa_glsl_error(&@1, state, "duplicate storage qualifier"); if (!state->ARB_shading_language_420pack_enable && - ($2.flags.q.invariant || $2.has_interpolation() || $2.has_layout() || - $2.has_auxiliary_storage())) { + ($2.flags.q.precise || $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, layout and auxiliary " + "precise, invariant, interpolation, layout and auxiliary " "storage qualifiers"); } |