zink: Return early if the source could not have been acquired

Make the success case the main one.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28025>
This commit is contained in:
Corentin Noël
2024-03-11 09:31:12 +01:00
committed by Marge Bot
parent 2c22e78619
commit 27bde4b420
+7 -6
View File
@@ -330,15 +330,16 @@ zink_create_surface(struct pipe_context *pctx,
if (res->obj->dt) {
/* don't cache swapchain surfaces. that's weird. */
struct zink_surface *surface = do_create_surface(pctx, pres, templ, &ivci, 0, false);
if (surface) {
surface->is_swapchain = true;
psurf = &surface->base;
}
if (unlikely(!surface))
return NULL;
surface->is_swapchain = true;
psurf = &surface->base;
} else if (!needs_mutable) {
psurf = zink_get_surface(zink_context(pctx), pres, templ, &ivci);
if (unlikely(!psurf))
return NULL;
}
if (!psurf && !needs_mutable)
return NULL;
struct zink_ctx_surface *csurf = wrap_surface(pctx, needs_mutable ? NULL : psurf, needs_mutable ? templ : psurf);
csurf->needs_mutable = needs_mutable;