[Mesa-dev] [PATCH 3/3] mesa: final changes to expose OpenGL 3.1 with ARB_compatibility
Marek Olšák
maraeo at gmail.com
Sat Oct 21 12:54:35 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/main/extensions_table.h | 1 +
src/mesa/main/mtypes.h | 1 +
src/mesa/main/version.c | 13 ++++++++-----
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index e26d395..38e915d 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -33,20 +33,21 @@ EXT(ARB_ES3_2_compatibility , ARB_ES3_2_compatibility
EXT(ARB_ES3_compatibility , ARB_ES3_compatibility , GLL, GLC, x , x , 2012)
EXT(ARB_arrays_of_arrays , ARB_arrays_of_arrays , GLL, GLC, x , x , 2012)
EXT(ARB_base_instance , ARB_base_instance , GLL, GLC, x , x , 2011)
EXT(ARB_bindless_texture , ARB_bindless_texture , GLL, GLC, x , x , 2013)
EXT(ARB_blend_func_extended , ARB_blend_func_extended , GLL, GLC, x , x , 2009)
EXT(ARB_buffer_storage , ARB_buffer_storage , GLL, GLC, x , x , 2013)
EXT(ARB_clear_buffer_object , dummy_true , GLL, GLC, x , x , 2012)
EXT(ARB_clear_texture , ARB_clear_texture , GLL, GLC, x , x , 2013)
EXT(ARB_clip_control , ARB_clip_control , GLL, GLC, x , x , 2014)
EXT(ARB_color_buffer_float , ARB_color_buffer_float , GLL, GLC, x , x , 2004)
+EXT(ARB_compatibility , ARB_compatibility , GLL, x , x , x , 2009)
EXT(ARB_compressed_texture_pixel_storage , dummy_true , GLL, GLC, x , x , 2011)
EXT(ARB_compute_shader , ARB_compute_shader , GLL, GLC, x , x , 2012)
EXT(ARB_compute_variable_group_size , ARB_compute_variable_group_size , GLL, GLC, x , x , 2013)
EXT(ARB_conditional_render_inverted , ARB_conditional_render_inverted , GLL, GLC, x , x , 2014)
EXT(ARB_conservative_depth , ARB_conservative_depth , GLL, GLC, x , x , 2011)
EXT(ARB_copy_buffer , dummy_true , GLL, GLC, x , x , 2008)
EXT(ARB_copy_image , ARB_copy_image , GLL, GLC, x , x , 2012)
EXT(ARB_cull_distance , ARB_cull_distance , GLL, GLC, x , x , 2014)
EXT(ARB_debug_output , dummy_true , GLL, GLC, x , x , 2009)
EXT(ARB_depth_buffer_float , ARB_depth_buffer_float , GLL, GLC, x , x , 2008)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 2802a0e..8a1fae1 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4012,20 +4012,21 @@ struct gl_extensions
GLboolean ARB_ES3_1_compatibility;
GLboolean ARB_ES3_2_compatibility;
GLboolean ARB_arrays_of_arrays;
GLboolean ARB_base_instance;
GLboolean ARB_bindless_texture;
GLboolean ARB_blend_func_extended;
GLboolean ARB_buffer_storage;
GLboolean ARB_clear_texture;
GLboolean ARB_clip_control;
GLboolean ARB_color_buffer_float;
+ GLboolean ARB_compatibility;
GLboolean ARB_compute_shader;
GLboolean ARB_compute_variable_group_size;
GLboolean ARB_conditional_render_inverted;
GLboolean ARB_conservative_depth;
GLboolean ARB_copy_image;
GLboolean ARB_cull_distance;
GLboolean ARB_depth_buffer_float;
GLboolean ARB_depth_clamp;
GLboolean ARB_depth_texture;
GLboolean ARB_derivative_control;
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 90c5c5f..06b8e4d 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -572,25 +572,25 @@ compute_version_es2(const struct gl_extensions *extensions,
return 0;
}
}
GLuint
_mesa_get_version(const struct gl_extensions *extensions,
struct gl_constants *consts, gl_api api)
{
switch (api) {
case API_OPENGL_COMPAT:
- /* Disable GLSL 1.40 and later for legacy contexts.
- * This disallows creation of the GL 3.1 compatibility context. */
+ /* Disable higher GLSL versions for legacy contexts.
+ * This disallows creation of higher compatibility contexts. */
if (!consts->AllowHigherCompatVersion) {
- if (consts->GLSLVersion > 130) {
- consts->GLSLVersion = 130;
+ if (consts->GLSLVersion > 140) {
+ consts->GLSLVersion = 140;
}
}
/* fall through */
case API_OPENGL_CORE:
return compute_version(extensions, consts, api);
case API_OPENGLES:
return compute_version_es1(extensions);
case API_OPENGLES2:
return compute_version_es2(extensions, consts);
}
@@ -604,24 +604,27 @@ _mesa_get_version(const struct gl_extensions *extensions,
*/
void
_mesa_compute_version(struct gl_context *ctx)
{
if (ctx->Version)
return;
ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API);
ctx->Extensions.Version = ctx->Version;
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Version >= 31)
+ ctx->Extensions.ARB_compatibility = GL_TRUE;
+
/* 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) {
+ if (_mesa_is_desktop_gl(ctx) && ctx->Version >= 31) {
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;
--
2.7.4
More information about the mesa-dev
mailing list