From bab17a52b78e9d7b125c89ff6d12baebcf1cd67a Mon Sep 17 00:00:00 2001 From: Bill Hollings Date: Sun, 31 Oct 2021 19:00:25 -0400 Subject: [PATCH] Remove advertised support for BC1_RGB texel formats. Metal does not provide direct support for BC1_RGB formats (VK_FORMAT_BC1_RGB_UNORM_BLOCK & VK_FORMAT_BC1_RGB_SRGB_BLOCK). We have been faking it by mapping these Vulkan formats to Metal formats containing alpha (MTLPixelFormatBC7_RGBAUnorm & MTLPixelFormatBC7_RGBAUnorm_sRGB, respectively), and advertising support for BC1_RGB formats. However, this triggers CTS failures, because the BC1_RGBA formats can return an alpha value of 0.0 when constructed that way, whereas the BC1_RGB formats always expect 1.0 (opaque) to be returned. This change moves to indirect support for BC1_RGB formats. They will still be covered by MTLPixelFormatBC7_RGBAUnorm & MTLPixelFormatBC7_RGBAUnorm_sRGB, and will effectively work (except transparency), but are no longer advertised through physical device format and image format queries. --- Docs/Whats_New.md | 2 ++ MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Docs/Whats_New.md b/Docs/Whats_New.md index 992da4ca..4460dfa4 100644 --- a/Docs/Whats_New.md +++ b/Docs/Whats_New.md @@ -24,6 +24,8 @@ Released TBD is not supported on platform, but app doesn't actually attempt to render to multiple layers. - Fix dynamic pipeline state such as `vkCmdSetDepthBias()` sometimes ignoring pipeline dyamic state flags when called before `vkCmdBindPipeline()`. +- Remove advertising support for pixel formats `VK_FORMAT_BC1_RGB_UNORM_BLOCK` and `VK_FORMAT_BC1_RGB_SRGB_BLOCK`, + as these can cause rare compatibility problems with transparency encoding. - Update to latest SPIRV-Cross version: - MSL: Add support for `OpSpecConstantOp` ops `OpQuantizeToF16` and `OpSRem`. - MSL: Return fragment function value even when last SPIR-V Op is discard (`OpKill`). diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm index 3192c8ca..6c7106a4 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm +++ b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm @@ -935,8 +935,8 @@ void MVKPixelFormats::initVkFormatCapabilities() { addVkFormatDesc( X8_D24_UNORM_PACK32, Invalid, Depth24Unorm_Stencil8, Invalid, Invalid, 1, 1, 4, DepthStencil ); - addVkFormatDesc( BC1_RGB_UNORM_BLOCK, BC1_RGBA, Invalid, Invalid, Invalid, 4, 4, 8, Compressed ); - addVkFormatDesc( BC1_RGB_SRGB_BLOCK, BC1_RGBA_sRGB, Invalid, Invalid, Invalid, 4, 4, 8, Compressed ); + addVkFormatDesc( BC1_RGB_UNORM_BLOCK, Invalid, BC1_RGBA, Invalid, Invalid, 4, 4, 8, Compressed ); + addVkFormatDesc( BC1_RGB_SRGB_BLOCK, Invalid, BC1_RGBA_sRGB, Invalid, Invalid, 4, 4, 8, Compressed ); addVkFormatDesc( BC1_RGBA_UNORM_BLOCK, BC1_RGBA, Invalid, Invalid, Invalid, 4, 4, 8, Compressed ); addVkFormatDesc( BC1_RGBA_SRGB_BLOCK, BC1_RGBA_sRGB, Invalid, Invalid, Invalid, 4, 4, 8, Compressed );