summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2022-06-17 10:55:10 -0400
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2022-06-19 21:13:05 -0400
commit538e62d6747930064c43ace3d50d27a080dfdaa6 (patch)
tree014e4886c2dc33f37a9947010868170c42570657
parent5267efa259061539375725db313d9448d7cb5fd8 (diff)
zink: track vertex buffer bind counts on resources
Acked-by: Dave Airlie <airlied@redhat.com> Reviewed-By: Tatsuyuki Ishi <ishitatsuyuki@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17111>
-rw-r--r--src/gallium/drivers/zink/zink_context.c2
-rw-r--r--src/gallium/drivers/zink/zink_resource.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 3562f5f45d5..252654243db 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1011,6 +1011,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);
}
@@ -1047,6 +1048,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 60a76589a4a..228edbf5a8d 100644
--- a/src/gallium/drivers/zink/zink_resource.h
+++ b/src/gallium/drivers/zink/zink_resource.h
@@ -119,6 +119,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];