turnip: disable UBWC for SNORM formats

In copy_format, we treat snorm as unorm to avoid clamping.  But snorm
and unorm are UBWC incompatible for special values such as all 0's or
all 1's.  Disable UBWC for snorm.

For reference, I dumped the first byte of an UBWC blocks and it was

  color      UNORM  SNORM
  all black  0x01   0x31
  all white  0x0d   0x11

@flto clarified that bit 4 is unset for fast clear encoded blocks.  It
looks like fast clear is not used for SNORM.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6480
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16534>
This commit is contained in:
Chia-I Wu
2022-05-16 11:07:03 -07:00
committed by Marge Bot
parent d7dc27645e
commit 2a8e6a4d1a
+7
View File
@@ -296,6 +296,13 @@ ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage,
format == VK_FORMAT_S8_UINT)
return false;
/* In copy_format, we treat snorm as unorm to avoid clamping. But snorm
* and unorm are UBWC incompatible for special values such as all 0's or
* all 1's. Disable UBWC for snorm.
*/
if (vk_format_is_snorm(format))
return false;
if (!info->a6xx.has_8bpp_ubwc &&
(format == VK_FORMAT_R8_UNORM ||
format == VK_FORMAT_R8_SNORM ||