From 968163524a75236f0bf1f956cd574e6a16b40fb5 Mon Sep 17 00:00:00 2001 From: Zan Dobersek Date: Wed, 3 Jul 2024 11:20:27 +0200 Subject: [PATCH] tu: add format feature flag checks for VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT In tu_get_image_format_properties(), image usage flags are matched against sets of required format feature flags for the specified image format. These mappings are defined in the Vulkan 1.3 spec in section 49.3.3., "Format Feature Dependent Usage Flags". Handling for the VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT flag was missing. When specified, at least one of color attachment or depth-stencil attachment format feature flags should be present for the given format. Fixes 110 new Vulkan CTS tests: - dEQP-VK.api.info.unsupported_image_usage.linear.* - dEQP-VK.api.info.unsupported_image_usage.optimal.* Signed-off-by: Zan Dobersek Part-of: --- src/freedreno/vulkan/tu_formats.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/freedreno/vulkan/tu_formats.cc b/src/freedreno/vulkan/tu_formats.cc index 42c135f6eef..d6fa78da604 100644 --- a/src/freedreno/vulkan/tu_formats.cc +++ b/src/freedreno/vulkan/tu_formats.cc @@ -634,6 +634,14 @@ tu_get_image_format_properties( } } + if (image_usage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) { + if (!(format_feature_flags & + (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | + VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))) { + return tu_image_unsupported_format(pImageFormatProperties); + } + } + *pImageFormatProperties = (VkImageFormatProperties) { .maxExtent = maxExtent, .maxMipLevels = maxMipLevels,