summaryrefslogtreecommitdiffstats
path: root/src/egl/main
diff options
context:
space:
mode:
authorGrigori Goronzy <[email protected]>2017-06-29 02:44:03 +0200
committerGrigori Goronzy <[email protected]>2017-07-14 21:23:44 +0200
commit4909519a66551745969a6fdcb82beefe690549d3 (patch)
tree10c13c0d4738a62151551928d57c706df70cc8fc /src/egl/main
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 <[email protected]>
Diffstat (limited to 'src/egl/main')
-rw-r--r--src/egl/main/eglapi.c1
-rw-r--r--src/egl/main/eglcontext.c31
-rw-r--r--src/egl/main/eglcontext.h1
-rw-r--r--src/egl/main/egldisplay.h1
4 files changed, 34 insertions, 0 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 9b899d85244..000368a46a1 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -494,6 +494,7 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
_EGL_CHECK_EXTENSION(KHR_cl_event2);
_EGL_CHECK_EXTENSION(KHR_config_attribs);
_EGL_CHECK_EXTENSION(KHR_create_context);
+ _EGL_CHECK_EXTENSION(KHR_create_context_no_error);
_EGL_CHECK_EXTENSION(KHR_fence_sync);
_EGL_CHECK_EXTENSION(KHR_get_all_proc_addresses);
_EGL_CHECK_EXTENSION(KHR_gl_colorspace);
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;
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index f2fe8066265..0667622ba15 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -62,6 +62,7 @@ struct _egl_context
EGLint Flags;
EGLint Profile;
EGLint ResetNotificationStrategy;
+ EGLBoolean NoError;
/* The real render buffer when a window surface is bound */
EGLint WindowRenderBuffer;
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index a13ff5bb1b1..3d5a44578cc 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -122,6 +122,7 @@ struct _egl_extensions
EGLBoolean KHR_reusable_sync;
EGLBoolean KHR_surfaceless_context;
EGLBoolean KHR_wait_sync;
+ EGLBoolean KHR_create_context_no_error;
EGLBoolean MESA_drm_image;
EGLBoolean MESA_image_dma_buf_export;