aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-04-24 12:14:39 -0700
committerEric Anholt <[email protected]>2012-07-09 11:04:45 -0700
commit60a784d56e0034d32b9c243afd860cf095d3d2c5 (patch)
tree1de5f72be5f32e053e30c7f20d06d2e0d195d379 /src
parent9b00edc79a49bd9fdef9102e3d74828d93ee185e (diff)
glsl: Take advantage of the layout qualifier flags union to clean up parsing.
The got_one variable was set iff one of the bits in flags.i was set. v2: Fix incorrect dropping of the ARB_conservative_depth warning. Reviewed-by: Kenneth Graunke <[email protected]> (v1) Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/glsl_parser.yy28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 5ca8740c4ff..9ad67e27881 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1119,21 +1119,17 @@ layout_qualifier_id_list:
layout_qualifier_id:
any_identifier
{
- bool got_one = false;
-
memset(& $$, 0, sizeof($$));
/* Layout qualifiers for ARB_fragment_coord_conventions. */
- if (!got_one && state->ARB_fragment_coord_conventions_enable) {
+ if (!$$.flags.i && state->ARB_fragment_coord_conventions_enable) {
if (strcmp($1, "origin_upper_left") == 0) {
- got_one = true;
$$.flags.q.origin_upper_left = 1;
} else if (strcmp($1, "pixel_center_integer") == 0) {
- got_one = true;
$$.flags.q.pixel_center_integer = 1;
}
- if (got_one && state->ARB_fragment_coord_conventions_warn) {
+ if ($$.flags.i && state->ARB_fragment_coord_conventions_warn) {
_mesa_glsl_warning(& @1, state,
"GL_ARB_fragment_coord_conventions layout "
"identifier `%s' used\n", $1);
@@ -1141,36 +1137,32 @@ layout_qualifier_id:
}
/* Layout qualifiers for AMD/ARB_conservative_depth. */
- if (!got_one &&
+ if (!$$.flags.i &&
(state->AMD_conservative_depth_enable ||
state->ARB_conservative_depth_enable)) {
if (strcmp($1, "depth_any") == 0) {
- got_one = true;
$$.flags.q.depth_any = 1;
} else if (strcmp($1, "depth_greater") == 0) {
- got_one = true;
$$.flags.q.depth_greater = 1;
} else if (strcmp($1, "depth_less") == 0) {
- got_one = true;
$$.flags.q.depth_less = 1;
} else if (strcmp($1, "depth_unchanged") == 0) {
- got_one = true;
$$.flags.q.depth_unchanged = 1;
}
- if (got_one && state->AMD_conservative_depth_warn) {
+ if ($$.flags.i && state->AMD_conservative_depth_warn) {
_mesa_glsl_warning(& @1, state,
"GL_AMD_conservative_depth "
"layout qualifier `%s' is used\n", $1);
}
- if (got_one && state->ARB_conservative_depth_warn) {
+ if ($$.flags.i && state->ARB_conservative_depth_warn) {
_mesa_glsl_warning(& @1, state,
"GL_ARB_conservative_depth "
"layout qualifier `%s' is used\n", $1);
}
}
- if (!got_one) {
+ if (!$$.flags.i) {
_mesa_glsl_error(& @1, state, "unrecognized layout identifier "
"`%s'\n", $1);
YYERROR;
@@ -1178,8 +1170,6 @@ layout_qualifier_id:
}
| any_identifier '=' INTCONSTANT
{
- bool got_one = false;
-
memset(& $$, 0, sizeof($$));
if (state->ARB_explicit_attrib_location_enable) {
@@ -1187,8 +1177,6 @@ layout_qualifier_id:
* FINISHME: GLSL 1.30 (or later) are supported.
*/
if (strcmp("location", $1) == 0) {
- got_one = true;
-
$$.flags.q.explicit_location = 1;
if ($3 >= 0) {
@@ -1201,8 +1189,6 @@ layout_qualifier_id:
}
if (strcmp("index", $1) == 0) {
- got_one = true;
-
$$.flags.q.explicit_index = 1;
if ($3 >= 0) {
@@ -1218,7 +1204,7 @@ layout_qualifier_id:
/* If the identifier didn't match any known layout identifiers,
* emit an error.
*/
- if (!got_one) {
+ if (!$$.flags.i) {
_mesa_glsl_error(& @1, state, "unrecognized layout identifier "
"`%s'\n", $1);
YYERROR;