---
 src/amd/vulkan/radv_device.c |  4 ++++
 src/amd/vulkan/radv_image.c  | 24 +++++++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index c112453e395..e6d595dfbe5 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -170,6 +170,10 @@ static const VkExtensionProperties 
common_device_extensions[] = {
                .extensionName = VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME,
                .specVersion = 1,
        },
+       {
+               .extensionName = VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME,
+               .specVersion = 1,
+       },
 };
 static const VkExtensionProperties ext_sema_device_extensions[] = {
        {
diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 9c04d7ecca5..f566b8975a6 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -116,14 +116,32 @@ radv_init_surface(struct radv_device *device,
 
        surface->flags |= RADEON_SURF_OPTIMIZE_FOR_SPACE;
 
+       bool dcc_compatible_formats 
=!radv_is_colorbuffer_format_supported(pCreateInfo->format, &blendable);
+       if (pCreateInfo->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) {
+               const struct  VkImageFormatListCreateInfoKHR *format_list =
+                         (const struct  VkImageFormatListCreateInfoKHR *)
+                               vk_find_struct_const(pCreateInfo->pNext,
+                                                    
IMAGE_FORMAT_LIST_CREATE_INFO_KHR);
+               if (format_list) {
+                       /* compatibility is transitive, so we only need to check
+                        * one format with everything else. */
+                       for (unsigned i = 0; i < format_list->viewFormatCount; 
++i) {
+                               if 
(!radv_dcc_formats_compatible(pCreateInfo->format,
+                                                                
format_list->pViewFormats[i]))
+                                       dcc_compatible_formats = false;
+                       }
+               } else {
+                       dcc_compatible_formats = false;
+               }
+       }
+
        if ((pCreateInfo->usage & (VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
                                   VK_IMAGE_USAGE_STORAGE_BIT)) ||
-           (pCreateInfo->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) ||
+           !dcc_compatible_formats ||
             (pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR) ||
             pCreateInfo->mipLevels > 1 || pCreateInfo->arrayLayers > 1 ||
             device->physical_device->rad_info.chip_class < VI ||
-            create_info->scanout || (device->debug_flags & RADV_DEBUG_NO_DCC) 
||
-            !radv_is_colorbuffer_format_supported(pCreateInfo->format, 
&blendable))
+            create_info->scanout || (device->debug_flags & RADV_DEBUG_NO_DCC))
                surface->flags |= RADEON_SURF_DISABLE_DCC;
        if (create_info->scanout)
                surface->flags |= RADEON_SURF_SCANOUT;
-- 
2.14.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to