summaryrefslogtreecommitdiff
path: root/src/egl/main/eglcontext.c
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@chown.ath.cx>2017-06-29 02:44:03 +0200
committerGrigori Goronzy <greg@chown.ath.cx>2017-07-14 21:23:44 +0200
commit4909519a66551745969a6fdcb82beefe690549d3 (patch)
tree10c13c0d4738a62151551928d57c706df70cc8fc /src/egl/main/eglcontext.c
parent2bbe235053ca28334eaf4ed7214e2f35b9733bd8 (diff)
egl: Add EGL_KHR_create_context_no_error support
This only adds the EGL side, needs to be plumbed into Mesa frontend. v2: Add check for extension availability. Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'src/egl/main/eglcontext.c')
-rw-r--r--src/egl/main/eglcontext.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index df8b45c7bd6..1a8e9bda1a2 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -312,6 +312,37 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
ctx->Flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
break;
+ case EGL_CONTEXT_OPENGL_NO_ERROR_KHR:
+ if (dpy->Version < 14 ||
+ !dpy->Extensions.KHR_create_context_no_error) {
+ err = EGL_BAD_ATTRIBUTE;
+ break;
+ }
+
+ /* The KHR_no_error spec only applies against OpenGL 2.0+ and
+ * OpenGL ES 2.0+
+ */
+ if ((api != EGL_OPENGL_API && api != EGL_OPENGL_ES_API) ||
+ ctx->ClientMajorVersion < 2) {
+ err = EGL_BAD_ATTRIBUTE;
+ break;
+ }
+
+ /* The EGL_KHR_create_context_no_error spec says:
+ *
+ * "BAD_MATCH is generated if the EGL_CONTEXT_OPENGL_NO_ERROR_KHR is TRUE at
+ * the same time as a debug or robustness context is specified."
+ */
+ if (ctx->Flags & EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR ||
+ ctx->Flags & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) {
+ err = EGL_BAD_MATCH;
+ break;
+ }
+
+ /* Canonicalize value to EGL_TRUE/EGL_FALSE definitions */
+ ctx->NoError = !!val;
+ break;
+
default:
err = EGL_BAD_ATTRIBUTE;
break;