summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/dri/common
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-09-26 12:01:56 -0700
committerEric Anholt <eric@anholt.net>2013-10-10 16:34:30 -0700
commit083f66fdd6451648fe355b64b02b29a6a4389f0d (patch)
tree7965c2cd9f5b2f96ea1268ef6640d6e39ed55bff /src/gallium/state_trackers/dri/common
parentd81632fb1e809a0b1ee9310ae3a4733a1c0651b7 (diff)
dri: Move API version validation into dri/common.
i965, i915, radeon, r200, swrast, and nouveau were mostly trying to do the same logic, except where they failed to. Notably, swrast had code that appeared to try to enable GLES1/2 but forgot to set api_mask (thus preventing any gles context from being created), and the non-intel drivers didn't support MESA_GL_VERSION_OVERRIDE. nouveau still relies on _mesa_compute_version(), because I don't know what its limits actually are, and gallium drivers don't declare limits up front at all. I think I've heard talk about doing so, though. v2: Compat max version should be 30 (noted by Ken) Drop r100's custom max version check, too (noted by Emil Velikov) Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/gallium/state_trackers/dri/common')
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index 779741e32e3..92cac73d5bc 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -438,6 +438,19 @@ dri_init_screen_helper(struct dri_screen *screen,
dri_postprocessing_init(screen);
+ /* gallium drivers don't declare what version of GL they support, so we
+ * check the computed Mesa context version after context creation and fail
+ * out then.
+ */
+ if (screen->st_api->profile_mask & ST_PROFILE_DEFAULT_MASK)
+ screen->sPriv->max_gl_compat_version = 30;
+ if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_CORE_MASK)
+ screen->sPriv->max_gl_core_version = 32;
+ if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES1_MASK)
+ screen->sPriv->max_gl_es1_version = 11;
+ if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES2_MASK)
+ screen->sPriv->max_gl_es2_version = 30;
+
return dri_fill_in_modes(screen);
}