From cbde0ec2dc20537790e4628df72ea09fc37858fb Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 26 Mar 2025 08:50:37 +0100 Subject: [PATCH] panvk: expose textureCompressionBC when supported We can't guarantee that we always support this feature, because support for each format can be disabled per SoC. But we can check for this, and expose it when it's supported. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12598 Reviewed-by: Boris Brezillon Reviewed-by: Eric R. Smith Part-of: --- docs/relnotes/new_features.txt | 1 + src/panfrost/vulkan/panvk_physical_device.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index c44659e898f..835092e5217 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -27,3 +27,4 @@ KHR_blend_equation_advanced_coherent on v3d KHR_partial_update on etnaviv VK_KHR_line_rasterization on panvk shaderImageGatherExtended on panvk +textureCompressionBC on panvk diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index b2fd3b177fb..f905c32d91a 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -300,6 +300,17 @@ has_texture_compression_astc_ldr(const struct panvk_physical_device *physical_de return has_compressed_formats(physical_device, BITFIELD_BIT(MALI_ASTC_2D_LDR)); } +static bool +has_texture_compression_bc(const struct panvk_physical_device *physical_device) +{ + return has_compressed_formats(physical_device, + BITFIELD_BIT(MALI_BC1_UNORM) | BITFIELD_BIT(MALI_BC2_UNORM) | + BITFIELD_BIT(MALI_BC3_UNORM) | BITFIELD_BIT(MALI_BC4_UNORM) | + BITFIELD_BIT(MALI_BC4_SNORM) | BITFIELD_BIT(MALI_BC5_UNORM) | + BITFIELD_BIT(MALI_BC5_SNORM) | BITFIELD_BIT(MALI_BC6H_SF16) | + BITFIELD_BIT(MALI_BC6H_UF16) | BITFIELD_BIT(MALI_BC7_UNORM)); +} + static void get_features(const struct panvk_physical_device *device, struct vk_features *features) @@ -322,6 +333,7 @@ get_features(const struct panvk_physical_device *device, .samplerAnisotropy = true, .textureCompressionETC2 = has_texture_compression_etc2(device), .textureCompressionASTC_LDR = has_texture_compression_astc_ldr(device), + .textureCompressionBC = has_texture_compression_bc(device), .fragmentStoresAndAtomics = arch >= 10, .shaderImageGatherExtended = true, .shaderStorageImageExtendedFormats = true,