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

Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Feb 24 11:03:57 2023 -0500

zink: fix shader read access removal for barrier generation

barrier access is based on total binds per gfx/compute, not per stage

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21522>

---

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

diff --git a/src/gallium/drivers/zink/zink_context.c 
b/src/gallium/drivers/zink/zink_context.c
index 767abaeb0b1..9d097e49ade 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1506,8 +1506,9 @@ zink_set_constant_buffer(struct pipe_context *pctx,
 ALWAYS_INLINE static void
 unbind_descriptor_reads(struct zink_resource *res, gl_shader_stage pstage)
 {
-   if (!res->sampler_binds[pstage] && !res->image_binds[pstage])
-      res->barrier_access[pstage == MESA_SHADER_COMPUTE] &= 
~VK_ACCESS_SHADER_READ_BIT;
+   bool is_compute = pstage == MESA_SHADER_COMPUTE;
+   if (!res->sampler_bind_count[is_compute] && 
!res->image_bind_count[is_compute])
+      res->barrier_access[is_compute] &= ~VK_ACCESS_SHADER_READ_BIT;
 }
 
 ALWAYS_INLINE static void

Reply via email to