From ad57bb1b7d0358bf5c0a16e73362768e0aae0e8d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 2 Sep 2021 15:20:43 -0400 Subject: [PATCH] zink: force imageless fb rebind if rebinding an attachment ensure that the STORAGE usage gets picked up here Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 73c6a635016..b5130067298 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -3161,22 +3161,33 @@ zink_rebind_framebuffer(struct zink_context *ctx, struct zink_resource *res) { if (!ctx->framebuffer) return; + bool did_rebind = false; if (res->aspect & VK_IMAGE_ASPECT_COLOR_BIT) { for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) { if (!ctx->fb_state.cbufs[i] || zink_resource(ctx->fb_state.cbufs[i]->texture) != res) continue; zink_rebind_ctx_surface(ctx, &ctx->fb_state.cbufs[i]); - zink_batch_no_rp(ctx); + did_rebind = true; } } else { if (ctx->fb_state.zsbuf && zink_resource(ctx->fb_state.zsbuf->texture) != res) { zink_rebind_ctx_surface(ctx, &ctx->fb_state.zsbuf); - zink_batch_no_rp(ctx); + did_rebind = true; } } - if (rebind_fb_state(ctx, res, false)) - zink_batch_no_rp(ctx); + + did_rebind |= rebind_fb_state(ctx, res, false); + + if (!did_rebind) + return; + + zink_batch_no_rp(ctx); + if (zink_screen(ctx->base.screen)->info.have_KHR_imageless_framebuffer) { + struct zink_framebuffer *fb = ctx->get_framebuffer(ctx); + ctx->fb_changed |= ctx->framebuffer != fb; + ctx->framebuffer = fb; + } } ALWAYS_INLINE static struct zink_resource *