diff options
author | Bas Nieuwenhuizen <[email protected]> | 2018-07-15 20:09:28 +0200 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2019-04-25 19:56:20 +0000 |
commit | 09c4a911e5a1aa1970b96b3dbba3585be616559d (patch) | |
tree | 6ff49423b1317bb6d05cff5e71757a37fd4d6d0f | |
parent | 055f6281d410aa55ac56169973897000d0e0cd42 (diff) |
radv: Add logic for subsampled format descriptions.
Reviewed-by: Samuel Pitoiset <[email protected]>
-rw-r--r-- | src/amd/vulkan/radv_formats.c | 12 | ||||
-rw-r--r-- | src/amd/vulkan/radv_image.c | 3 | ||||
-rw-r--r-- | src/amd/vulkan/vk_format.h | 13 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c index 0a3ff9ebbd9..773600b7f5d 100644 --- a/src/amd/vulkan/radv_formats.c +++ b/src/amd/vulkan/radv_formats.c @@ -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: diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index dba8c1f4502..6fea8f911d3 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -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; diff --git a/src/amd/vulkan/vk_format.h b/src/amd/vulkan/vk_format.h index 933db4d961c..e89896c8969 100644 --- a/src/amd/vulkan/vk_format.h +++ b/src/amd/vulkan/vk_format.h @@ -326,6 +326,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) { return desc->colorspace == VK_FORMAT_COLORSPACE_ZS && |