Mesa (staging/22.1): zink: collect gfx stages for all bindings during barrier generation

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


Module: Mesa
Branch: staging/22.1
Commit: 33b01ebfab88c1975cf138299ae76baf032d7eac
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=33b01ebfab88c1975cf138299ae76baf032d7eac

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Sat Jun 18 09:47:13 2022 -0400

zink: collect gfx stages for all bindings during barrier generation

it's important to get the full mask in order to accurately provide
dependency info

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_draw.cpp | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp
index 5476ea78ad7..9a61b93f51c 100644
--- a/src/gallium/drivers/zink/zink_draw.cpp
+++ b/src/gallium/drivers/zink/zink_draw.cpp
@@ -367,16 +367,14 @@ update_barriers(struct zink_context *ctx, bool is_compute,
             if (!is_compute && res->vbo_bind_mask) {
                access |= VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT;
                pipeline |= VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
-               if (res->write_bind_count[is_compute])
-                  pipeline |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT;
                bind_count -= res->vbo_bind_count;
             }
             if (bind_count)
                access |= VK_ACCESS_SHADER_READ_BIT;
-            if (!res->write_bind_count[is_compute]) {
+            if (!is_compute) {
                pipeline |= find_pipeline_bits(res->ssbo_bind_mask);
 
-               if (res->ubo_bind_count[0])
+               if (res->ubo_bind_count[0] && (pipeline & GFX_SHADER_BITS) != GFX_SHADER_BITS)
                   pipeline |= find_pipeline_bits(res->ubo_bind_mask);
             }
          } else {
@@ -391,10 +389,10 @@ update_barriers(struct zink_context *ctx, bool is_compute,
             VkPipelineStageFlags gfx_stages = pipeline & ~(VK_PIPELINE_STAGE_VERTEX_INPUT_BIT | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT);
             /* images always need gfx stages, and buffers need gfx stages if non-vbo binds exist */
             bool needs_stages = !is_buffer || (res->bind_count[0] - res->vbo_bind_count > 0);
-            if (!gfx_stages && needs_stages) {
-               gfx_stages = find_pipeline_bits(res->sampler_binds);
-               if (!gfx_stages) //must be a shader image
-                  gfx_stages = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
+            if (gfx_stages != GFX_SHADER_BITS && needs_stages) {
+               gfx_stages |= find_pipeline_bits(res->sampler_binds);
+               if (gfx_stages != GFX_SHADER_BITS) //must be a shader image
+                  gfx_stages |= find_pipeline_bits(res->image_binds);
                pipeline |= gfx_stages;
             }
          }



More information about the mesa-commit mailing list