[Mesa-dev] [PATCH 1/3] egl: rework handling EGL_CONTEXT_FLAGS for ES debug contexts
Matthew Waters
ystreet00 at gmail.com
Wed Oct 29 03:43:03 PDT 2014
From: Matthew Waters <ystreet00 at gmail.com>
As of version 15 of the EGL_KHR_create_context spec, debug contexts
are allowed for ES contexts. We should allow creation instead of
erroring.
Signed-off-by: Matthew Waters <ystreet00 at gmail.com>
---
src/egl/main/eglcontext.c | 51 ++++++++++++++++++++++++++++++----
src/mesa/drivers/dri/common/dri_util.c | 17 ------------
2 files changed, 45 insertions(+), 23 deletions(-)
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 514b91a..ab50fe7 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -121,12 +121,51 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
/* The EGL_KHR_create_context spec says:
*
- * "Flags are only defined for OpenGL context creation, and
- * specifying a flags value other than zero for other types of
- * contexts, including OpenGL ES contexts, will generate an
- * error."
+ * "If the EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR flag bit is set in
+ * EGL_CONTEXT_FLAGS_KHR, then a <debug context> will be created.
+ * [...]
+ * In some cases a debug context may be identical to a non-debug
+ * context. This bit is supported for OpenGL and OpenGL ES
+ * contexts."
+ */
+ if (api != EGL_OPENGL_API && api != EGL_OPENGL_ES_API
+ && (val & EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR)) {
+ err = EGL_BAD_ATTRIBUTE;
+ break;
+ }
+
+ /* The EGL_KHR_create_context spec says:
+ *
+ * "If the EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR flag bit
+ * is set in EGL_CONTEXT_FLAGS_KHR, then a <forward-compatible>
+ * context will be created. Forward-compatible contexts are
+ * defined only for OpenGL versions 3.0 and later. They must not
+ * support functionality marked as <deprecated> by that version of
+ * the API, while a non-forward-compatible context must support
+ * all functionality in that version, deprecated or not. This bit
+ * is supported for OpenGL contexts, and requesting a
+ * forward-compatible context for OpenGL versions less than 3.0
+ * will generate an error."
+ */
+ if ((val & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR)
+ && (api != EGL_OPENGL_API || ctx->ClientMajorVersion < 3)) {
+ err = EGL_BAD_ATTRIBUTE;
+ break;
+ }
+
+ /* The EGL_KHR_create_context_spec says:
+ *
+ * "If the EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR bit is set in
+ * EGL_CONTEXT_FLAGS_KHR, then a context supporting <robust buffer
+ * access> will be created. Robust buffer access is defined in the
+ * GL_ARB_robustness extension specification, and the resulting
+ * context must also support either the GL_ARB_robustness
+ * extension, or a version of OpenGL incorporating equivalent
+ * functionality. This bit is supported for OpenGL contexts.
*/
- if (api != EGL_OPENGL_API && val != 0) {
+ if ((val & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR)
+ && (api != EGL_OPENGL_API
+ || !dpy->Extensions.EXT_create_context_robustness)) {
err = EGL_BAD_ATTRIBUTE;
break;
}
@@ -194,7 +233,7 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
break;
}
- ctx->Flags = EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
+ ctx->Flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
break;
default:
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 6c78928..7a953ba 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -376,23 +376,6 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
return NULL;
}
- /* The EGL_KHR_create_context spec says:
- *
- * "Flags are only defined for OpenGL context creation, and specifying
- * a flags value other than zero for other types of contexts,
- * including OpenGL ES contexts, will generate an error."
- *
- * The GLX_EXT_create_context_es2_profile specification doesn't say
- * anything specific about this case. However, none of the known flags
- * have any meaning in an ES context, so this seems safe.
- */
- if (mesa_api != API_OPENGL_COMPAT
- && mesa_api != API_OPENGL_CORE
- && flags != 0) {
- *error = __DRI_CTX_ERROR_BAD_FLAG;
- return NULL;
- }
-
/* There are no forward-compatible contexts before OpenGL 3.0. The
* GLX_ARB_create_context spec says:
*
--
2.1.2
More information about the mesa-dev
mailing list