summaryrefslogtreecommitdiffstats
path: root/src/glsl/glsl_parser_extras.h
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2012-08-02 06:45:30 -0700
committerIan Romanick <[email protected]>2012-12-06 12:13:21 -0800
commitdc9f9d8e66ac3ec934a82d25da7b76902f775802 (patch)
tree1b316c5a26a3d71636759c420bb3061c36d9ac75 /src/glsl/glsl_parser_extras.h
parentd9bfaa104ed4debeff6c7d69daf4d9cc85cadb8d (diff)
glsl: Compute version_string on the fly.
Fixes a bug where version_string would be left uninitialized if no GLSL "#version" directive was used. Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Carl Worth <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser_extras.h')
-rw-r--r--src/glsl/glsl_parser_extras.h11
1 files changed, 10 insertions, 1 deletions
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;
/**