egl: Move common eglCreateContext() error checks from backends to core.
Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20171>
This commit is contained in:
@@ -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 <share_context> 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 <share_context> 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) {
|
||||
|
@@ -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");
|
||||
|
@@ -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 <share_context> 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 <share_context> 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:
|
||||
|
@@ -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 <share_context> 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 <share_context> 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;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user