summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2016-01-20 15:43:10 -0500
committerAdam Jackson <ajax@redhat.com>2016-01-21 10:11:07 -0500
commitbc415fb1e0031ad23bda6e9c3f4664532876a0e5 (patch)
treeb6c0a1e26f5c88f822724437cb80322a5ad92757
parent49aa5e3ea4eecea0562c05a4e52962985a56e510 (diff)
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>
-rw-r--r--glx/createcontext.c31
-rw-r--r--glx/extension_string.c1
-rw-r--r--glx/extension_string.h1
-rw-r--r--glx/glxdri2.c4
-rw-r--r--glx/glxdriswrast.c2
5 files changed, 13 insertions, 26 deletions
diff --git a/glx/createcontext.c b/glx/createcontext.c
index d06bc1f7f..9157e2fb8 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -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);
diff --git a/glx/extension_string.c b/glx/extension_string.c
index e881d2109..cf9014609 100644
--- a/glx/extension_string.c
+++ b/glx/extension_string.c
@@ -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, },
diff --git a/glx/extension_string.h b/glx/extension_string.h
index bac7b0624..ffaab073a 100644
--- a/glx/extension_string.h
+++ b/glx/extension_string.h
@@ -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,
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 6fb3d9278..89ad808c9 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -864,11 +864,13 @@ initializeExtensions(__GLXDRIscreen * screen)
__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)) {
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index e8e53bfdb..be00f5f06 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -405,6 +405,8 @@ initializeExtensions(__GLXDRIscreen * screen)
__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");
}