From 4f8d0e81c4fc7458adfb29298dc817acd04a559a Mon Sep 17 00:00:00 2001 From: Olivia Lee Date: Mon, 7 Jul 2025 10:23:30 -0700 Subject: [PATCH] panvk: don't report features for image formats that are only usable as vertex buffers Advertising SAMPLED_IMAGE_DEPTH_COMPARISON is a no-op for images that don't have SAMPLED_IMAGE_BIT, but it's confusing and results in us advertising a lot of formats that with only the SAMPLE_IMAGE_DEPTH_COMPARISON feature that aren't usable for anything. For R32_UINT and R32_SINT, the change is just a cleanup, because we always support these for storage images. Whe we implement VK_EXT_host_image_copy, advertising unusable formats triggers failures in dEQP-VK.api.image_clearing.*, so it's convenient to have features==0 for all unusable formats. Fixes: 70b8056df16 ("panvk: Enable KHR_format_feature_flags2 and use them") Signed-off-by: Olivia Lee Reviewed-by: Erik Faye-Lund Part-of: --- src/panfrost/vulkan/panvk_physical_device.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index b75fb8ad93a..b7e02c5e071 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -553,6 +553,9 @@ get_image_plane_format_features(struct panvk_physical_device *physical_device, features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT; features |= VK_FORMAT_FEATURE_2_BLIT_SRC_BIT; + + if (vk_format_has_depth(format)) + features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT; } if (fmt.bind & PAN_BIND_RENDER_TARGET) { @@ -569,20 +572,17 @@ get_image_plane_format_features(struct panvk_physical_device *physical_device, } } - if (fmt.bind & PAN_BIND_STORAGE_IMAGE) + if (fmt.bind & PAN_BIND_STORAGE_IMAGE) { features |= VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT | VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT; - - if (pfmt == PIPE_FORMAT_R32_UINT || pfmt == PIPE_FORMAT_R32_SINT) - features |= VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT; + if (pfmt == PIPE_FORMAT_R32_UINT || pfmt == PIPE_FORMAT_R32_SINT) + features |= VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT; + } if (fmt.bind & PAN_BIND_DEPTH_STENCIL) features |= VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT; - if (vk_format_has_depth(format)) - features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT; - return features; }