zink only use zs-specific layout for zs attachments
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 8 Apr 2022 19:49:08 +0000 (15:49 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 11 Apr 2022 00:05:02 +0000 (00:05 +0000)
otherwise this is illegal

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

src/gallium/drivers/zink/zink_descriptors.c

index cd555ae6099844d4f00a965d51e78a7bc8bcd7d0..2292e096d6eaed99f5a9d4b0e4276adb9ef51106 100644 (file)
@@ -574,7 +574,8 @@ zink_descriptor_util_image_layout_eval(const struct zink_context *ctx, const str
       if (!is_compute && res->fb_binds &&
           ctx->gfx_pipeline_state.render_pass && ctx->gfx_pipeline_state.render_pass->state.rts[ctx->fb_state.nr_cbufs].mixed_zs)
          return VK_IMAGE_LAYOUT_GENERAL;
-      return VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
+      if (res->obj->vkusage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)
+         return VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
    }
    return VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
 }