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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28214>
This commit is contained in:
Mike Blumenkrantz 2024-03-15 15:17:47 -04:00 committed by Marge Bot
parent 27f42a38aa
commit ee13512a62

View file

@ -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);