radv: Add logic for subsampled format descriptions.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 15 Jul 2018 18:09:28 +0000 (20:09 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 25 Apr 2019 19:56:20 +0000 (19:56 +0000)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_formats.c
src/amd/vulkan/radv_image.c
src/amd/vulkan/vk_format.h

index 0a3ff9ebbd928e052641a4ce4888f8ac935a00d9..773600b7f5dec56e5e10c0687809a8469d132e50 100644 (file)
@@ -180,6 +180,18 @@ uint32_t radv_translate_tex_dataformat(VkFormat format,
                break;
        }
 
+       if (desc->layout == VK_FORMAT_LAYOUT_SUBSAMPLED) {
+               switch(format) {
+               /* Don't ask me why this looks inverted. PAL does the same. */
+               case VK_FORMAT_G8B8G8R8_422_UNORM:
+                       return V_008F14_IMG_DATA_FORMAT_BG_RG;
+               case VK_FORMAT_B8G8R8G8_422_UNORM:
+                       return V_008F14_IMG_DATA_FORMAT_GB_GR;
+               default:
+                       goto out_unknown;
+               }
+       }
+
        if (desc->layout == VK_FORMAT_LAYOUT_RGTC) {
                switch(format) {
                case VK_FORMAT_BC4_UNORM_BLOCK:
index dba8c1f450273252a9afa88bd05fc070312f7ef6..6fea8f911d3f05df3ee354eaa48f4a040328826d 100644 (file)
@@ -149,6 +149,9 @@ radv_use_dcc_for_image(struct radv_device *device,
        if (pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR)
                return false;
 
+       if (vk_format_is_subsampled(pCreateInfo->format))
+               return false;
+
        /* TODO: Enable DCC for mipmaps and array layers. */
        if (pCreateInfo->mipLevels > 1 || pCreateInfo->arrayLayers > 1)
                return false;
index 933db4d961c0b3bac6d98787108158a6fd7cf6f5..e89896c89693b7c012af038e435006086b93f4ae 100644 (file)
@@ -325,6 +325,19 @@ vk_format_is_compressed(VkFormat format)
        }
 }
 
+static inline bool
+vk_format_is_subsampled(VkFormat format)
+{
+       const struct vk_format_description *desc = vk_format_description(format);
+
+       assert(desc);
+       if (!desc) {
+               return false;
+       }
+
+       return desc->layout == VK_FORMAT_LAYOUT_SUBSAMPLED;
+}
+
 static inline bool
 vk_format_has_depth(const struct vk_format_description *desc)
 {