diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2012-07-04 15:21:04 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-07-05 11:44:17 -0700 |
commit | 41d5120eaf2bdf308eb904cac9b5027b003fea8d (patch) | |
tree | cc0fbca23020b964eb52a9a0583d943db84e8f61 /glx/createcontext.c | |
parent | cef0b808d3152a20cd98d32457dde08bd5434e7c (diff) |
glx: Implement GLX_EXT_create_context_es2_profile
This patch builds on the infrastucture put in place for
GLX_ARB_create_context_profile. If GLX_CONTEXT_ES2_PROFILE_BIT_EXT is
specified and the requested version is 2.0, create a context with the
__DRI_API_GLES2 API.
This change assumes that any DRI2 driver can handle (possibly by saying "no
seeing an API setting other than __DRI_API_OPENGL or __DRI_API_OPENGL_CORE.
This allows enabling the extension any time GLX_ARB_create_context (and
GLX_ARB_create_context_profile) is enabled.
v2: Clean up some comments. Note that our behavior for
GLX_CONTEXT_ES2_PROFILE_BIT_EXT w/version != 2.0 matches NVIDIA's.
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>
Diffstat (limited to 'glx/createcontext.c')
-rw-r--r-- | glx/createcontext.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/glx/createcontext.c b/glx/createcontext.c index 6f580f02b..2ba0e18c6 100644 --- a/glx/createcontext.c +++ b/glx/createcontext.c @@ -229,6 +229,32 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) case GLX_CONTEXT_CORE_PROFILE_BIT_ARB: case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: break; + case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: + /* The GLX_EXT_create_context_es2_profile spec says: + * + * "... If the version requested is 2.0, and the + * GLX_CONTEXT_ES2_PROFILE_BIT_EXT bit is set in the + * GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the + * context returned will implement OpenGL ES 2.0." + * + * It also says: + * + * "* If attribute GLX_CONTEXT_PROFILE_MASK_ARB has no bits set; + * has any bits set other than + * GLX_CONTEXT_CORE_PROFILE_BIT_ARB, + * GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, or + * GLX_CONTEXT_ES2_PROFILE_BIT_EXT; has more than one of these + * bits set; or if the implementation does not supported the + * requested profile, then GLXBadProfileARB is generated." + * + * It does not specifically say what is supposed to happen if + * GLX_CONTEXT_ES2_PROFILE_BIT_EXT is set but the version requested is + * not 2.0. We choose to generate GLXBadProfileARB as this matches + * NVIDIA's behavior. + */ + if (major_version != 2 || minor_version != 0) + return __glXError(GLXBadProfileARB); + break; default: return __glXError(GLXBadProfileARB); } |