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

Author: Mike Blumenkrantz <[email protected]>
Date:   Tue Mar 21 10:43:37 2023 -0400

zink: minor tweaks for image barriers

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

---

 src/gallium/drivers/zink/zink_synchronization.cpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_synchronization.cpp 
b/src/gallium/drivers/zink/zink_synchronization.cpp
index 001c7823165..8a11a3951f8 100644
--- a/src/gallium/drivers/zink/zink_synchronization.cpp
+++ b/src/gallium/drivers/zink/zink_synchronization.cpp
@@ -319,10 +319,13 @@ zink_resource_image_barrier(struct zink_context *ctx, 
struct zink_resource *res,
    VkImageMemoryBarrier imb;
    if (!pipeline)
       pipeline = pipeline_dst_stage(new_layout);
+   if (!flags)
+      flags = access_dst_flags(new_layout);
 
-   if (!zink_resource_image_barrier_init(&imb, res, new_layout, flags, 
pipeline))
+   if (!res->obj->needs_zs_evaluate && !zink_resource_image_needs_barrier(res, 
new_layout, flags, pipeline))
       return;
-   bool is_write = 
zink_resource_access_is_write((VkAccessFlags)imb.dstAccessMask);
+   zink_resource_image_barrier_init(&imb, res, new_layout, flags, pipeline);
+   bool is_write = zink_resource_access_is_write(flags);
    VkCommandBuffer cmdbuf = is_write ? zink_get_cmdbuf(ctx, NULL, res) : 
zink_get_cmdbuf(ctx, res, NULL);
    assert(new_layout);
    enum zink_resource_access rw = is_write ? ZINK_RESOURCE_ACCESS_RW : 
ZINK_RESOURCE_ACCESS_WRITE;
@@ -366,10 +369,13 @@ zink_resource_image_barrier2(struct zink_context *ctx, 
struct zink_resource *res
    VkImageMemoryBarrier2 imb;
    if (!pipeline)
       pipeline = pipeline_dst_stage(new_layout);
+   if (!flags)
+      flags = access_dst_flags(new_layout);
 
-   if (!zink_resource_image_barrier2_init(&imb, res, new_layout, flags, 
pipeline))
+   if (!res->obj->needs_zs_evaluate && !zink_resource_image_needs_barrier(res, 
new_layout, flags, pipeline))
       return;
-   bool is_write = 
zink_resource_access_is_write((VkAccessFlags)imb.dstAccessMask);
+   zink_resource_image_barrier2_init(&imb, res, new_layout, flags, pipeline);
+   bool is_write = zink_resource_access_is_write(flags);
    VkCommandBuffer cmdbuf = is_write ? zink_get_cmdbuf(ctx, NULL, res) : 
zink_get_cmdbuf(ctx, res, NULL);
    assert(new_layout);
    enum zink_resource_access rw = is_write ? ZINK_RESOURCE_ACCESS_RW : 
ZINK_RESOURCE_ACCESS_WRITE;

Reply via email to