From ff1fb9101fd1ca383c3e2a88f61911c0c2eecd62 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 27 Jul 2022 16:04:54 -0400 Subject: [PATCH] zink: force a new framebuffer for clear_depth_stencil if the clear region is big can't clear outside the framebuffer, so set a new one if necessary Fixes: f1f08e3529d ("zink: massively simplify zink_clear_depth_stencil") Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_clear.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/drivers/zink/zink_clear.c b/src/gallium/drivers/zink/zink_clear.c index ca46a7f8f67..bfe812f2cd4 100644 --- a/src/gallium/drivers/zink/zink_clear.c +++ b/src/gallium/drivers/zink/zink_clear.c @@ -553,6 +553,10 @@ zink_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *dst, ctx->render_condition_active = false; } bool cur_attachment = zink_csurface(ctx->fb_state.zsbuf) == zink_csurface(dst); + if (dstx > ctx->fb_state.width || dsty > ctx->fb_state.height || + dstx + width > ctx->fb_state.width || + dsty + height > ctx->fb_state.height) + cur_attachment = false; if (!cur_attachment) { util_blitter_save_framebuffer(ctx->blitter, &ctx->fb_state); set_clear_fb(pctx, NULL, dst);