radv: Add logic for subsampled format descriptions.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:
Bas Nieuwenhuizen 2018-07-15 20:09:28 +02:00
parent 055f6281d4
commit 09c4a911e5
3 changed files with 28 additions and 0 deletions

View 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:

View 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;

View 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)
{