From 69efe357b32f4600b8907f3295aa85037902ac87 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 10 May 2022 12:22:25 -0400 Subject: [PATCH] zink: pass rt attrib to zink_render_pass_attachment_get_barrier_info() no functional changes Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 4 ++-- src/gallium/drivers/zink/zink_render_pass.c | 7 ++----- src/gallium/drivers/zink/zink_render_pass.h | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 5230be4..e1ea094 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -2032,8 +2032,8 @@ zink_prep_fb_attachment(struct zink_context *ctx, struct zink_surface *surf, uns if (!i) zink_update_fbfetch(ctx); } - VkImageLayout layout = zink_render_pass_attachment_get_barrier_info(ctx->gfx_pipeline_state.render_pass, - i, &pipeline, &access); + VkImageLayout layout = zink_render_pass_attachment_get_barrier_info(&ctx->gfx_pipeline_state.render_pass->state.rts[i], + i < ctx->fb_state.nr_cbufs, &pipeline, &access); zink_resource_image_barrier(ctx, res, layout, access, pipeline); if (i == ctx->fb_state.nr_cbufs && res->bind_count[0] && res->bind_count[0] != res->image_bind_count[0]) { unsigned find = res->bind_count[0] - res->image_bind_count[0]; diff --git a/src/gallium/drivers/zink/zink_render_pass.c b/src/gallium/drivers/zink/zink_render_pass.c index b714010..befe57e 100644 --- a/src/gallium/drivers/zink/zink_render_pass.c +++ b/src/gallium/drivers/zink/zink_render_pass.c @@ -242,13 +242,11 @@ zink_destroy_render_pass(struct zink_screen *screen, } VkImageLayout -zink_render_pass_attachment_get_barrier_info(const struct zink_render_pass *rp, unsigned idx, +zink_render_pass_attachment_get_barrier_info(const struct zink_rt_attrib *rt, bool color, VkPipelineStageFlags *pipeline, VkAccessFlags *access) { *access = 0; - assert(idx < rp->state.num_rts); - const struct zink_rt_attrib *rt = &rp->state.rts[idx]; - if (idx < rp->state.num_cbufs) { + if (color) { *pipeline = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; *access |= VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; if (!rt->clear_color && !rt->swapchain) @@ -256,7 +254,6 @@ zink_render_pass_attachment_get_barrier_info(const struct zink_render_pass *rp, return rt->fbfetch ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; } - assert(rp->state.have_zsbuf); *pipeline = VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT; if (rt->mixed_zs) { *access |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; diff --git a/src/gallium/drivers/zink/zink_render_pass.h b/src/gallium/drivers/zink/zink_render_pass.h index 65d48ad..aaf09fa 100644 --- a/src/gallium/drivers/zink/zink_render_pass.h +++ b/src/gallium/drivers/zink/zink_render_pass.h @@ -95,7 +95,7 @@ void zink_end_render_pass(struct zink_context *ctx); VkImageLayout -zink_render_pass_attachment_get_barrier_info(const struct zink_render_pass *rp, unsigned idx, VkPipelineStageFlags *pipeline, VkAccessFlags *access); +zink_render_pass_attachment_get_barrier_info(const struct zink_rt_attrib *rt, bool color, VkPipelineStageFlags *pipeline, VkAccessFlags *access); bool zink_init_render_pass(struct zink_context *ctx); -- 2.7.4