[Mesa-dev] [PATCH 3/3] mesa: glsl: force version too when force_glsl_extensions_warn is used

Maxim Levitsky maximlevitsky at gmail.com
Wed Aug 22 01:23:22 PDT 2012


Unfortunelly some buggy programs use extensions without asking ether for
proper GLSL version nor ask for particular extension.

Moreover the force_glsl_extensions_warn hack is only effective for some
extensions (GL_EXT_texture_array) but unfortunelly isnt effective for other
extensions (I suspect these that declare new built in functions)
Example of this is recently added ARB_shader_bit_encoding extension.
Forcing GLSL version to high value seems to fix this, not sure if this
is acceptable hack though.

This can be reproducted in Unigine Heaven with "ambient occlusion" on.
Note that even with this path shader compilatin fails, because code in Unigine
that gets activated when this extension gets enabled expects implicit conversions
between signed and unsigned immidiate constants. Whether GLSL shold allow this is open
for debate.

Signed-off-by: Maxim Levitsky <maximlevitsky at gmail.com>
---
 src/glsl/glsl_parser_extras.cpp |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 872fcda..754166b 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -105,8 +105,10 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
 
    this->supported_version_string = supported;
 
-   if (ctx->Const.ForceGLSLExtensionsWarn)
+   if (ctx->Const.ForceGLSLExtensionsWarn) {
       _mesa_glsl_process_extension("all", NULL, "warn", NULL, this);
+      this->language_version = 130;
+   }
 
    this->default_uniform_qualifier = new(this) ast_type_qualifier();
    this->default_uniform_qualifier->flags.q.shared = 1;
-- 
1.7.9.5



More information about the mesa-dev mailing list