panvk: check for texture-compression support
We currently just assume that textureCompressionETC2 and
textureCompressionASTC_LDR are always supported. And while that's true
for all the G52s, G610s abd G310s we've seen out in the wild, it's not
guaranteed to be true. An SoC vendor might disable support for one of
these formats.
So let's check properly, just for good measure.
Fixes: d970fe2e9d ("panfrost: Add a Vulkan driver for Midgard/Bifrost GPUs")
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34206>
This commit is contained in:
committed by
Marge Bot
parent
04962975fd
commit
e4786cf971
@@ -274,6 +274,32 @@ get_device_extensions(const struct panvk_physical_device *device,
|
||||
};
|
||||
}
|
||||
|
||||
static bool
|
||||
has_compressed_formats(const struct panvk_physical_device *physical_device,
|
||||
const uint32_t required_formats)
|
||||
{
|
||||
uint32_t supported_compr_fmts =
|
||||
panfrost_query_compressed_formats(&physical_device->kmod.props);
|
||||
|
||||
return (supported_compr_fmts & required_formats) == required_formats;
|
||||
}
|
||||
|
||||
static bool
|
||||
has_texture_compression_etc2(const struct panvk_physical_device *physical_device)
|
||||
{
|
||||
return has_compressed_formats(physical_device,
|
||||
BITFIELD_BIT(MALI_ETC2_RGB8) |
|
||||
BITFIELD_BIT(MALI_ETC2_RGB8A1) | BITFIELD_BIT(MALI_ETC2_RGBA8) |
|
||||
BITFIELD_BIT(MALI_ETC2_R11_UNORM) | BITFIELD_BIT(MALI_ETC2_R11_SNORM) |
|
||||
BITFIELD_BIT(MALI_ETC2_RG11_UNORM) | BITFIELD_BIT(MALI_ETC2_RG11_SNORM));
|
||||
}
|
||||
|
||||
static bool
|
||||
has_texture_compression_astc_ldr(const struct panvk_physical_device *physical_device)
|
||||
{
|
||||
return has_compressed_formats(physical_device, BITFIELD_BIT(MALI_ASTC_2D_LDR));
|
||||
}
|
||||
|
||||
static void
|
||||
get_features(const struct panvk_physical_device *device,
|
||||
struct vk_features *features)
|
||||
@@ -294,8 +320,8 @@ get_features(const struct panvk_physical_device *device,
|
||||
.largePoints = true,
|
||||
.occlusionQueryPrecise = true,
|
||||
.samplerAnisotropy = true,
|
||||
.textureCompressionETC2 = true,
|
||||
.textureCompressionASTC_LDR = true,
|
||||
.textureCompressionETC2 = has_texture_compression_etc2(device),
|
||||
.textureCompressionASTC_LDR = has_texture_compression_astc_ldr(device),
|
||||
.fragmentStoresAndAtomics = arch >= 10,
|
||||
.shaderImageGatherExtended = true,
|
||||
.shaderStorageImageExtendedFormats = true,
|
||||
|
||||
Reference in New Issue
Block a user