[Mesa-dev] [PATCH 20/20] mesa: Allow MESA_GL_VERSION_OVERRIDE with ES contexts

Ian Romanick idr at freedesktop.org
Wed May 13 12:44:48 PDT 2015


From: Ian Romanick <ian.d.romanick at intel.com>

The bulk of the change is to prevent overriding the context to
API_OPENGL_CORE based on the requested version.  If the context is
API_OPENGL_ES2, don't change it.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/dri/common/dri_util.c |  4 ++++
 src/mesa/main/context.c                |  4 +---
 src/mesa/main/version.c                | 16 +++++++++-------
 src/mesa/state_tracker/st_manager.c    |  3 +--
 4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index d6e875f..680a907 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -163,6 +163,10 @@ driCreateNewScreen2(int scrn, int fd,
     }
 
     int gl_version_override = _mesa_get_gl_version_override();
+    if (gl_version_override >= 20) {
+       psp->max_gl_es2_version = MAX2(psp->max_gl_es2_version,
+                                      gl_version_override);
+    }
     if (gl_version_override >= 31) {
        psp->max_gl_core_version = MAX2(psp->max_gl_core_version,
                                        gl_version_override);
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 0a192de..44a1505 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1111,9 +1111,7 @@ _mesa_initialize_context(struct gl_context *ctx,
       ctx->HasConfig = GL_FALSE;
    }
 
-   if (_mesa_is_desktop_gl(ctx)) {
-      _mesa_override_gl_version(ctx);
-   }
+   _mesa_override_gl_version(ctx);
 
    /* misc one-time initializations */
    one_time_init(ctx);
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index e817e2d..212b33b 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -134,13 +134,15 @@ _mesa_override_gl_version_contextless(struct gl_constants *consts,
 
    if (version > 0) {
       *versionOut = version;
-      if (version >= 30 && fwd_context) {
-         *apiOut = API_OPENGL_CORE;
-         consts->ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
-      } else if (version >= 31 && !compat_context) {
-         *apiOut = API_OPENGL_CORE;
-      } else {
-         *apiOut = API_OPENGL_COMPAT;
+      if (*apiOut == API_OPENGL_CORE || *apiOut == API_OPENGL_COMPAT) {
+         if (version >= 30 && fwd_context) {
+            *apiOut = API_OPENGL_CORE;
+            consts->ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
+         } else if (version >= 31 && !compat_context) {
+            *apiOut = API_OPENGL_CORE;
+         } else {
+            *apiOut = API_OPENGL_COMPAT;
+         }
       }
       return true;
    }
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 0376954..a2dee62 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -924,8 +924,7 @@ static unsigned get_version(struct pipe_screen *screen,
    struct gl_extensions extensions = {0};
    GLuint version;
 
-   if ((api == API_OPENGL_COMPAT || api == API_OPENGL_CORE) &&
-       _mesa_override_gl_version_contextless(&consts, &api, &version)) {
+   if (_mesa_override_gl_version_contextless(&consts, &api, &version)) {
       return version;
    }
 
-- 
2.1.0



More information about the mesa-dev mailing list