summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ast_to_hir.cpp6
-rw-r--r--src/glsl/glsl_parser.yy13
-rw-r--r--src/glsl/glsl_parser_extras.h11
3 files changed, 18 insertions, 12 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 75b551b2db4..adada30509e 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -449,7 +449,7 @@ modulus_result_type(const struct glsl_type *type_a,
if (state->language_version < 130) {
_mesa_glsl_error(loc, state,
"operator '%%' is reserved in %s",
- state->version_string);
+ state->get_version_string());
return glsl_type::error_type;
}
@@ -2618,13 +2618,13 @@ ast_declarator_list::hir(exec_list *instructions,
_mesa_glsl_error(& loc, state,
"`out' qualifier in declaration of `%s' "
"only valid for function parameters in %s.",
- decl->identifier, state->version_string);
+ decl->identifier, state->get_version_string());
}
if (this->type->qualifier.flags.q.in) {
_mesa_glsl_error(& loc, state,
"`in' qualifier in declaration of `%s' "
"only valid for function parameters in %s.",
- decl->identifier, state->version_string);
+ decl->identifier, state->get_version_string());
}
/* FINISHME: Test for other invalid qualifiers. */
}
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 03e05ff1bf3..e68a601c89e 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -289,14 +289,11 @@ version_statement:
}
state->language_version = $2;
- state->version_string =
- glsl_compute_version_string(state, state->es_shader,
- state->language_version);
if (!supported) {
_mesa_glsl_error(& @2, state, "%s is not supported. "
"Supported versions are: %s\n",
- state->version_string,
+ state->get_version_string(),
state->supported_version_string);
}
@@ -316,7 +313,7 @@ pragma_statement:
if (state->language_version == 110) {
_mesa_glsl_warning(& @1, state,
"pragma `invariant(all)' not supported in %s",
- state->version_string);
+ state->get_version_string());
} else {
state->all_invariant = true;
}
@@ -1501,7 +1498,7 @@ precision_qualifier:
"precision qualifier forbidden "
"in %s (1.30 or later "
"required)\n",
- state->version_string);
+ state->get_version_string());
$$ = ast_precision_high;
}
@@ -1511,7 +1508,7 @@ precision_qualifier:
"precision qualifier forbidden "
"in %s (1.30 or later "
"required)\n",
- state->version_string);
+ state->get_version_string());
$$ = ast_precision_medium;
}
@@ -1521,7 +1518,7 @@ precision_qualifier:
"precision qualifier forbidden "
"in %s (1.30 or later "
"required)\n",
- state->version_string);
+ state->get_version_string());
$$ = ast_precision_low;
}
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 5bad5a94d3c..26fdee1c14d 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -80,6 +80,16 @@ struct _mesa_glsl_parse_state {
ralloc_free(mem);
}
+ /**
+ * Generate a string representing the GLSL version currently being compiled
+ * (useful for error messages).
+ */
+ const char *get_version_string()
+ {
+ return glsl_compute_version_string(this, this->es_shader,
+ this->language_version);
+ }
+
struct gl_context *const ctx;
void *scanner;
exec_list translation_unit;
@@ -91,7 +101,6 @@ struct _mesa_glsl_parse_state {
bool es_shader;
unsigned language_version;
- const char *version_string;
enum _mesa_glsl_parser_targets target;
/**