zink: pass rt attrib to zink_render_pass_attachment_get_barrier_info()
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 10 May 2022 16:22:25 +0000 (12:22 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 20 May 2022 16:42:21 +0000 (16:42 +0000)
no functional changes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16476>

src/gallium/drivers/zink/zink_context.c
src/gallium/drivers/zink/zink_render_pass.c
src/gallium/drivers/zink/zink_render_pass.h

index 5230be4..e1ea094 100644 (file)
@@ -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];
index b714010..befe57e 100644 (file)
@@ -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;
index 65d48ad..aaf09fa 100644 (file)
@@ -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);