diff options
author | Brian Paul <[email protected]> | 2015-03-27 10:54:10 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2015-03-30 11:25:39 -0600 |
commit | dbe67d76e0487b04a7b6081d9d46666db3c3ee3e (patch) | |
tree | 4e86116fa17fc7f593d3030c7c5ba24ec77701ba /src/glsl/glsl_parser_extras.cpp | |
parent | c519c4d85e7b4f9cad4e51dc08e8ae99bf3c810d (diff) |
glsl: allow ForceGLSLVersion to override #version directives
Previously, the ctx->Const.ForceGLSLVersion setting only worked if
the shader lacked a #version directive. Now, the ForceGLSLVersion
setting will override the #version directive too.
This change should be safe since it should be rare to have an app
that has a mix of shader versions and we only wanted to override
the #version for shaders which lacked the #version directive.
Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser_extras.cpp')
-rw-r--r-- | src/glsl/glsl_parser_extras.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 79624bc263c..0aa3c54fc8b 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -73,8 +73,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->uses_builtin_functions = false; /* Set default language version and extensions */ - this->language_version = ctx->Const.ForceGLSLVersion ? - ctx->Const.ForceGLSLVersion : 110; + this->language_version = 110; + this->forced_language_version = ctx->Const.ForceGLSLVersion; this->es_shader = false; this->ARB_texture_rectangle_enable = true; @@ -320,11 +320,14 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version, this->ARB_texture_rectangle_enable = false; } - this->language_version = version; + if (this->forced_language_version) + this->language_version = this->forced_language_version; + else + this->language_version = version; bool supported = false; for (unsigned i = 0; i < this->num_supported_versions; i++) { - if (this->supported_versions[i].ver == (unsigned) version + if (this->supported_versions[i].ver == this->language_version && this->supported_versions[i].es == this->es_shader) { supported = true; break; |