Vulkan: Add FormatImageAspects to get VkImageAspectFlags from VkFormat

Change-Id: I82c13d0e106dcd579096f0a4e0e5ffe50bae3092
This commit is contained in:
Benson Joeris
2019-05-30 15:05:14 -04:00
committed by Baldur Karlsson
parent 2e578ee418
commit bc9f84f61b
2 changed files with 17 additions and 0 deletions
+16
View File
@@ -2903,6 +2903,22 @@ VkFormat MakeVkFormat(ResourceFormat fmt)
return ret;
}
VkImageAspectFlags FormatImageAspects(VkFormat fmt)
{
if(IsStencilOnlyFormat(fmt))
return VK_IMAGE_ASPECT_STENCIL_BIT;
else if(IsDepthOnlyFormat(fmt))
return VK_IMAGE_ASPECT_DEPTH_BIT;
else if(IsDepthAndStencilFormat(fmt))
return VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
else if(GetYUVPlaneCount(fmt) == 3)
return VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT | VK_IMAGE_ASPECT_PLANE_2_BIT;
else if(GetYUVPlaneCount(fmt) == 2)
return VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT;
else
return VK_IMAGE_ASPECT_COLOR_BIT;
}
VkResourceRecord::~VkResourceRecord()
{
VkResourceType resType = Resource != NULL ? IdentifyTypeByPtr(Resource) : eResUnknown;
+1
View File
@@ -1344,6 +1344,7 @@ bool IsUIntFormat(VkFormat f);
bool IsDoubleFormat(VkFormat f);
bool IsSIntFormat(VkFormat f);
bool IsYUVFormat(VkFormat f);
VkImageAspectFlags FormatImageAspects(VkFormat f);
uint32_t GetYUVPlaneCount(VkFormat f);
uint32_t GetYUVNumRows(VkFormat f, uint32_t height);