diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index c0e5f97bb38..f72a2ab18c3 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -217,6 +217,19 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *disp, break; } + /* The EGL_KHR_create_context spec says: + * "If does not support a client API context compatible + * with the requested API major and minor version, context flags, + * and context reset notification behavior (for client API types + * where these attributes are supported), then an EGL_BAD_MATCH + * error is generated." + */ + if ((val & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) && + !disp->RobustBufferAccess) { + err = EGL_BAD_MATCH; + break; + } + ctx->Flags |= val; break; @@ -263,6 +276,25 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *disp, break; } + /* The EGL 1.5 spec says: + * "An EGL_BAD_MATCH error is generated if an OpenGL or OpenGL ES + * context is requested with robust buffer access and with a + * specified reset notification behavior, and the implementation + * does not support that behavior." + * + * and the EGL_KHR_create_context spec says: + * "If does not support a client API context compatible + * with the requested API major and minor version, context flags, + * and context reset notification behavior (for client API types + * where these attributes are supported), then an EGL_BAD_MATCH + * error is generated." + */ + if (val != EGL_NO_RESET_NOTIFICATION_KHR && + !disp->Extensions.EXT_create_context_robustness) { + err = EGL_BAD_MATCH; + break; + } + ctx->ResetNotificationStrategy = val; break; @@ -310,6 +342,17 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *disp, break; } + /* The EGL 1.5 spec says: + * "An EGL_BAD_MATCH error is generated if an OpenGL or OpenGL ES + * context is requested with robust buffer access, and the + * implementation does not support the corresponding OpenGL or + * OpenGL ES extension". + */ + if (val == EGL_TRUE && !disp->RobustBufferAccess) { + err = EGL_BAD_MATCH; + break; + } + if (val == EGL_TRUE) ctx->Flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; break;