From ee13512a624153913e2789f31ab24aa925313fdd Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 15 Mar 2024 15:17:47 -0400 Subject: [PATCH] zink: clamp swapchain renderarea instead of asserting in a sequence like: * resize A * clear * resize B * clear * resize C * clear for a swapchain resource, the geometry for a given op after the resize may desync for the op with which it was executed, but this is fine since the underlying swapchain object will have to be re-created anyway fixes #10827 cc: mesa-stable Part-of: --- src/gallium/drivers/zink/zink_context.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 3b68d6bed71..9fc9676bf86 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -2917,12 +2917,13 @@ begin_rendering(struct zink_context *ctx) if (has_swapchain) { ASSERTED struct zink_resource *res = zink_resource(ctx->fb_state.cbufs[0]->texture); zink_render_fixup_swapchain(ctx); - assert(ctx->dynamic_fb.info.renderArea.extent.width <= res->base.b.width0); - assert(ctx->dynamic_fb.info.renderArea.extent.height <= res->base.b.height0); - assert(ctx->fb_state.width <= res->base.b.width0); - assert(ctx->fb_state.height <= res->base.b.height0); if (res->use_damage) ctx->dynamic_fb.info.renderArea = res->damage; + /* clamp for late swapchain resize */ + if (res->base.b.width0 < ctx->dynamic_fb.info.renderArea.extent.width) + ctx->dynamic_fb.info.renderArea.extent.width = res->base.b.width0; + if (res->base.b.height0 < ctx->dynamic_fb.info.renderArea.extent.height) + ctx->dynamic_fb.info.renderArea.extent.height = res->base.b.height0; } if (ctx->fb_state.zsbuf && zsbuf_used) { struct zink_surface *surf = zink_csurface(ctx->fb_state.zsbuf);