From a0c8b49284efe736849c0a45920ad0a1bbd8d93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 14 Feb 2018 20:13:40 +0100 Subject: [PATCH] mesa: enable OpenGL 3.1 with ARB_compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tested-by: Dieter Nützel Reviewed-by: Brian Paul --- docs/features.txt | 8 ++++---- docs/relnotes/18.1.0.html | 5 +++-- src/mesa/drivers/dri/common/dri_util.c | 8 -------- src/mesa/main/version.c | 16 ++++++++++------ 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/docs/features.txt b/docs/features.txt index 1672460a2f8..5eae34bf0df 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -24,10 +24,10 @@ not started # OpenGL Core and Compatibility context support -OpenGL 3.1 and later versions are only supported with the Core profile. -There are no plans to support GL_ARB_compatibility. The last supported OpenGL -version with all deprecated features is 3.0. Some of the later GL features -are exposed in the 3.0 context as extensions. +Some drivers do not support the Compatibility profile or ARB_compatibility. +Such drivers are limited to OpenGL 3.0 if the Core profile is not requested +by applications. Some of the later GL features are exposed in the 3.0 context +as extensions. Feature Status diff --git a/docs/relnotes/18.1.0.html b/docs/relnotes/18.1.0.html index 0aca0aa1abe..8dd2550ced3 100644 --- a/docs/relnotes/18.1.0.html +++ b/docs/relnotes/18.1.0.html @@ -26,8 +26,8 @@ Mesa 18.1.0 implements the OpenGL 4.5 API, but the version reported by glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. Some drivers don't support all the features required in OpenGL 4.5. OpenGL -4.5 is only available if requested at context creation -because compatibility contexts are not supported. +4.5 is only available if requested at context creation. +Compatibility contexts may report a lower version depending on each driver.

@@ -44,6 +44,7 @@ Note: some of the new features are only available with certain drivers.

    +
  • OpenGL 3.1 with ARB_compatibility on nv50, nvc0, r600, radeonsi, softpipe, llvmpipe, svga
  • GL_ARB_bindless_texture on nvc0/maxwell+
  • GL_EXT_semaphore on radeonsi
  • GL_EXT_semaphore_fd on radeonsi
  • diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index e6a7d2391a7..a34f38d6114 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -381,14 +381,6 @@ driCreateContextAttribs(__DRIscreen *screen, int api, } } - /* Mesa does not support the GL_ARB_compatibilty extension or the - * compatibility profile. This means that we treat a API_OPENGL_COMPAT 3.1 as - * API_OPENGL_CORE and reject API_OPENGL_COMPAT 3.2+. - */ - if (mesa_api == API_OPENGL_COMPAT && - ctx_config.major_version == 3 && ctx_config.minor_version == 1) - mesa_api = API_OPENGL_CORE; - if (mesa_api == API_OPENGL_COMPAT && ((ctx_config.major_version > 3) || (ctx_config.major_version == 3 && diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index d26baab8209..a28069054d3 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -580,11 +580,11 @@ _mesa_get_version(const struct gl_extensions *extensions, { 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 */ @@ -607,7 +607,7 @@ void _mesa_compute_version(struct gl_context *ctx) { if (ctx->Version) - return; + goto done; ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API); ctx->Extensions.Version = ctx->Version; @@ -615,7 +615,7 @@ _mesa_compute_version(struct gl_context *ctx) /* 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; @@ -651,6 +651,10 @@ _mesa_compute_version(struct gl_context *ctx) create_version_string(ctx, "OpenGL ES "); break; } + +done: + if (ctx->API == API_OPENGL_COMPAT && ctx->Version >= 31) + ctx->Extensions.ARB_compatibility = GL_TRUE; }