“I found that in VulkanAndroidPlatform.cpp, FVulkanAndroidPlatform::SetImageMemoryRequirementWorkaround(VkImageCreateInfo& ImageCreateInfo) is called in FVulkanTexture::GenerateImageCreateInfo(…), which causes textures to not use AFBC under certain conditions, although this can reduce memory consumption, I found through testing that it greatly increases GPU read bandwidth consumption.”
void FVulkanAndroidPlatform::SetImageMemoryRequirementWorkaround(VkImageCreateInfo& ImageCreateInfo)
{
if (AFBCWorkaroundOption != 0 &&
ImageCreateInfo.imageType == VK_IMAGE_TYPE_2D &&
ImageCreateInfo.format == VK_FORMAT_B8G8R8A8_UNORM &&
ImageCreateInfo.mipLevels >= 8) // its worth enabling for 128x128 and up
{
if (AFBCWorkaroundOption == 1)
{
ImageCreateInfo.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
}
else if (AFBCWorkaroundOption == 2)
{
ImageCreateInfo.usage |= VK_IMAGE_USAGE_STORAGE_BIT;
}
}
// Use ASTC workaround for textures ASTC_6x6 and ASTC_8x8 with mips and size up to 128x128
if (ASTCWorkaroundOption != 0 &&
ImageCreateInfo.imageType == VK_IMAGE_TYPE_2D &&
(ImageCreateInfo.format >= VK_FORMAT_ASTC_6x6_UNORM_BLOCK && ImageCreateInfo.format <= VK_FORMAT_ASTC_8x8_SRGB_BLOCK) &&
(ImageCreateInfo.mipLevels > 1 && ImageCreateInfo.extent.width <= 128 && ImageCreateInfo.extent.height <= 128))
{
ImageCreateInfo.tiling = VK_IMAGE_TILING_LINEAR;
}
}