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>
This commit is contained in:
Mike Blumenkrantz
2022-10-10 07:58:13 -04:00
committed by Marge Bot
parent 8de17393f5
commit f2d3826dac
+11
View File
@@ -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;