From f2d3826dac55975db70101afd94b02ff13d2c0a9 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 10 Oct 2022 07:58:13 -0400 Subject: [PATCH] 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: --- 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 2e558c6..66fe35c 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; -- 2.7.4