mirror of
https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
synced 2025-05-15 01:08:39 +00:00
formats: Add vkuFormatIsDepthStencilWithColorSizeCompatible
This commit is contained in:
parent
249718532d
commit
4923254936
3 changed files with 62 additions and 0 deletions
|
@ -207,6 +207,10 @@ inline VkFormat vkuFindMultiplaneCompatibleFormat(VkFormat mp_fmt, VkImageAspect
|
|||
// Will return {1, 1} if given a plane aspect that doesn't exist for the VkFormat
|
||||
inline VkExtent2D vkuFindMultiplaneExtentDivisors(VkFormat mp_fmt, VkImageAspectFlagBits plane_aspect);
|
||||
|
||||
// From table in spec vkspec.html#formats-compatible-zs-color
|
||||
// Introduced in VK_KHR_maintenance8 to allow copying between color and depth/stencil formats
|
||||
inline bool vkuFormatIsDepthStencilWithColorSizeCompatible(VkFormat color_format, VkFormat ds_format);
|
||||
|
||||
// Returns the count of components in a VkFormat
|
||||
inline uint32_t vkuFormatComponentCount(VkFormat format);
|
||||
|
||||
|
@ -554,6 +558,27 @@ inline VkExtent2D vkuFindMultiplaneExtentDivisors(VkFormat mp_fmt, VkImageAspect
|
|||
return divisors;
|
||||
}
|
||||
|
||||
// TODO - This should be generated, but will need updating the spec XML and table
|
||||
inline bool vkuFormatIsDepthStencilWithColorSizeCompatible(VkFormat color_format, VkFormat ds_format) {
|
||||
switch (ds_format) {
|
||||
case VK_FORMAT_D32_SFLOAT:
|
||||
case VK_FORMAT_D32_SFLOAT_S8_UINT:
|
||||
return color_format == VK_FORMAT_R32_SFLOAT || color_format == VK_FORMAT_R32_SINT || color_format == VK_FORMAT_R32_UINT;
|
||||
case VK_FORMAT_X8_D24_UNORM_PACK32:
|
||||
case VK_FORMAT_D24_UNORM_S8_UINT:
|
||||
return color_format == VK_FORMAT_R32_SFLOAT || color_format == VK_FORMAT_R32_SINT || color_format == VK_FORMAT_R32_UINT;
|
||||
case VK_FORMAT_D16_UNORM:
|
||||
case VK_FORMAT_D16_UNORM_S8_UINT:
|
||||
return color_format == VK_FORMAT_R16_SFLOAT || color_format == VK_FORMAT_R16_UNORM ||
|
||||
color_format == VK_FORMAT_R16_SNORM || color_format == VK_FORMAT_R16_UINT || color_format == VK_FORMAT_R16_SINT;
|
||||
case VK_FORMAT_S8_UINT:
|
||||
return color_format == VK_FORMAT_R8_UINT || color_format == VK_FORMAT_R8_SINT ||
|
||||
color_format == VK_FORMAT_R8_UNORM || color_format == VK_FORMAT_R8_SNORM;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
inline uint32_t vkuFormatComponentCount(VkFormat format) { return vkuGetFormatInfo(format).component_count; }
|
||||
|
||||
inline VkExtent3D vkuFormatTexelBlockExtent(VkFormat format) { return vkuGetFormatInfo(format).block_extent; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue