From 82bd38fa1155edc0a0d813783b319c6b8d299370 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 6 Jan 2023 15:51:48 -0500 Subject: [PATCH] zink: add a bunch of asserts for starting dynamic render try to avoid any race condition bugs triggering later when they're harder to catch Part-of: --- src/gallium/drivers/zink/zink_context.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 0323ae96ea3..8d3ad1872a6 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -2508,8 +2508,14 @@ begin_rendering(struct zink_context *ctx) return 0; ctx->dynamic_fb.attachments[i].imageView = iv; } - if (has_swapchain) + if (has_swapchain) { + 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 (ctx->fb_state.zsbuf && zsbuf_used) { struct zink_surface *surf = zink_csurface(ctx->fb_state.zsbuf); VkImageView iv = zink_prep_fb_attachment(ctx, surf, ctx->fb_state.nr_cbufs); @@ -2518,6 +2524,8 @@ begin_rendering(struct zink_context *ctx) ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS+1].imageView = iv; ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS+1].imageLayout = zink_resource(surf->base.texture)->layout; } + assert(ctx->fb_state.width >= ctx->dynamic_fb.info.renderArea.extent.width); + assert(ctx->fb_state.height >= ctx->dynamic_fb.info.renderArea.extent.height); ctx->gfx_pipeline_state.dirty |= rp_changed; ctx->gfx_pipeline_state.rp_state = rp_state;