Convert everything from the talloc API to the ralloc API.
[mesa.git] / src / glsl / glsl_parser.ypp
index d0941ecef7dcea334509dfc31dd3bab11138df37..7336b18cdccd86d6673915658d18ee9a5ac109cc 100644 (file)
@@ -229,7 +229,7 @@ version_statement:
              /* FINISHME: Check against implementation support versions. */
              state->language_version = $2;
              state->version_string =
-                talloc_asprintf(state, "GLSL%s %d.%02d",
+                ralloc_asprintf(state, "GLSL%s %d.%02d",
                                 state->es_shader ? " ES" : "",
                                 state->language_version / 100,
                                 state->language_version % 100);
@@ -702,12 +702,6 @@ declaration:
        }
        | PRECISION precision_qualifier type_specifier_no_prec ';'
        {
-          if (($3->type_specifier != ast_float)
-              && ($3->type_specifier != ast_int)) {
-             _mesa_glsl_error(& @3, state, "global precision qualifier can "
-                              "only be applied to `int' or `float'\n");
-             YYERROR;
-          }
           $3->precision = $2;
           $3->is_precision_statement = true;
           $$ = $3;
@@ -1024,7 +1018,8 @@ layout_qualifier_id:
 
           memset(& $$, 0, sizeof($$));
 
-          if (state->ARB_fragment_coord_conventions_enable) {
+          /* Layout qualifiers for ARB_fragment_coord_conventions. */
+          if (!got_one && state->ARB_fragment_coord_conventions_enable) {
              if (strcmp($1, "origin_upper_left") == 0) {
                 got_one = true;
                 $$.flags.q.origin_upper_left = 1;
@@ -1032,19 +1027,41 @@ layout_qualifier_id:
                 got_one = true;
                 $$.flags.q.pixel_center_integer = 1;
              }
+
+             if (got_one && state->ARB_fragment_coord_conventions_warn) {
+                _mesa_glsl_warning(& @1, state,
+                                   "GL_ARB_fragment_coord_conventions layout "
+                                   "identifier `%s' used\n", $1);
+             }
+          }
+
+          /* Layout qualifiers for AMD_conservative_depth. */
+          if (!got_one && state->AMD_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) {
+                _mesa_glsl_warning(& @1, state,
+                                   "GL_AMD_conservative_depth "
+                                   "layout qualifier `%s' is used\n", $1);
+             }
           }
 
-          /* If the identifier didn't match any known layout identifiers,
-           * emit an error.
-           */
           if (!got_one) {
              _mesa_glsl_error(& @1, state, "unrecognized layout identifier "
                               "`%s'\n", $1);
              YYERROR;
-          } else if (state->ARB_fragment_coord_conventions_warn) {
-             _mesa_glsl_warning(& @1, state,
-                                "GL_ARB_fragment_coord_conventions layout "
-                                "identifier `%s' used\n", $1);
           }
        }
        | IDENTIFIER '=' INTCONSTANT