Mesa (main): zink: track ssbo bind counts

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 24 02:14:48 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Jun 20 10:52:26 2022 -0400

zink: track ssbo bind counts

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

---

 src/gallium/drivers/zink/zink_context.c  | 2 ++
 src/gallium/drivers/zink/zink_resource.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 0c76dd79969..3a0ea82db21 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1251,6 +1251,7 @@ unbind_ssbo(struct zink_context *ctx, struct zink_resource *res, enum pipe_shade
    if (!res)
       return;
    res->ssbo_bind_mask[pstage] &= ~BITFIELD_BIT(slot);
+   res->ssbo_bind_count[pstage == PIPE_SHADER_COMPUTE]--;
    update_res_bind_count(ctx, res, pstage == PIPE_SHADER_COMPUTE, true);
    if (writable)
       res->write_bind_count[pstage == PIPE_SHADER_COMPUTE]--;
@@ -1281,6 +1282,7 @@ zink_set_shader_buffers(struct pipe_context *pctx,
          if (new_res != res) {
             unbind_ssbo(ctx, res, p_stage, i, was_writable);
             new_res->ssbo_bind_mask[p_stage] |= BITFIELD_BIT(i);
+            new_res->ssbo_bind_count[p_stage == PIPE_SHADER_COMPUTE]++;
             update_res_bind_count(ctx, new_res, p_stage == PIPE_SHADER_COMPUTE, false);
          }
          VkAccessFlags access = VK_ACCESS_SHADER_READ_BIT;
diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h
index 387c1edeb67..b8a12766cc0 100644
--- a/src/gallium/drivers/zink/zink_resource.h
+++ b/src/gallium/drivers/zink/zink_resource.h
@@ -123,6 +123,7 @@ struct zink_resource {
          struct util_range valid_buffer_range;
          uint32_t vbo_bind_mask : PIPE_MAX_ATTRIBS;
          uint8_t ubo_bind_count[2];
+         uint8_t ssbo_bind_count[2];
          uint8_t vbo_bind_count;
          uint8_t so_bind_count; //not counted in all_binds
          bool so_valid;



More information about the mesa-commit mailing list