Module: Mesa
Branch: master
Commit: a0c8b49284efe736849c0a45920ad0a1bbd8d93d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0c8b49284efe736849c0a45920ad0a1bbd8d93d

Author: Marek Olšák <marek.ol...@amd.com>
Date:   Wed Feb 14 20:13:40 2018 +0100

mesa: enable OpenGL 3.1 with ARB_compatibility

Tested-by: Dieter Nützel <die...@nuetzel-hh.de>
Reviewed-by: Brian Paul <bri...@vmware.com>

---

 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 1672460a2f..5eae34bf0d 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 0aca0aa1ab..8dd2550ced 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 <strong>only</strong> available if requested at context creation
-because compatibility contexts are not supported.
+4.5 is <strong>only</strong> available if requested at context creation.
+Compatibility contexts may report a lower version depending on each driver.
 </p>
 
 
@@ -44,6 +44,7 @@ Note: some of the new features are only available with 
certain drivers.
 </p>
 
 <ul>
+<li>OpenGL 3.1 with ARB_compatibility on nv50, nvc0, r600, radeonsi, softpipe, 
llvmpipe, svga</li>
 <li>GL_ARB_bindless_texture on nvc0/maxwell+</li>
 <li>GL_EXT_semaphore on radeonsi</li>
 <li>GL_EXT_semaphore_fd on radeonsi</li>
diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index e6a7d2391a..a34f38d611 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 d26baab820..a28069054d 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;
 }
 
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to