glx: Fix GLX_EXT_create_context_es2_profile support

As of v4 of this extension, any GLES version number may be requested (to
enable GLES3 and later). To comply with this, simply remove the API
version checks and leave it to the DRI driver to validate. This happens
to also enable using GLES1 in direct contexts, so if that's the dire
situation you find yourself in, your client driver at least stands a
chance of working.

v4 also specifies that both extension strings should be advertised for
compatibility with clients written against v1 of the extension spec, so
add the es_profile bit to the extension list and enable it whenever we
would enable es2_profile.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2016-01-20 15:43:10 -05:00
parent 49aa5e3ea4
commit bc415fb1e0
5 changed files with 13 additions and 26 deletions

View File

@ -254,36 +254,17 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
* 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."
*
* The GLX_EXT_create_context_es2_profile spec doesn't exactly say what
* is supposed to happen if an invalid version is set, but it doesn't
* much matter as support for GLES contexts is only defined for direct
* contexts (at the moment anyway) so we can leave it up to the driver
* to validate.
*/
switch (profile) {
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);

View File

@ -80,6 +80,7 @@ static const struct extension_info known_glx_extensions[] = {
{ GLX(ARB_framebuffer_sRGB), VER(0,0), N, },
{ GLX(ARB_multisample), VER(1,4), Y, },
{ GLX(EXT_create_context_es_profile), VER(0,0), N, },
{ GLX(EXT_create_context_es2_profile), VER(0,0), N, },
{ GLX(EXT_framebuffer_sRGB), VER(0,0), N, },
{ GLX(EXT_import_context), VER(0,0), Y, },

View File

@ -43,6 +43,7 @@ enum {
ARB_fbconfig_float_bit,
ARB_framebuffer_sRGB_bit,
ARB_multisample_bit,
EXT_create_context_es_profile_bit,
EXT_create_context_es2_profile_bit,
EXT_import_context_bit,
EXT_texture_from_pixmap_bit,

View File

@ -863,12 +863,14 @@ initializeExtensions(__GLXDRIscreen * screen)
"GLX_ARB_create_context");
__glXEnableExtension(screen->glx_enable_bits,
"GLX_ARB_create_context_profile");
__glXEnableExtension(screen->glx_enable_bits,
"GLX_EXT_create_context_es_profile");
__glXEnableExtension(screen->glx_enable_bits,
"GLX_EXT_create_context_es2_profile");
LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_create_context\n");
LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_create_context_profile\n");
LogMessage(X_INFO,
"AIGLX: enabled GLX_EXT_create_context_es2_profile\n");
"AIGLX: enabled GLX_EXT_create_context_es{,2}_profile\n");
}
if (DRI2HasSwapControl(pScreen)) {

View File

@ -404,6 +404,8 @@ initializeExtensions(__GLXDRIscreen * screen)
"GLX_ARB_create_context");
__glXEnableExtension(screen->glx_enable_bits,
"GLX_ARB_create_context_profile");
__glXEnableExtension(screen->glx_enable_bits,
"GLX_EXT_create_context_es_profile");
__glXEnableExtension(screen->glx_enable_bits,
"GLX_EXT_create_context_es2_profile");
}