Mesa (main): zink: track overall samplerview bind counts

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


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Jun 20 11:03:56 2022 -0400

zink: track overall samplerview 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 3a0ea82db21..d6247d50433 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1549,6 +1549,7 @@ unbind_samplerview(struct zink_context *ctx, enum pipe_shader_type stage, unsign
    if (!sv || !sv->base.texture)
       return;
    struct zink_resource *res = zink_resource(sv->base.texture);
+   res->sampler_bind_count[stage == PIPE_SHADER_COMPUTE]--;
    check_samplerview_for_batch_ref(ctx, sv);
    update_res_bind_count(ctx, res, stage == PIPE_SHADER_COMPUTE, true);
    res->sampler_binds[stage] &= ~BITFIELD_BIT(slot);
@@ -1580,6 +1581,7 @@ zink_set_sampler_views(struct pipe_context *pctx,
             if (a)
                unbind_samplerview(ctx, shader_type, start_slot + i);
             update_res_bind_count(ctx, res, shader_type == PIPE_SHADER_COMPUTE, false);
+            res->sampler_bind_count[shader_type == PIPE_SHADER_COMPUTE]++;
          } else if (a != b) {
             check_samplerview_for_batch_ref(ctx, a);
          }
diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h
index b8a12766cc0..78ad2c4d03e 100644
--- a/src/gallium/drivers/zink/zink_resource.h
+++ b/src/gallium/drivers/zink/zink_resource.h
@@ -143,6 +143,7 @@ struct zink_resource {
    };
    uint32_t sampler_binds[PIPE_SHADER_TYPES];
    uint32_t image_binds[PIPE_SHADER_TYPES];
+   uint16_t sampler_bind_count[2]; //gfx, compute
    uint16_t image_bind_count[2]; //gfx, compute
    uint16_t write_bind_count[2]; //gfx, compute
    uint16_t bindless[2]; //tex, img



More information about the mesa-commit mailing list