Mesa (main): zink: use bind counts to more accurately determine image descriptor's exact layout

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


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

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

zink: use bind counts to more accurately determine image descriptor's exact layout

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, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 1c26e599940..db7ef943e39 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -360,13 +360,13 @@ zink_create_sampler_state(struct pipe_context *pctx,
 }
 
 ALWAYS_INLINE static VkImageLayout
-get_layout_for_binding(struct zink_resource *res, enum zink_descriptor_type type)
+get_layout_for_binding(struct zink_resource *res, enum zink_descriptor_type type, bool is_compute)
 {
    if (res->obj->is_buffer)
       return 0;
    switch (type) {
    case ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW:
-      return res->bind_history & BITFIELD64_BIT(ZINK_DESCRIPTOR_TYPE_IMAGE) ?
+      return res->image_bind_count[is_compute] ?
              VK_IMAGE_LAYOUT_GENERAL :
              res->aspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT) ?
                 //Vulkan-Docs#1490
@@ -469,7 +469,7 @@ update_descriptor_state(struct zink_context *ctx, enum pipe_shader_type shader,
             ctx->di.sampler_surfaces[shader][slot].is_buffer = true;
          } else {
             struct zink_surface *surface = get_imageview_for_binding(ctx, shader, type, slot);
-            ctx->di.textures[shader][slot].imageLayout = get_layout_for_binding(res, type);
+            ctx->di.textures[shader][slot].imageLayout = get_layout_for_binding(res, type, shader == PIPE_SHADER_COMPUTE);
             ctx->di.textures[shader][slot].imageView = surface->image_view;
             ctx->di.sampler_surfaces[shader][slot].surface = surface;
             ctx->di.sampler_surfaces[shader][slot].is_buffer = false;
@@ -496,7 +496,7 @@ update_descriptor_state(struct zink_context *ctx, enum pipe_shader_type shader,
             ctx->di.image_surfaces[shader][slot].is_buffer = true;
          } else {
             struct zink_surface *surface = get_imageview_for_binding(ctx, shader, type, slot);
-            ctx->di.images[shader][slot].imageLayout = get_layout_for_binding(res, type);
+            ctx->di.images[shader][slot].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
             ctx->di.images[shader][slot].imageView = surface->image_view;
             ctx->di.image_surfaces[shader][slot].surface = surface;
             ctx->di.image_surfaces[shader][slot].is_buffer = false;



More information about the mesa-commit mailing list