Mesa (main): zink: pass rt attrib to zink_render_pass_attachment_get_barrier_info()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 20 16:58:32 UTC 2022


Module: Mesa
Branch: main
Commit: 69efe357b32f4600b8907f3295aa85037902ac87
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=69efe357b32f4600b8907f3295aa85037902ac87

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue May 10 12:22:25 2022 -0400

zink: pass rt attrib to zink_render_pass_attachment_get_barrier_info()

no functional changes

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

---

 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 5230be4cb6b..e1ea094dbb4 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 b714010b1a3..befe57e6e45 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 65d48ad89ef..aaf09fa04c6 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);



More information about the mesa-commit mailing list