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 4de1ec9..99c6ca1 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 */
        }
        ;