diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 9321e60c634..86bc0a55706 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1393,34 +1393,9 @@ dri2_create_context(_EGLDisplay *disp, _EGLConfig *conf, return NULL; } - if (!_eglInitContext(&dri2_ctx->base, disp, conf, attrib_list)) + if (!_eglInitContext(&dri2_ctx->base, disp, conf, share_list, attrib_list)) goto cleanup; - /* The EGL_EXT_create_context_robustness spec says: - * - * "Add to the eglCreateContext context creation errors: [...] - * - * * If the reset notification behavior of and the - * newly created context are different then an EGL_BAD_MATCH error is - * generated." - */ - if (share_list && share_list->ResetNotificationStrategy != - dri2_ctx->base.ResetNotificationStrategy) { - _eglError(EGL_BAD_MATCH, "eglCreateContext"); - goto cleanup; - } - - /* The EGL_KHR_create_context_no_error spec says: - * - * "BAD_MATCH is generated if the value of EGL_CONTEXT_OPENGL_NO_ERROR_KHR - * used to create does not match the value of - * EGL_CONTEXT_OPENGL_NO_ERROR_KHR for the context being created." - */ - if (share_list && share_list->NoError != dri2_ctx->base.NoError) { - _eglError(EGL_BAD_MATCH, "eglCreateContext"); - goto cleanup; - } - switch (dri2_ctx->base.ClientAPI) { case EGL_OPENGL_ES_API: switch (dri2_ctx->base.ClientMajorVersion) { diff --git a/src/egl/drivers/haiku/egl_haiku.cpp b/src/egl/drivers/haiku/egl_haiku.cpp index 18c73c9cd8b..92b37f582e7 100644 --- a/src/egl/drivers/haiku/egl_haiku.cpp +++ b/src/egl/drivers/haiku/egl_haiku.cpp @@ -249,7 +249,7 @@ haiku_create_context(_EGLDisplay *disp, _EGLConfig *conf, return NULL; } - if (!_eglInitContext(&context->ctx, disp, conf, attrib_list)) + if (!_eglInitContext(&context->ctx, disp, conf, share_list, attrib_list)) goto cleanup; TRACE("Context created\n"); diff --git a/src/egl/drivers/wgl/egl_wgl.c b/src/egl/drivers/wgl/egl_wgl.c index d93c58cb773..2d136d75564 100644 --- a/src/egl/drivers/wgl/egl_wgl.c +++ b/src/egl/drivers/wgl/egl_wgl.c @@ -403,34 +403,9 @@ wgl_create_context(_EGLDisplay *disp, _EGLConfig *conf, return NULL; } - if (!_eglInitContext(&wgl_ctx->base, disp, conf, attrib_list)) + if (!_eglInitContext(&wgl_ctx->base, disp, conf, share_list, attrib_list)) goto cleanup; - /* The EGL_EXT_create_context_robustness spec says: - * - * "Add to the eglCreateContext context creation errors: [...] - * - * * If the reset notification behavior of and the - * newly created context are different then an EGL_BAD_MATCH error is - * generated." - */ - if (share_list && share_list->ResetNotificationStrategy != - wgl_ctx->base.ResetNotificationStrategy) { - _eglError(EGL_BAD_MATCH, "eglCreateContext"); - goto cleanup; - } - - /* The EGL_KHR_create_context_no_error spec says: - * - * "BAD_MATCH is generated if the value of EGL_CONTEXT_OPENGL_NO_ERROR_KHR - * used to create does not match the value of - * EGL_CONTEXT_OPENGL_NO_ERROR_KHR for the context being created." - */ - if (share_list && share_list->NoError != wgl_ctx->base.NoError) { - _eglError(EGL_BAD_MATCH, "eglCreateContext"); - goto cleanup; - } - unsigned profile_mask = 0; switch (wgl_ctx->base.ClientAPI) { case EGL_OPENGL_ES_API: diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index 63b65cc174b..bd6518f19e1 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -597,7 +597,7 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *disp, */ EGLBoolean _eglInitContext(_EGLContext *ctx, _EGLDisplay *disp, _EGLConfig *conf, - const EGLint *attrib_list) + _EGLContext *share_list, const EGLint *attrib_list) { const EGLenum api = eglQueryAPI(); EGLint err; @@ -631,6 +631,31 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *disp, _EGLConfig *conf, if (err != EGL_SUCCESS) return _eglError(err, "eglCreateContext"); + /* The EGL_EXT_create_context_robustness spec says: + * + * "Add to the eglCreateContext context creation errors: [...] + * + * * If the reset notification behavior of and the + * newly created context are different then an EGL_BAD_MATCH error is + * generated." + */ + if (share_list && share_list->ResetNotificationStrategy != + ctx->ResetNotificationStrategy) { + return _eglError(EGL_BAD_MATCH, + "eglCreateContext() share list notification strategy mismatch"); + } + + /* The EGL_KHR_create_context_no_error spec says: + * + * "BAD_MATCH is generated if the value of EGL_CONTEXT_OPENGL_NO_ERROR_KHR + * used to create does not match the value of + * EGL_CONTEXT_OPENGL_NO_ERROR_KHR for the context being created." + */ + if (share_list && share_list->NoError != ctx->NoError) { + return _eglError(EGL_BAD_MATCH, + "eglCreateContext() share list no-error mismatch"); + } + return EGL_TRUE; } diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h index 8fb6eeb70fc..acfef4fe7c0 100644 --- a/src/egl/main/eglcontext.h +++ b/src/egl/main/eglcontext.h @@ -69,7 +69,7 @@ struct _egl_context extern EGLBoolean _eglInitContext(_EGLContext *ctx, _EGLDisplay *disp, - _EGLConfig *config, const EGLint *attrib_list); + _EGLConfig *config, _EGLContext *share_list, const EGLint *attrib_list); extern EGLBoolean