egl: Move an error check earlier in EGL_BUFFER_AGE_EXT query
I can't think of any good reason to call down to the driver and _then_ check whether your calling context was already bad. Reviewed-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18214>
This commit is contained in:
@@ -559,14 +559,14 @@ _eglQuerySurface(_EGLDisplay *disp, _EGLSurface *surface,
|
||||
return _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
|
||||
|
||||
_EGLContext *ctx = _eglGetCurrentContext();
|
||||
EGLint result = disp->Driver->QueryBufferAge(disp, surface);
|
||||
/* error happened */
|
||||
if (result < 0)
|
||||
return EGL_FALSE;
|
||||
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
|
||||
ctx->DrawSurface != surface)
|
||||
return _eglError(EGL_BAD_SURFACE, "eglQuerySurface");
|
||||
|
||||
EGLint result = disp->Driver->QueryBufferAge(disp, surface);
|
||||
if (result < 0)
|
||||
return EGL_FALSE;
|
||||
|
||||
*value = result;
|
||||
surface->BufferAgeRead = EGL_TRUE;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user