mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 08:04:30 +00:00
glx: Implement GLX_ARB_create_context_profile
Most of the infrastructure was already in place. This just adds:
* Validate values specified with the GLX_CONTEXT_PROFILE_MASK_ARB
attribute.
* Select a DRI2 "api" based on the setting of
GLX_CONTEXT_PROFILE_MASK_ARB.
* Enable GLX_ARB_create_context_profile extension.
This change assumes that any DRI2 driver can handle (possibly by saying "no")
seeing an API setting other than __DRI_API_OPENGL. This allows enabling this
extension any time GLX_ARB_create_context is enabled.
Also, the validation code in __glXDisp_CreateContextAttribsARB is structured
in a very verbose manner (using a switch-statement) to ease the addition of
GLX_EXT_create_context_es2_profile.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
committed by
Keith Packard
parent
09a8a169d5
commit
cef0b808d3
@@ -90,6 +90,17 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
|
||||
__GLXconfig *config;
|
||||
int err;
|
||||
|
||||
/* The GLX_ARB_create_context_profile spec says:
|
||||
*
|
||||
* "The default value for GLX_CONTEXT_PROFILE_MASK_ARB is
|
||||
* GLX_CONTEXT_CORE_PROFILE_BIT_ARB."
|
||||
*
|
||||
* The core profile only makes sense for OpenGL versions 3.2 and later.
|
||||
* If the version ultimately specified is less than 3.2, the core profile
|
||||
* bit is cleared (see below).
|
||||
*/
|
||||
int profile = GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
|
||||
/* Verify that the size of the packet matches the size inferred from the
|
||||
* sizes specified for the various fields.
|
||||
*/
|
||||
@@ -161,6 +172,10 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
|
||||
render_type = attribs[2 * i + 1];
|
||||
break;
|
||||
|
||||
case GLX_CONTEXT_PROFILE_MASK_ARB:
|
||||
profile = attribs[2 * i + 1];
|
||||
break;
|
||||
|
||||
default:
|
||||
return BadValue;
|
||||
}
|
||||
@@ -202,6 +217,22 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
|
||||
if ((flags & ~ALL_VALID_FLAGS) != 0)
|
||||
return BadValue;
|
||||
|
||||
/* The GLX_ARB_create_context_profile spec says:
|
||||
*
|
||||
* "* If attribute GLX_CONTEXT_PROFILE_MASK_ARB has no bits set; has
|
||||
* any bits set other than GLX_CONTEXT_CORE_PROFILE_BIT_ARB and
|
||||
* GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; has more than one of
|
||||
* these bits set; or if the implementation does not support the
|
||||
* requested profile, then GLXBadProfileARB is generated."
|
||||
*/
|
||||
switch (profile) {
|
||||
case GLX_CONTEXT_CORE_PROFILE_BIT_ARB:
|
||||
case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB:
|
||||
break;
|
||||
default:
|
||||
return __glXError(GLXBadProfileARB);
|
||||
}
|
||||
|
||||
/* Allocate memory for the new context
|
||||
*/
|
||||
if (req->isDirect) {
|
||||
|
||||
Reference in New Issue
Block a user