glsl: Add version_string containing properly formatted GLSL version
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 8 Jan 2011 00:03:48 +0000 (16:03 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 11 Jan 2011 01:39:16 +0000 (17:39 -0800)
src/glsl/glsl_parser.ypp
src/glsl/glsl_parser_extras.h

index 41b51a7472558739c7be4137172664c20fcee637..124ee18356db785892569ddf72a090bffdd11559 100644 (file)
@@ -228,6 +228,11 @@ version_statement:
           case 130:
              /* FINISHME: Check against implementation support versions. */
              state->language_version = $2;
+             state->version_string =
+                talloc_asprintf(state, "GLSL%s %d.%02d",
+                                state->es_shader ? " ES" : "",
+                                state->language_version / 100,
+                                state->language_version % 100);
              break;
           default:
              _mesa_glsl_error(& @2, state, "Shading language version"
@@ -246,11 +251,8 @@ pragma_statement:
        {
           if (state->language_version < 120) {
              _mesa_glsl_warning(& @1, state,
-                                "pragma `invariant(all)' not supported in "
-                                "GLSL%s %d.%02d",
-                                state->es_shader ? " ES" : "",
-                                state->language_version / 100,
-                                state->language_version % 100);
+                                "pragma `invariant(all)' not supported in %s",
+                                state->version_string);
           } else {
              state->all_invariant = true;
           }
@@ -1296,10 +1298,9 @@ precision_qualifier:
                     if (!state->es_shader && state->language_version < 130)
                        _mesa_glsl_error(& @1, state,
                                         "precision qualifier forbidden "
-                                        "in GLSL %d.%d (1.30 or later "
+                                        "in %s (1.30 or later "
                                         "required)\n",
-                                        state->language_version / 100,
-                                        state->language_version % 100);
+                                        state->version_string);
 
                     $$ = ast_precision_high;
                  }
@@ -1307,10 +1308,9 @@ precision_qualifier:
                     if (!state->es_shader && state->language_version < 130)
                        _mesa_glsl_error(& @1, state,
                                         "precision qualifier forbidden "
-                                        "in GLSL %d.%d (1.30 or later "
+                                        "in %s (1.30 or later "
                                         "required)\n",
-                                        state->language_version / 100,
-                                        state->language_version % 100);
+                                        state->version_string);
 
                     $$ = ast_precision_medium;
                  }
@@ -1318,10 +1318,9 @@ precision_qualifier:
                     if (!state->es_shader && state->language_version < 130)
                        _mesa_glsl_error(& @1, state,
                                         "precision qualifier forbidden "
-                                        "in GLSL %d.%d (1.30 or later "
+                                        "in %s (1.30 or later "
                                         "required)\n",
-                                        state->language_version / 100,
-                                        state->language_version % 100);
+                                        state->version_string);
 
                     $$ = ast_precision_low;
                  }
index 13d3a2979e43c7deb562c55f86281604cd2bb7ec..39c10b99e83d693f06b0bd315ed2e5ba16db2097 100644 (file)
@@ -69,6 +69,7 @@ struct _mesa_glsl_parse_state {
 
    bool es_shader;
    unsigned language_version;
+   const char *version_string;
    enum _mesa_glsl_parser_targets target;
 
    /**