glGetString(GL_VERSION). Valid values are point-separated version numbers,
such as "3.0". Mesa will not really implement all the features of the given
version if it's higher than what's normally reported.
+<li>MESA_GLSL_VERSION_OVERRIDE - changes the value returned by
+glGetString(GL_SHADING_LANGUAGE_VERSION). Valid values are integers, such as
+"130". Mesa will not really implement all the features of the given language version
+if it's higher than what's normally reported. (for developers only)
<li>MESA_GLSL - <a href="shading.html#envvars">shading language compiler options</a>
</ul>
ctx->Extensions.OES_EGL_image = true;
#endif
- ctx->Const.GLSLVersion = get_glsl_version();
+ ctx->Const.GLSLVersion = 120;
+ _mesa_override_glsl_version(ctx);
if (intel->gen >= 5)
ctx->Extensions.EXT_timer_query = true;
}
ctx->Const.GLSLVersion = 120;
+ _mesa_override_glsl_version(ctx);
ctx->Const.MaxTextureImageUnits = 16;
/* 8 per clause on r6xx, 16 on r7xx
/* Shading language version */
if (ctx->API == API_OPENGL) {
ctx->Const.GLSLVersion = 120;
+ _mesa_override_glsl_version(ctx);
}
else if (ctx->API == API_OPENGLES2) {
ctx->Const.GLSLVersion = 100;
}
}
+/**
+ * Override the context's GLSL version if the environment variable
+ * MESA_GLSL_VERSION_OVERRIDE is set. Valid values for
+ * MESA_GLSL_VERSION_OVERRIDE are integers, such as "130".
+ */
+void
+_mesa_override_glsl_version(struct gl_context *ctx)
+{
+ const char *env_var = "MESA_GLSL_VERSION_OVERRIDE";
+ const char *version;
+ int n;
+
+ version = getenv(env_var);
+ if (!version) {
+ return;
+ }
+
+ n = sscanf(version, "%d", &ctx->Const.GLSLVersion);
+ if (n != 1) {
+ fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version);
+ return;
+ }
+}
+
/**
* Examine enabled GL extensions to determine GL version.
* Return major and minor version numbers.
extern void
_mesa_compute_version(struct gl_context *ctx);
+extern void
+_mesa_override_glsl_version(struct gl_context *ctx);
#endif /* VERSION_H */
c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET);
c->GLSLVersion = 120;
+ _mesa_override_glsl_version(c);
c->UniformBooleanTrue = ~0;
}
}