st/glx: define/set new ST_CONTEXT_FLAG_bits

This commit is contained in:
Brian Paul 2011-05-19 19:40:32 -06:00
parent 1929d52fd9
commit 38f89c7008
2 changed files with 25 additions and 11 deletions

View file

@ -69,6 +69,15 @@ enum st_profile_type
#define ST_PROFILE_OPENGL_ES1_MASK (1 << ST_PROFILE_OPENGL_ES1) #define ST_PROFILE_OPENGL_ES1_MASK (1 << ST_PROFILE_OPENGL_ES1)
#define ST_PROFILE_OPENGL_ES2_MASK (1 << ST_PROFILE_OPENGL_ES2) #define ST_PROFILE_OPENGL_ES2_MASK (1 << ST_PROFILE_OPENGL_ES2)
/**
* New context flags for GL 3.0 and beyond.
*/
#define ST_CONTEXT_FLAG_CORE_PROFILE (1 << 0)
#define ST_CONTEXT_FLAG_COMPATIBLE_PROFILE (1 << 1)
#define ST_CONTEXT_FLAG_FORWARD_COMPATIBLE (1 << 2)
#define ST_CONTEXT_FLAG_DEBUG (1 << 3)
#define ST_CONTEXT_FLAG_ROBUST_ACCESS (1 << 4)
/** /**
* Used in st_context_iface->teximage. * Used in st_context_iface->teximage.
*/ */
@ -207,21 +216,14 @@ struct st_context_attribs
* The profile and minimal version to support. * The profile and minimal version to support.
* *
* The valid profiles and versions are rendering API dependent. The latest * The valid profiles and versions are rendering API dependent. The latest
* version satisfying the request should be returned, unless * version satisfying the request should be returned, unless the
* forward_compatiible is true. * ST_CONTEXT_FLAG_FORWARD_COMPATIBLE bit is set.
*/ */
enum st_profile_type profile; enum st_profile_type profile;
int major, minor; int major, minor;
/** /** Mask of ST_CONTEXT_FLAG_x bits */
* Enable debugging. unsigned flags;
*/
boolean debug;
/**
* Return the exact version and disallow the use of deprecated features.
*/
boolean forward_compatible;
/** /**
* The visual of the framebuffers the context will be bound to. * The visual of the framebuffers the context will be bound to.

View file

@ -876,6 +876,18 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
memset(&attribs, 0, sizeof(attribs)); memset(&attribs, 0, sizeof(attribs));
attribs.profile = ST_PROFILE_DEFAULT; attribs.profile = ST_PROFILE_DEFAULT;
attribs.visual = v->stvis; attribs.visual = v->stvis;
attribs.major = major;
attribs.minor = minor;
if (contextFlags & GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)
attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE;
if (contextFlags & GLX_CONTEXT_DEBUG_BIT_ARB)
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;
c->st = stapi->create_context(stapi, xmdpy->smapi, c->st = stapi->create_context(stapi, xmdpy->smapi,
&attribs, (share_list) ? share_list->st : NULL); &attribs, (share_list) ? share_list->st : NULL);