mesa: disallow creation of GL 3.1 compatibility contexts

Death to driver-specific hacks!

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Marek Olšák
2012-12-08 22:48:47 +01:00
parent 25409c6da8
commit 0ac83a2001
3 changed files with 8 additions and 9 deletions

View File

@@ -89,11 +89,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_texture_rgb10_a2ui = true; ctx->Extensions.ARB_texture_rgb10_a2ui = true;
if (intel->gen >= 6) if (intel->gen >= 6)
if (ctx->API == API_OPENGL_CORE) { ctx->Const.GLSLVersion = 140;
ctx->Const.GLSLVersion = 140;
} else {
ctx->Const.GLSLVersion = 130;
}
else else
ctx->Const.GLSLVersion = 120; ctx->Const.GLSLVersion = 120;
_mesa_override_glsl_version(ctx); _mesa_override_glsl_version(ctx);

View File

@@ -345,6 +345,12 @@ _mesa_compute_version(struct gl_context *ctx)
switch (ctx->API) { switch (ctx->API) {
case API_OPENGL_COMPAT: case API_OPENGL_COMPAT:
/* Disable GLSL 1.40 and later for legacy contexts.
* This disallows creation of the GL 3.1 compatibility context. */
if (ctx->Const.GLSLVersion > 130) {
ctx->Const.GLSLVersion = 130;
}
/* fall through */
case API_OPENGL_CORE: case API_OPENGL_CORE:
compute_version(ctx); compute_version(ctx);
break; break;

View File

@@ -570,10 +570,7 @@ void st_init_extensions(struct st_context *st)
glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL); glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL);
if (glsl_feature_level >= 140) { if (glsl_feature_level >= 140) {
if (ctx->API == API_OPENGL_CORE) ctx->Const.GLSLVersion = 140;
ctx->Const.GLSLVersion = 140;
else
ctx->Const.GLSLVersion = 130;
} else if (glsl_feature_level >= 130) { } else if (glsl_feature_level >= 130) {
ctx->Const.GLSLVersion = 130; ctx->Const.GLSLVersion = 130;
} else { } else {