diff options
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/glx/xlib/xm_api.c | 22 | ||||
-rw-r--r-- | src/gallium/state_trackers/wgl/stw_context.c | 22 |
2 files changed, 34 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 75e9e11e05d..5d99e5f7a4e 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); diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c index 6cc8a83150c..2c4fb0ef084 100644 --- a/src/gallium/state_trackers/wgl/stw_context.c +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -169,7 +169,6 @@ stw_create_context_attribs( ctx->iPixelFormat = iPixelFormat; memset(&attribs, 0, sizeof(attribs)); - attribs.profile = ST_PROFILE_DEFAULT; attribs.visual = pfi->stvis; attribs.major = majorVersion; attribs.minor = minorVersion; @@ -177,10 +176,23 @@ stw_create_context_attribs( attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE; if (contextFlags & WGL_CONTEXT_DEBUG_BIT_ARB) attribs.flags |= ST_CONTEXT_FLAG_DEBUG; - if (profileMask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB) - attribs.flags |= ST_CONTEXT_FLAG_CORE_PROFILE; - if (profileMask & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) - attribs.flags |= ST_CONTEXT_FLAG_COMPATIBLE_PROFILE; + + /* There are no profiles before OpenGL 3.2. The + * WGL_ARB_create_context_profile spec says: + * + * "If the requested OpenGL version is less than 3.2, + * WGL_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 WGL_CONTEXT_PROFILE_MASK_ARB is + * WGL_CONTEXT_CORE_PROFILE_BIT_ARB." + */ + attribs.profile = ST_PROFILE_DEFAULT; + if ((major > 3 || (major == 3 && minor >= 2)) + && ((profileMask & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) == 0)) + attribs.profile = ST_PROFILE_OPENGL_CORE; ctx->st = stw_dev->stapi->create_context(stw_dev->stapi, stw_dev->smapi, &attribs, shareCtx ? shareCtx->st : NULL); |