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

Author: Mike Blumenkrantz <[email protected]>
Date:   Mon Oct 10 07:58:13 2022 -0400

zink: don't force attachment usage for images when unsupported

this is illegal even with EXTENDED_USAGE, but it will also probably
explode later when trying to populate the image

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

---

 src/gallium/drivers/zink/zink_resource.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_resource.c 
b/src/gallium/drivers/zink/zink_resource.c
index 2e558c65bcc..66fe35c3350 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -421,6 +421,17 @@ get_image_usage(struct zink_screen *screen, 
VkImageCreateInfo *ici, const struct
       }
       if (double_check_ici(screen, ici, usage, mod))
          return usage;
+      if (util_format_is_depth_or_stencil(templ->format)) {
+         if (!(templ->bind & PIPE_BIND_DEPTH_STENCIL)) {
+            usage &= ~VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
+            if (double_check_ici(screen, ici, usage, mod))
+               return usage;
+         }
+      } else if (!(templ->bind & PIPE_BIND_RENDER_TARGET)) {
+         usage &= ~VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+         if (double_check_ici(screen, ici, usage, mod))
+            return usage;
+      }
    }
    *mod = DRM_FORMAT_MOD_INVALID;
    return 0;

Reply via email to