radv: add RADV_FMASK_COMPRESSION_PARTIAL
authorChia-I Wu <olvaffe@gmail.com>
Tue, 7 Mar 2023 22:07:35 +0000 (14:07 -0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 6 Apr 2023 05:27:01 +0000 (05:27 +0000)
RADV_FMASK_COMPRESSION_PARTIAL means the fmask is decompressed but not
expanded.  It is desired for sampling when the cmask is not
TC-compatible.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21615>

src/amd/vulkan/radv_image.c
src/amd/vulkan/radv_private.h

index 4de96af..7a6bcbe 100644 (file)
@@ -2465,6 +2465,12 @@ radv_layout_fmask_compression(const struct radv_device *device, const struct rad
    if (layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL && (queue_mask & (1u << RADV_QUEUE_COMPUTE)))
       return RADV_FMASK_COMPRESSION_NONE;
 
+   if (layout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL ||
+       layout == VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) {
+      return radv_image_is_tc_compat_cmask(image) ? RADV_FMASK_COMPRESSION_FULL :
+         RADV_FMASK_COMPRESSION_PARTIAL;
+   }
+
    /* Only compress concurrent images if TC-compat CMASK is enabled (no FMASK decompression). */
    return (queue_mask == (1u << RADV_QUEUE_GENERAL) || radv_image_is_tc_compat_cmask(image)) ?
       RADV_FMASK_COMPRESSION_FULL : RADV_FMASK_COMPRESSION_NONE;
index cc1fb63..d3d68a6 100644 (file)
@@ -2549,6 +2549,7 @@ bool radv_layout_dcc_compressed(const struct radv_device *device, const struct r
 
 enum radv_fmask_compression {
    RADV_FMASK_COMPRESSION_NONE,
+   RADV_FMASK_COMPRESSION_PARTIAL,
    RADV_FMASK_COMPRESSION_FULL,
 };