Mesa (main): zink: track vertex buffer bind counts on resources

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 20 01:10:29 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Jun 17 10:55:10 2022 -0400

zink: track vertex buffer bind counts on resources

Acked-by: Dave Airlie <airlied at redhat.com>
Reviewed-By: Tatsuyuki Ishi <ishitatsuyuki at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17111>

---

 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 136375c21ff..e13a5ef194f 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1018,6 +1018,7 @@ update_existing_vbo(struct zink_context *ctx, unsigned slot)
    if (!ctx->vertex_buffers[slot].buffer.resource)
       return;
    struct zink_resource *res = zink_resource(ctx->vertex_buffers[slot].buffer.resource);
+   res->vbo_bind_count--;
    res->vbo_bind_mask &= ~BITFIELD_BIT(slot);
    update_res_bind_count(ctx, res, false, true);
 }
@@ -1054,6 +1055,7 @@ zink_set_vertex_buffers(struct pipe_context *pctx,
          if (vb->buffer.resource) {
             struct zink_resource *res = zink_resource(vb->buffer.resource);
             res->vbo_bind_mask |= BITFIELD_BIT(start_slot + i);
+            res->vbo_bind_count++;
             update_res_bind_count(ctx, res, false, false);
             ctx_vb->stride = vb->stride;
             ctx_vb->buffer_offset = vb->buffer_offset;
diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h
index d27ca955786..8ece0080747 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 vbo_bind_count;
          uint8_t so_bind_count; //not counted in all_binds
          bool so_valid;
          uint32_t ubo_bind_mask[PIPE_SHADER_TYPES];



More information about the mesa-commit mailing list