egl: Add more errors cases during context creation

In 9cc3e842bb an explicit check whether drivers support
PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR was added to
EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT. Add respective checks in similar
places as well.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30728>
This commit is contained in:
Robert Mader
2024-08-17 04:25:36 +02:00
committed by Marge Bot
parent af425a63f7
commit ec0c103b32

View File

@@ -217,6 +217,19 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *disp,
break;
}
/* The EGL_KHR_create_context spec says:
* "If <config> 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 <config> 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;