[Mesa-dev] [PATCH 16/25] st/dri: cap the reported max_gl*version against the ones supported by core mesa

Emil Velikov emil.l.velikov at gmail.com
Fri Feb 21 19:04:06 PST 2014


XXX: Squash with previous patch
XXX: Add similar treatment to classic mesa

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/gallium/state_trackers/dri/common/dri_screen.c | 16 ++++++++--------
 src/mesa/main/config.h                             |  9 +++++++++
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index a14ce3c..2205cb8 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -449,20 +449,20 @@ dri_init_screen_helper(struct dri_screen *screen,
    dri_postprocessing_init(screen);
 
    if (screen->st_api->profile_mask & ST_PROFILE_DEFAULT_MASK)
-      screen->sPriv->max_gl_compat_version =
-            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_COMPAT_VERSION);
+      screen->sPriv->max_gl_compat_version = MIN2(MAX_GL_COMPAT_VERSION,
+            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_COMPAT_VERSION));
 
    if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_CORE_MASK)
-      screen->sPriv->max_gl_core_version =
-            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_CORE_VERSION);
+      screen->sPriv->max_gl_core_version = MIN2(MAX_GL_CORE_VERSION,
+            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_CORE_VERSION));
 
    if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES1_MASK)
-      screen->sPriv->max_gl_es1_version =
-            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_ES1_VERSION);
+      screen->sPriv->max_gl_es1_version = MIN2(MAX_GL_ES1_VERSION,
+            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_ES1_VERSION));
 
    if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES2_MASK)
-      screen->sPriv->max_gl_es2_version =
-            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_ES2_VERSION);
+      screen->sPriv->max_gl_es2_version = MIN2(MAX_GL_ES2_VERSION,
+            pscreen->get_param(pscreen, PIPE_CAP_MAX_GL_ES2_VERSION));
 
    return dri_fill_in_modes(screen);
 }
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 30da5d4..0fa58cd 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -299,5 +299,14 @@
  */
 #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
 
+/**
+ * The maximum version of the GL* API supported by core mesa
+ */
+/*@{*/
+#define MAX_GL_COMPAT_VERSION 30
+#define MAX_GL_CORE_VERSION   33
+#define MAX_GL_ES1_VERSION    11
+#define MAX_GL_ES2_VERSION    30
+/*@}*/
 
 #endif /* MESA_CONFIG_H_INCLUDED */
-- 
1.9.0



More information about the mesa-dev mailing list