Only allow global precision qualifier for int and float
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 8 Jun 2010 02:02:44 +0000 (19:02 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 8 Jun 2010 02:03:03 +0000 (19:03 -0700)
This causes the following tests to pass:

    glslparsertest/glsl2/precision-03.vert

glsl_parser.ypp

index 4de1ec9591ce117dd3a37236068d25ca51001947..99c6ca132c7378be42adf273c7258ec40b9b28f5 100644 (file)
@@ -628,6 +628,13 @@ 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;
+          }
+
           $$ = NULL; /* FINISHME */
        }
        ;