Mesa (main): zink: only queue deferred descriptor layout change on first bind or change

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 24 23:23:49 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Apr 16 10:27:54 2021 -0400

zink: only queue deferred descriptor layout change on first bind or change

otherwise, the layout is either already correct or already queued

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

---

 src/gallium/drivers/zink/zink_context.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 9640963e849..7f55e289d39 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1246,7 +1246,9 @@ zink_set_shader_images(struct pipe_context *pctx,
             if (res->image_bind_count[p_stage == PIPE_SHADER_COMPUTE] == 1 &&
                 res->bind_count[p_stage == PIPE_SHADER_COMPUTE] > 1)
                update_binds_for_samplerviews(ctx, res, p_stage == PIPE_SHADER_COMPUTE);
-            _mesa_set_add(ctx->need_barriers[p_stage == PIPE_SHADER_COMPUTE], res);
+            if (res->bind_count[p_stage == PIPE_SHADER_COMPUTE] == 1 ||
+                res->layout != get_layout_for_binding(res, ZINK_DESCRIPTOR_TYPE_IMAGE, p_stage == PIPE_SHADER_COMPUTE))
+               _mesa_set_add(ctx->need_barriers[p_stage == PIPE_SHADER_COMPUTE], res);
          }
          if (!ctx->descriptor_refs_dirty[p_stage == PIPE_SHADER_COMPUTE]) {
             zink_batch_reference_resource_rw(&ctx->batch, zink_resource(image_view->base.resource),
@@ -1331,7 +1333,9 @@ zink_set_sampler_views(struct pipe_context *pctx,
                 update = true;
 
              res->sampler_binds[shader_type] |= BITFIELD_BIT(start_slot + i);
-             _mesa_set_add(ctx->need_barriers[shader_type == PIPE_SHADER_COMPUTE], res);
+            if (res->bind_count[shader_type == PIPE_SHADER_COMPUTE] == 1 ||
+                res->layout != get_layout_for_binding(res, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, shader_type == PIPE_SHADER_COMPUTE))
+                _mesa_set_add(ctx->need_barriers[shader_type == PIPE_SHADER_COMPUTE], res);
              if (!a)
                 update = true;
          }



More information about the mesa-commit mailing list