summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/glx/xlib/xm_api.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2011-12-01 14:24:55 -0800
committerIan Romanick <ian.d.romanick@intel.com>2011-12-23 08:49:47 -0800
commit358ecff1ea0fa8432fd46bd3deeb8d2d694b5550 (patch)
treed8e285471e173a607ce1da802a5dbe64a7e1978c /src/gallium/state_trackers/glx/xlib/xm_api.c
parented4a65c3cfdf88afba48860be34ce26f7c371869 (diff)
downloadexternal_mesa3d-358ecff1ea0fa8432fd46bd3deeb8d2d694b5550.zip
external_mesa3d-358ecff1ea0fa8432fd46bd3deeb8d2d694b5550.tar.gz
external_mesa3d-358ecff1ea0fa8432fd46bd3deeb8d2d694b5550.tar.bz2
st-api: Clean-up OpenGL profile handling
There seems to have been two different ways to communicate the profile. There were flags and there were profiles. I've opted to remove the profile flags and use ST_PROFILE_DEFAULT (compatibility profile) and ST_PROFILE_OPENGL_CORE (core profile) consistently instead. Also change the values of the ST_CONTEXT_FLAG_DEBUG and ST_CONTEXT_FLAG_FORWARD_COMPATIBLE flags to match the WGL and GLX values. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Chia-I Wu <olv@lunarg.com>
Diffstat (limited to 'src/gallium/state_trackers/glx/xlib/xm_api.c')
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 75e9e11..5d99e5f 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -878,7 +878,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
c->xm_read_buffer = NULL;
memset(&attribs, 0, sizeof(attribs));
- attribs.profile = ST_PROFILE_DEFAULT;
attribs.visual = v->stvis;
attribs.major = major;
attribs.minor = minor;
@@ -888,10 +887,23 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
if (contextFlags & GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB)
attribs.flags |= ST_CONTEXT_FLAG_ROBUST_ACCESS;
- if (profileMask & GLX_CONTEXT_CORE_PROFILE_BIT_ARB)
- attribs.flags |= ST_CONTEXT_FLAG_CORE_PROFILE;
- if (profileMask & GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB)
- attribs.flags |= ST_CONTEXT_FLAG_COMPATIBLE_PROFILE;
+
+ /* There are no profiles before OpenGL 3.2. The
+ * GLX_ARB_create_context_profile spec says:
+ *
+ * "If the requested OpenGL version is less than 3.2,
+ * GLX_CONTEXT_PROFILE_MASK_ARB is ignored and the functionality of the
+ * context is determined solely by the requested version."
+ *
+ * The spec also says:
+ *
+ * "The default value for GLX_CONTEXT_PROFILE_MASK_ARB is
+ * GLX_CONTEXT_CORE_PROFILE_BIT_ARB."
+ */
+ attribs.profile = ST_PROFILE_DEFAULT;
+ if ((major > 3 || (major == 3 && minor >= 2))
+ && ((profileMask & GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) == 0))
+ attribs.profile = ST_PROFILE_OPENGL_CORE;
c->st = stapi->create_context(stapi, xmdpy->smapi,
&attribs, (share_list) ? share_list->st : NULL);