[Mesa-dev] [PATCH 5/5] anv/image: Support CCS_E for images which may be used for storage

Jason Ekstrand jason at jlekstrand.net
Tue Feb 20 21:52:44 UTC 2018


We have to do resolves whenever we go into the general layout for these
images.  However, it also means that images which declare the storage
usage but don't actually need it most of the time will still get
compression.
---
 src/intel/vulkan/anv_image.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index a297cc4..477d167 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -463,8 +463,7 @@ make_surface(const struct anv_device *dev,
              * a render target.  This means that it's safe to just leave
              * compression on at all times for these formats.
              */
-            if (!(vk_info->usage & VK_IMAGE_USAGE_STORAGE_BIT) &&
-                all_formats_ccs_e_compatible(&dev->info, vk_info)) {
+            if (all_formats_ccs_e_compatible(&dev->info, vk_info)) {
                image->planes[plane].aux_usage = ISL_AUX_USAGE_CCS_E;
             }
          }
@@ -799,9 +798,22 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,
       return ISL_AUX_USAGE_NONE;
 
 
+   case VK_IMAGE_LAYOUT_GENERAL:
+      if (aspect == VK_IMAGE_ASPECT_DEPTH_BIT) {
+         return ISL_AUX_USAGE_NONE;
+      } else if (image->usage & VK_IMAGE_USAGE_STORAGE_BIT) {
+         /* If we might be used as a storage image and we're in the general
+          * layout, we have to disable aux because the dataport doesn't
+          * support CCS.
+          */
+         return ISL_AUX_USAGE_NONE;
+      } else {
+         return image->planes[plane].aux_usage;
+      }
+
+
    /* Transfer Layouts
     */
-   case VK_IMAGE_LAYOUT_GENERAL:
    case VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL:
    case VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL:
       if (aspect == VK_IMAGE_ASPECT_DEPTH_BIT) {
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list