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

Author: Andres Gomez <ago...@igalia.com>
Date:   Sat Mar  3 00:55:46 2018 +0200

dri_util: don't fail when not supporting ARB_compatibility with GL3.1

Currently, any driver that does not support the ARB_compatibility
extension will fail on GL3.1 context creation if the application does
not request the forward-compatiblity flag.

Restore the original check which changes mesa_api to API_OPENGL_CORE,
only when:
 - GL3.1 is requested, without the forward-compatiblity flag.
 - driver does not support ARB_compatibility - as deduced by
max_gl_compat_version.

Fixes: a0c8b49284e ("mesa: enable OpenGL 3.1 with ARB_compatibility")

v2:
 - Improve commit log (Emil).
 - Provide a correct explanation on the features documentation (Ian).

Cc: Marek Olšák <marek.ol...@amd.com>
Cc: Ian Romanick <ian.d.roman...@intel.com>
Cc: Kenneth Graunke <kenn...@whitecape.org>
Cc: Eric Engestrom <eric.engest...@imgtec.com>
Cc: Emil Velikov <emil.veli...@collabora.com>
Signed-off-by: Andres Gomez <ago...@igalia.com>
Reviewed-by: Emil Velikov <emil.veli...@collabora.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 docs/features.txt                      | 11 +++++++----
 src/mesa/drivers/dri/common/dri_util.c | 10 ++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 8f003ddd90..b1eb9e91a2 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -24,10 +24,13 @@ not started
 
 # OpenGL Core and Compatibility context support
 
-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.
+Some drivers do not support the Compatibility profile or the
+ARB_compatibility extensions.  If an application does not request a
+specific version without the forward-compatiblity flag, such drivers
+will be limited to OpenGL 3.0.  If an application requests OpenGL 3.1,
+it will get a context that may or may not have the ARB_compatibility
+extension enabled.  Some of the later GL features are exposed in the 3.0
+context as extensions.
 
 
 Feature                                                 Status
diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index 3f780d155b..0b94d19fa5 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -379,6 +379,16 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
        }
     }
 
+    /* The specific Mesa driver may not support the GL_ARB_compatibilty
+     * extension or the compatibility profile.  In that case, we treat an
+     * API_OPENGL_COMPAT 3.1 as API_OPENGL_CORE. We reject API_OPENGL_COMPAT
+     * 3.2+ in any case.
+     */
+    if (mesa_api == API_OPENGL_COMPAT &&
+        ctx_config.major_version == 3 && ctx_config.minor_version == 1 &&
+        screen->max_gl_compat_version < 31)
+       mesa_api = API_OPENGL_CORE;
+
     if (mesa_api == API_OPENGL_COMPAT
         && ((ctx_config.major_version > 3)
             || (ctx_config.major_version == 3 &&

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

Reply via email to