max_zplanes = max_zplanes + 1;
} else {
- if (iview->image->info.samples <= 1)
- max_zplanes = 5;
- else if (iview->image->info.samples <= 4)
- max_zplanes = 3;
- else
- max_zplanes = 2;
+ if (iview->vk_format == VK_FORMAT_D16_UNORM) {
+ /* Do not enable Z plane compression for 16-bit depth
+ * surfaces because isn't supported on GFX8. Only
+ * 32-bit depth surfaces are supported by the hardware.
+ * This allows to maintain shader compatibility and to
+ * reduce the number of depth decompressions.
+ */
+ max_zplanes = 1;
+ } else {
+ if (iview->image->info.samples <= 1)
+ max_zplanes = 5;
+ else if (iview->image->info.samples <= 4)
+ max_zplanes = 3;
+ else
+ max_zplanes = 2;
+ }
}
return max_zplanes;
pCreateInfo->format == VK_FORMAT_D32_SFLOAT_S8_UINT)
return false;
- if (device->physical_device->rad_info.chip_class >= GFX9) {
- /* GFX9 supports both 32-bit and 16-bit depth surfaces. */
- if (pCreateInfo->format != VK_FORMAT_D32_SFLOAT_S8_UINT &&
- pCreateInfo->format != VK_FORMAT_D32_SFLOAT &&
- pCreateInfo->format != VK_FORMAT_D16_UNORM)
- return false;
- } else {
- /* GFX8 only supports 32-bit depth surfaces. */
- if (pCreateInfo->format != VK_FORMAT_D32_SFLOAT_S8_UINT &&
- pCreateInfo->format != VK_FORMAT_D32_SFLOAT)
- return false;
- }
+ /* GFX9 supports both 32-bit and 16-bit depth surfaces, while GFX8 only
+ * supports 32-bit. Though, it's possible to enable TC-compat for
+ * 16-bit depth surfaces if no Z planes are compressed.
+ */
+ if (pCreateInfo->format != VK_FORMAT_D32_SFLOAT_S8_UINT &&
+ pCreateInfo->format != VK_FORMAT_D32_SFLOAT &&
+ pCreateInfo->format != VK_FORMAT_D16_UNORM)
+ return false;
return true;
}