In some situations it is convenient for a driver to expose a higher GLSL
version while some extensions are still incomplete. However in that
situation, it would report a GLSL version that was higher than the GL
version. Avoid that situation by limiting the GLSL version to the GL
version.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API);
+ /* Make sure that the GLSL version lines up with the GL version. In some
+ * cases it can be too high, e.g. if an extension is missing.
+ */
+ if (ctx->API == API_OPENGL_CORE) {
+ switch (ctx->Version) {
+ case 31:
+ ctx->Const.GLSLVersion = 140;
+ break;
+ case 32:
+ ctx->Const.GLSLVersion = 150;
+ break;
+ default:
+ ctx->Const.GLSLVersion = ctx->Version * 10;
+ break;
+ }
+ }
+
switch (ctx->API) {
case API_OPENGL_COMPAT:
case API_OPENGL_CORE: