From c7f309aae4a3c1178999a73119474aadd08ca253 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Fri, 8 Jan 2016 11:07:56 -0700 Subject: [PATCH] layers: LX264, Validate immutable format bit in image layer --- layers/image.cpp | 27 +++- layers/vk_layer_utils.cpp | 382 +++++++++++++++++++++++----------------------- layers/vk_layer_utils.h | 68 ++++++++- 3 files changed, 280 insertions(+), 197 deletions(-) diff --git a/layers/image.cpp b/layers/image.cpp index 88d16c2..1d8de45 100644 --- a/layers/image.cpp +++ b/layers/image.cpp @@ -506,11 +506,33 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, IMAGE_VIEW_CREATE_ERROR, "IMAGE", "%s", ss.str().c_str()); } - // Validate correct image aspect bits for desired formats and format consistency VkFormat imageFormat = imageEntry->second.format; VkFormat ivciFormat = pCreateInfo->format; VkImageAspectFlags aspectMask = pCreateInfo->subresourceRange.aspectMask; + // Validate VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT state + if (pCreateInfo->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) { + // Format MUST be compatible (in the same format compatibility class) as the format the image was created with + if (vk_format_get_compatibility_class(imageFormat) != vk_format_get_compatibility_class(ivciFormat)) { + std::stringstream ss; + ss << "vkCreateImageView(): ImageView format " << string_VkFormat(ivciFormat) << " is not in the same format compatibility class as image (" << + (uint64_t)pCreateInfo->image << ") format " << string_VkFormat(imageFormat) << ". Images created with the VK_IMAGE_CREATE_MUTABLE_FORMAT BIT " << + "can support ImageViews with differing formats but they must be in the same compatibility class."; + skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + IMAGE_VIEW_CREATE_ERROR, "IMAGE", "%s", ss.str().c_str()); + } + } else { + // Format MUST be IDENTICAL to the format the image was created with + if (imageFormat != ivciFormat) { + std::stringstream ss; + ss << "vkCreateImageView() format " << string_VkFormat(ivciFormat) << " differs from image " << (uint64_t)pCreateInfo->image << " format " << + string_VkFormat(imageFormat) << ". Formats MUST be IDENTICAL unless VK_IMAGE_CREATE_MUTABLE_FORMAT BIT was set on image creation."; + skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + IMAGE_VIEW_CREATE_ERROR, "IMAGE", "%s", ss.str().c_str()); + } + } + + // Validate correct image aspect bits for desired formats and format consistency if (vk_format_is_color(imageFormat)) { if ((aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != VK_IMAGE_ASPECT_COLOR_BIT) { std::stringstream ss; @@ -576,8 +598,9 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device } } - if (skipCall) + if (skipCall) { return VK_ERROR_VALIDATION_FAILED_EXT; + } VkResult result = device_data->device_dispatch_table->CreateImageView(device, pCreateInfo, pAllocator, pView); return result; diff --git a/layers/vk_layer_utils.cpp b/layers/vk_layer_utils.cpp index 628555c..4eb1e90 100644 --- a/layers/vk_layer_utils.cpp +++ b/layers/vk_layer_utils.cpp @@ -29,200 +29,202 @@ #include "vulkan/vulkan.h" #include "vk_layer_utils.h" + typedef struct _VULKAN_FORMAT_INFO { - size_t size; - uint32_t channel_count; + size_t size; + uint32_t channel_count; + VkFormatCompatibilityClass format_class; } VULKAN_FORMAT_INFO; // Set up data structure with number of bytes and number of channels // for each Vulkan format. static const VULKAN_FORMAT_INFO vk_format_table[VK_FORMAT_RANGE_SIZE] = { - { 0, 0 }, // [VK_FORMAT_UNDEFINED] - { 1, 2 }, // [VK_FORMAT_R4G4_UNORM_PACK8] - { 2, 4 }, // [VK_FORMAT_R4G4B4A4_UNORM_PACK16] - { 2, 4 }, // [VK_FORMAT_B4G4R4A4_UNORM_PACK16] - { 2, 3 }, // [VK_FORMAT_R5G6B5_UNORM_PACK16] - { 2, 3 }, // [VK_FORMAT_B5G6R5_UNORM_PACK16] - { 2, 4 }, // [VK_FORMAT_R5G5B5A1_UNORM_PACK16] - { 2, 4 }, // [VK_FORMAT_B5G5R5A1_UNORM_PACK16] - { 2, 4 }, // [VK_FORMAT_A1R5G5B5_UNORM_PACK16] - { 1, 1 }, // [VK_FORMAT_R8_UNORM] - { 1, 1 }, // [VK_FORMAT_R8_SNORM] - { 1, 1 }, // [VK_FORMAT_R8_USCALED] - { 1, 1 }, // [VK_FORMAT_R8_SSCALED] - { 1, 1 }, // [VK_FORMAT_R8_UINT] - { 1, 1 }, // [VK_FORMAT_R8_SINT] - { 1, 1 }, // [VK_FORMAT_R8_SRGB] - { 2, 2 }, // [VK_FORMAT_R8G8_UNORM] - { 2, 2 }, // [VK_FORMAT_R8G8_SNORM] - { 2, 2 }, // [VK_FORMAT_R8G8_USCALED] - { 2, 2 }, // [VK_FORMAT_R8G8_SSCALED] - { 2, 2 }, // [VK_FORMAT_R8G8_UINT] - { 2, 2 }, // [VK_FORMAT_R8G8_SINT] - { 2, 2 }, // [VK_FORMAT_R8G8_SRGB] - { 3, 3 }, // [VK_FORMAT_R8G8B8_UNORM] - { 3, 3 }, // [VK_FORMAT_R8G8B8_SNORM] - { 3, 3 }, // [VK_FORMAT_R8G8B8_USCALED] - { 3, 3 }, // [VK_FORMAT_R8G8B8_SSCALED] - { 3, 3 }, // [VK_FORMAT_R8G8B8_UINT] - { 3, 3 }, // [VK_FORMAT_R8G8B8_SINT] - { 3, 3 }, // [VK_FORMAT_R8G8B8_SRGB] - { 3, 3 }, // [VK_FORMAT_B8G8R8_UNORM] - { 3, 3 }, // [VK_FORMAT_B8G8R8_SNORM] - { 3, 3 }, // [VK_FORMAT_B8G8R8_USCALED] - { 3, 3 }, // [VK_FORMAT_B8G8R8_SSCALED] - { 3, 3 }, // [VK_FORMAT_B8G8R8_UINT] - { 3, 3 }, // [VK_FORMAT_B8G8R8_SINT] - { 3, 3 }, // [VK_FORMAT_B8G8R8_SRGB] - { 4, 4 }, // [VK_FORMAT_R8G8B8A8_UNORM] - { 4, 4 }, // [VK_FORMAT_R8G8B8A8_SNORM] - { 4, 4 }, // [VK_FORMAT_R8G8B8A8_USCALED] - { 4, 4 }, // [VK_FORMAT_R8G8B8A8_SSCALED] - { 4, 4 }, // [VK_FORMAT_R8G8B8A8_UINT] - { 4, 4 }, // [VK_FORMAT_R8G8B8A8_SINT] - { 4, 4 }, // [VK_FORMAT_R8G8B8A8_SRGB] - { 4, 4 }, // [VK_FORMAT_B8G8R8A8_UNORM] - { 4, 4 }, // [VK_FORMAT_B8G8R8A8_SNORM] - { 4, 4 }, // [VK_FORMAT_B8G8R8A8_USCALED] - { 4, 4 }, // [VK_FORMAT_B8G8R8A8_SSCALED] - { 4, 4 }, // [VK_FORMAT_B8G8R8A8_UINT] - { 4, 4 }, // [VK_FORMAT_B8G8R8A8_SINT] - { 4, 4 }, // [VK_FORMAT_B8G8R8A8_SRGB] - { 4, 4 }, // [VK_FORMAT_A8B8G8R8_UNORM_PACK32] - { 4, 4 }, // [VK_FORMAT_A8B8G8R8_SNORM_PACK32] - { 4, 4 }, // [VK_FORMAT_A8B8G8R8_USCALED_PACK32] - { 4, 4 }, // [VK_FORMAT_A8B8G8R8_SSCALED_PACK32] - { 4, 4 }, // [VK_FORMAT_A8B8G8R8_UINT_PACK32] - { 4, 4 }, // [VK_FORMAT_A8B8G8R8_SINT_PACK32] - { 4, 4 }, // [VK_FORMAT_B8G8R8A8_SRGB_PACK32] - { 4, 4 }, // [VK_FORMAT_A2R10G10B10_UNORM_PACK32] - { 4, 4 }, // [VK_FORMAT_A2R10G10B10_SNORM_PACK32] - { 4, 4 }, // [VK_FORMAT_A2R10G10B10_USCALED_PACK32] - { 4, 4 }, // [VK_FORMAT_A2R10G10B10_SSCALED_PACK32] - { 4, 4 }, // [VK_FORMAT_A2R10G10B10_UINT_PACK32] - { 4, 4 }, // [VK_FORMAT_A2R10G10B10_SINT_PACK32] - { 4, 4 }, // [VK_FORMAT_A2B10G10R10_UNORM_PACK32] - { 4, 4 }, // [VK_FORMAT_A2B10G10R10_SNORM_PACK32] - { 4, 4 }, // [VK_FORMAT_A2B10G10R10_USCALED_PACK32] - { 4, 4 }, // [VK_FORMAT_A2B10G10R10_SSCALED_PACK32] - { 4, 4 }, // [VK_FORMAT_A2B10G10R10_UINT_PACK32] - { 4, 4 }, // [VK_FORMAT_A2B10G10R10_SINT_PACK32] - { 2, 1 }, // [VK_FORMAT_R16_UNORM] - { 2, 1 }, // [VK_FORMAT_R16_SNORM] - { 2, 1 }, // [VK_FORMAT_R16_USCALED] - { 2, 1 }, // [VK_FORMAT_R16_SSCALED] - { 2, 1 }, // [VK_FORMAT_R16_UINT] - { 2, 1 }, // [VK_FORMAT_R16_SINT] - { 2, 1 }, // [VK_FORMAT_R16_SFLOAT] - { 4, 2 }, // [VK_FORMAT_R16G16_UNORM] - { 4, 2 }, // [VK_FORMAT_R16G16_SNORM] - { 4, 2 }, // [VK_FORMAT_R16G16_USCALED] - { 4, 2 }, // [VK_FORMAT_R16G16_SSCALED] - { 4, 2 }, // [VK_FORMAT_R16G16_UINT] - { 4, 2 }, // [VK_FORMAT_R16G16_SINT] - { 4, 2 }, // [VK_FORMAT_R16G16_SFLOAT] - { 6, 3 }, // [VK_FORMAT_R16G16B16_UNORM] - { 6, 3 }, // [VK_FORMAT_R16G16B16_SNORM] - { 6, 3 }, // [VK_FORMAT_R16G16B16_USCALED] - { 6, 3 }, // [VK_FORMAT_R16G16B16_SSCALED] - { 6, 3 }, // [VK_FORMAT_R16G16B16_UINT] - { 6, 3 }, // [VK_FORMAT_R16G16B16_SINT] - { 6, 3 }, // [VK_FORMAT_R16G16B16_SFLOAT] - { 8, 4 }, // [VK_FORMAT_R16G16B16A16_UNORM] - { 8, 4 }, // [VK_FORMAT_R16G16B16A16_SNORM] - { 8, 4 }, // [VK_FORMAT_R16G16B16A16_USCALED] - { 8, 4 }, // [VK_FORMAT_R16G16B16A16_SSCALED] - { 8, 4 }, // [VK_FORMAT_R16G16B16A16_UINT] - { 8, 4 }, // [VK_FORMAT_R16G16B16A16_SINT] - { 8, 4 }, // [VK_FORMAT_R16G16B16A16_SFLOAT] - { 4, 1 }, // [VK_FORMAT_R32_UINT] - { 4, 1 }, // [VK_FORMAT_R32_SINT] - { 4, 1 }, // [VK_FORMAT_R32_SFLOAT] - { 8, 2 }, // [VK_FORMAT_R32G32_UINT] - { 8, 2 }, // [VK_FORMAT_R32G32_SINT] - { 8, 2 }, // [VK_FORMAT_R32G32_SFLOAT] - { 12, 3 }, // [VK_FORMAT_R32G32B32_UINT] - { 12, 3 }, // [VK_FORMAT_R32G32B32_SINT] - { 12, 3 }, // [VK_FORMAT_R32G32B32_SFLOAT] - { 16, 4 }, // [VK_FORMAT_R32G32B32A32_UINT] - { 16, 4 }, // [VK_FORMAT_R32G32B32A32_SINT] - { 16, 4 }, // [VK_FORMAT_R32G32B32A32_SFLOAT] - { 8, 1 }, // [VK_FORMAT_R64_UINT] - { 8, 1 }, // [VK_FORMAT_R64_SINT] - { 8, 1 }, // [VK_FORMAT_R64_SFLOAT] - { 16, 2 }, // [VK_FORMAT_R64G64_UINT] - { 16, 2 }, // [VK_FORMAT_R64G64_SINT] - { 16, 2 }, // [VK_FORMAT_R64G64_SFLOAT] - { 24, 3 }, // [VK_FORMAT_R64G64B64_UINT] - { 24, 3 }, // [VK_FORMAT_R64G64B64_SINT] - { 24, 3 }, // [VK_FORMAT_R64G64B64_SFLOAT] - { 32, 4 }, // [VK_FORMAT_R64G64B64A64_UINT] - { 32, 4 }, // [VK_FORMAT_R64G64B64A64_SINT] - { 32, 4 }, // [VK_FORMAT_R64G64B64A64_SFLOAT] - { 4, 3 }, // [VK_FORMAT_B10G11R11_UFLOAT_PACK32] - { 4, 3 }, // [VK_FORMAT_E5B9G9R9_UFLOAT_PACK32] - { 2, 1 }, // [VK_FORMAT_D16_UNORM] - { 3, 1 }, // [VK_FORMAT_X8_D24_UNORM_PACK32] - { 4, 1 }, // [VK_FORMAT_D32_SFLOAT] - { 1, 1 }, // [VK_FORMAT_S8_UINT] - { 3, 2 }, // [VK_FORMAT_D16_UNORM_S8_UINT] - { 4, 2 }, // [VK_FORMAT_D24_UNORM_S8_UINT] - { 4, 2 }, // [VK_FORMAT_D32_SFLOAT_S8_UINT] - { 8, 4 }, // [VK_FORMAT_BC1_RGB_UNORM_BLOCK] - { 8, 4 }, // [VK_FORMAT_BC1_RGB_SRGB_BLOCK] - { 8, 4 }, // [VK_FORMAT_BC1_RGBA_UNORM_BLOCK] - { 8, 4 }, // [VK_FORMAT_BC1_RGBA_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_BC2_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_BC2_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_BC3_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_BC3_SRGB_BLOCK] - { 8, 4 }, // [VK_FORMAT_BC4_UNORM_BLOCK] - { 8, 4 }, // [VK_FORMAT_BC4_SNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_BC5_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_BC5_SNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_BC6H_UFLOAT_BLOCK] - { 16, 4 }, // [VK_FORMAT_BC6H_SFLOAT_BLOCK] - { 16, 4 }, // [VK_FORMAT_BC7_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_BC7_SRGB_BLOCK] - { 8, 3 }, // [VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK] - { 8, 3 }, // [VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK] - { 8, 4 }, // [VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK] - { 8, 4 }, // [VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK] - { 8, 4 }, // [VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK] - { 8, 4 }, // [VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK] - { 8, 1 }, // [VK_FORMAT_EAC_R11_UNORM_BLOCK] - { 8, 1 }, // [VK_FORMAT_EAC_R11_SNORM_BLOCK] - { 16, 2 }, // [VK_FORMAT_EAC_R11G11_UNORM_BLOCK] - { 16, 2 }, // [VK_FORMAT_EAC_R11G11_SNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_4x4_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_4x4_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_5x4_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_5x4_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_5x5_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_5x5_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_6x5_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_6x5_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_6x6_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_6x6_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_8x5_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_8x5_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_8x6_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_8x6_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_8x8_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_8x8_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_10x5_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_10x5_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_10x6_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_10x6_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_10x8_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_10x8_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_10x10_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_10x10_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_12x10_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_12x10_SRGB_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_12x12_UNORM_BLOCK] - { 16, 4 }, // [VK_FORMAT_ASTC_12x12_SRGB_BLOCK] + { 0, 0, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT }, // [VK_FORMAT_UNDEFINED] + { 1, 2, VK_FORMAT_COMPATIBILITY_CLASS_8_BIT }, // [VK_FORMAT_R4G4_UNORM_PACK8] + { 2, 4, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R4G4B4A4_UNORM_PACK16] + { 2, 4, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_B4G4R4A4_UNORM_PACK16] + { 2, 3, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R5G6B5_UNORM_PACK16] + { 2, 3, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_B5G6R5_UNORM_PACK16] + { 2, 4, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R5G5B5A1_UNORM_PACK16] + { 2, 4, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_B5G5R5A1_UNORM_PACK16] + { 2, 4, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_A1R5G5B5_UNORM_PACK16] + { 1, 1, VK_FORMAT_COMPATIBILITY_CLASS_8_BIT }, // [VK_FORMAT_R8_UNORM] + { 1, 1, VK_FORMAT_COMPATIBILITY_CLASS_8_BIT }, // [VK_FORMAT_R8_SNORM] + { 1, 1, VK_FORMAT_COMPATIBILITY_CLASS_8_BIT }, // [VK_FORMAT_R8_USCALED] + { 1, 1, VK_FORMAT_COMPATIBILITY_CLASS_8_BIT }, // [VK_FORMAT_R8_SSCALED] + { 1, 1, VK_FORMAT_COMPATIBILITY_CLASS_8_BIT }, // [VK_FORMAT_R8_UINT] + { 1, 1, VK_FORMAT_COMPATIBILITY_CLASS_8_BIT }, // [VK_FORMAT_R8_SINT] + { 1, 1, VK_FORMAT_COMPATIBILITY_CLASS_8_BIT }, // [VK_FORMAT_R8_SRGB] + { 2, 2, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R8G8_UNORM] + { 2, 2, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R8G8_SNORM] + { 2, 2, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R8G8_USCALED] + { 2, 2, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R8G8_SSCALED] + { 2, 2, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R8G8_UINT] + { 2, 2, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R8G8_SINT] + { 2, 2, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R8G8_SRGB] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_R8G8B8_UNORM] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_R8G8B8_SNORM] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_R8G8B8_USCALED] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_R8G8B8_SSCALED] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_R8G8B8_UINT] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_R8G8B8_SINT] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_R8G8B8_SRGB] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_B8G8R8_UNORM] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_B8G8R8_SNORM] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_B8G8R8_USCALED] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_B8G8R8_SSCALED] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_B8G8R8_UINT] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_B8G8R8_SINT] + { 3, 3, VK_FORMAT_COMPATIBILITY_CLASS_24_BIT }, // [VK_FORMAT_B8G8R8_SRGB] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R8G8B8A8_UNORM] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R8G8B8A8_SNORM] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R8G8B8A8_USCALED] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R8G8B8A8_SSCALED] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R8G8B8A8_UINT] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R8G8B8A8_SINT] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R8G8B8A8_SRGB] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_B8G8R8A8_UNORM] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_B8G8R8A8_SNORM] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_B8G8R8A8_USCALED] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_B8G8R8A8_SSCALED] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_B8G8R8A8_UINT] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_B8G8R8A8_SINT] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_B8G8R8A8_SRGB] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A8B8G8R8_UNORM_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A8B8G8R8_SNORM_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A8B8G8R8_USCALED_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A8B8G8R8_SSCALED_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A8B8G8R8_UINT_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A8B8G8R8_SINT_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_B8G8R8A8_SRGB_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2R10G10B10_UNORM_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2R10G10B10_SNORM_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2R10G10B10_USCALED_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2R10G10B10_SSCALED_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2R10G10B10_UINT_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2R10G10B10_SINT_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2B10G10R10_UNORM_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2B10G10R10_SNORM_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2B10G10R10_USCALED_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2B10G10R10_SSCALED_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2B10G10R10_UINT_PACK32] + { 4, 4, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_A2B10G10R10_SINT_PACK32] + { 2, 1, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R16_UNORM] + { 2, 1, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R16_SNORM] + { 2, 1, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R16_USCALED] + { 2, 1, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R16_SSCALED] + { 2, 1, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R16_UINT] + { 2, 1, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R16_SINT] + { 2, 1, VK_FORMAT_COMPATIBILITY_CLASS_16_BIT }, // [VK_FORMAT_R16_SFLOAT] + { 4, 2, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R16G16_UNORM] + { 4, 2, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R16G16_SNORM] + { 4, 2, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R16G16_USCALED] + { 4, 2, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R16G16_SSCALED] + { 4, 2, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R16G16_UINT] + { 4, 2, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R16G16_SINT] + { 4, 2, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R16G16_SFLOAT] + { 6, 3, VK_FORMAT_COMPATIBILITY_CLASS_48_BIT }, // [VK_FORMAT_R16G16B16_UNORM] + { 6, 3, VK_FORMAT_COMPATIBILITY_CLASS_48_BIT }, // [VK_FORMAT_R16G16B16_SNORM] + { 6, 3, VK_FORMAT_COMPATIBILITY_CLASS_48_BIT }, // [VK_FORMAT_R16G16B16_USCALED] + { 6, 3, VK_FORMAT_COMPATIBILITY_CLASS_48_BIT }, // [VK_FORMAT_R16G16B16_SSCALED] + { 6, 3, VK_FORMAT_COMPATIBILITY_CLASS_48_BIT }, // [VK_FORMAT_R16G16B16_UINT] + { 6, 3, VK_FORMAT_COMPATIBILITY_CLASS_48_BIT }, // [VK_FORMAT_R16G16B16_SINT] + { 6, 3, VK_FORMAT_COMPATIBILITY_CLASS_48_BIT }, // [VK_FORMAT_R16G16B16_SFLOAT] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R16G16B16A16_UNORM] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R16G16B16A16_SNORM] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R16G16B16A16_USCALED] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R16G16B16A16_SSCALED] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R16G16B16A16_UINT] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R16G16B16A16_SINT] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R16G16B16A16_SFLOAT] + { 4, 1, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R32_UINT] + { 4, 1, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R32_SINT] + { 4, 1, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_R32_SFLOAT] + { 8, 2, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R32G32_UINT] + { 8, 2, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R32G32_SINT] + { 8, 2, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R32G32_SFLOAT] + { 12, 3, VK_FORMAT_COMPATIBILITY_CLASS_96_BIT }, // [VK_FORMAT_R32G32B32_UINT] + { 12, 3, VK_FORMAT_COMPATIBILITY_CLASS_96_BIT }, // [VK_FORMAT_R32G32B32_SINT] + { 12, 3, VK_FORMAT_COMPATIBILITY_CLASS_96_BIT }, // [VK_FORMAT_R32G32B32_SFLOAT] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_128_BIT }, // [VK_FORMAT_R32G32B32A32_UINT] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_128_BIT }, // [VK_FORMAT_R32G32B32A32_SINT] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_128_BIT }, // [VK_FORMAT_R32G32B32A32_SFLOAT] + { 8, 1, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R64_UINT] + { 8, 1, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R64_SINT] + { 8, 1, VK_FORMAT_COMPATIBILITY_CLASS_64_BIT }, // [VK_FORMAT_R64_SFLOAT] + { 16, 2, VK_FORMAT_COMPATIBILITY_CLASS_128_BIT }, // [VK_FORMAT_R64G64_UINT] + { 16, 2, VK_FORMAT_COMPATIBILITY_CLASS_128_BIT }, // [VK_FORMAT_R64G64_SINT] + { 16, 2, VK_FORMAT_COMPATIBILITY_CLASS_128_BIT }, // [VK_FORMAT_R64G64_SFLOAT] + { 24, 3, VK_FORMAT_COMPATIBILITY_CLASS_192_BIT }, // [VK_FORMAT_R64G64B64_UINT] + { 24, 3, VK_FORMAT_COMPATIBILITY_CLASS_192_BIT }, // [VK_FORMAT_R64G64B64_SINT] + { 24, 3, VK_FORMAT_COMPATIBILITY_CLASS_192_BIT }, // [VK_FORMAT_R64G64B64_SFLOAT] + { 32, 4, VK_FORMAT_COMPATIBILITY_CLASS_256_BIT }, // [VK_FORMAT_R64G64B64A64_UINT] + { 32, 4, VK_FORMAT_COMPATIBILITY_CLASS_256_BIT }, // [VK_FORMAT_R64G64B64A64_SINT] + { 32, 4, VK_FORMAT_COMPATIBILITY_CLASS_256_BIT }, // [VK_FORMAT_R64G64B64A64_SFLOAT] + { 4, 3, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_B10G11R11_UFLOAT_PACK32] + { 4, 3, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT }, // [VK_FORMAT_E5B9G9R9_UFLOAT_PACK32] + { 2, 1, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT }, // [VK_FORMAT_D16_UNORM] + { 3, 1, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT }, // [VK_FORMAT_X8_D24_UNORM_PACK32] + { 4, 1, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT }, // [VK_FORMAT_D32_SFLOAT] + { 1, 1, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT }, // [VK_FORMAT_S8_UINT] + { 3, 2, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT }, // [VK_FORMAT_D16_UNORM_S8_UINT] + { 4, 2, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT }, // [VK_FORMAT_D24_UNORM_S8_UINT] + { 4, 2, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT }, // [VK_FORMAT_D32_SFLOAT_S8_UINT] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC1_RGB_BIT }, // [VK_FORMAT_BC1_RGB_UNORM_BLOCK] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC1_RGB_BIT }, // [VK_FORMAT_BC1_RGB_SRGB_BLOCK] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC1_RGBA_BIT }, // [VK_FORMAT_BC1_RGBA_UNORM_BLOCK] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC1_RGBA_BIT }, // [VK_FORMAT_BC1_RGBA_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC2_BIT }, // [VK_FORMAT_BC2_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC2_BIT }, // [VK_FORMAT_BC2_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC3_BIT }, // [VK_FORMAT_BC3_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC3_BIT }, // [VK_FORMAT_BC3_SRGB_BLOCK] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC4_BIT }, // [VK_FORMAT_BC4_UNORM_BLOCK] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC4_BIT }, // [VK_FORMAT_BC4_SNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC5_BIT }, // [VK_FORMAT_BC5_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC5_BIT }, // [VK_FORMAT_BC5_SNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC6H_BIT }, // [VK_FORMAT_BC6H_UFLOAT_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC6H_BIT }, // [VK_FORMAT_BC6H_SFLOAT_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC7_BIT }, // [VK_FORMAT_BC7_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_BC7_BIT }, // [VK_FORMAT_BC7_SRGB_BLOCK] + { 8, 3, VK_FORMAT_COMPATIBILITY_CLASS_ETC2_RGB_BIT }, // [VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK] + { 8, 3, VK_FORMAT_COMPATIBILITY_CLASS_ETC2_RGB_BIT }, // [VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_ETC2_RGBA_BIT }, // [VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_ETC2_RGBA_BIT }, // [VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_ETC2_EAC_RGBA_BIT }, // [VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK] + { 8, 4, VK_FORMAT_COMPATIBILITY_CLASS_ETC2_EAC_RGBA_BIT }, // [VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK] + { 8, 1, VK_FORMAT_COMPATIBILITY_CLASS_EAC_R_BIT }, // [VK_FORMAT_EAC_R11_UNORM_BLOCK] + { 8, 1, VK_FORMAT_COMPATIBILITY_CLASS_EAC_R_BIT }, // [VK_FORMAT_EAC_R11_SNORM_BLOCK] + { 16, 2, VK_FORMAT_COMPATIBILITY_CLASS_EAC_RG_BIT }, // [VK_FORMAT_EAC_R11G11_UNORM_BLOCK] + { 16, 2, VK_FORMAT_COMPATIBILITY_CLASS_EAC_RG_BIT }, // [VK_FORMAT_EAC_R11G11_SNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_4X4_BIT }, // [VK_FORMAT_ASTC_4x4_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_4X4_BIT }, // [VK_FORMAT_ASTC_4x4_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_5X4_BIT }, // [VK_FORMAT_ASTC_5x4_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_5X4_BIT }, // [VK_FORMAT_ASTC_5x4_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_5X5_BIT }, // [VK_FORMAT_ASTC_5x5_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_5X5_BIT }, // [VK_FORMAT_ASTC_5x5_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_6X5_BIT }, // [VK_FORMAT_ASTC_6x5_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_6X5_BIT }, // [VK_FORMAT_ASTC_6x5_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_6X6_BIT }, // [VK_FORMAT_ASTC_6x6_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_6X6_BIT }, // [VK_FORMAT_ASTC_6x6_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X5_BIT }, // [VK_FORMAT_ASTC_8x5_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X5_BIT }, // [VK_FORMAT_ASTC_8x5_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X6_BIT }, // [VK_FORMAT_ASTC_8x6_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X6_BIT }, // [VK_FORMAT_ASTC_8x6_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X8_BIT }, // [VK_FORMAT_ASTC_8x8_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X8_BIT }, // [VK_FORMAT_ASTC_8x8_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X5_BIT }, // [VK_FORMAT_ASTC_10x5_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X5_BIT }, // [VK_FORMAT_ASTC_10x5_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X6_BIT }, // [VK_FORMAT_ASTC_10x6_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X6_BIT }, // [VK_FORMAT_ASTC_10x6_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X8_BIT }, // [VK_FORMAT_ASTC_10x8_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X8_BIT }, // [VK_FORMAT_ASTC_10x8_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X10_BIT }, // [VK_FORMAT_ASTC_10x10_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X10_BIT }, // [VK_FORMAT_ASTC_10x10_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_12X10_BIT }, // [VK_FORMAT_ASTC_12x10_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_12X10_BIT }, // [VK_FORMAT_ASTC_12x10_SRGB_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_12X12_BIT }, // [VK_FORMAT_ASTC_12x12_UNORM_BLOCK] + { 16, 4, VK_FORMAT_COMPATIBILITY_CLASS_ASTC_12X12_BIT }, // [VK_FORMAT_ASTC_12x12_SRGB_BLOCK] }; // Return true if format is a depth or stencil format @@ -565,6 +567,12 @@ bool vk_format_is_compressed(VkFormat format) } } +// Return format class of the specified format +VkFormatCompatibilityClass vk_format_get_compatibility_class(VkFormat format) +{ + return vk_format_table[format].format_class; +} + // Return size, in bytes, of a pixel of the specified format size_t vk_format_get_size(VkFormat format) { diff --git a/layers/vk_layer_utils.h b/layers/vk_layer_utils.h index b59fe1a..5e34502 100644 --- a/layers/vk_layer_utils.h +++ b/layers/vk_layer_utils.h @@ -36,6 +36,56 @@ extern "C" { #endif +typedef enum VkFormatCompatibilityClass { + VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT = 0, + VK_FORMAT_COMPATIBILITY_CLASS_8_BIT = 1, + VK_FORMAT_COMPATIBILITY_CLASS_16_BIT = 2, + VK_FORMAT_COMPATIBILITY_CLASS_24_BIT = 3, + VK_FORMAT_COMPATIBILITY_CLASS_32_BIT = 4, + VK_FORMAT_COMPATIBILITY_CLASS_48_BIT = 5, + VK_FORMAT_COMPATIBILITY_CLASS_64_BIT = 6, + VK_FORMAT_COMPATIBILITY_CLASS_96_BIT = 7, + VK_FORMAT_COMPATIBILITY_CLASS_128_BIT = 8, + VK_FORMAT_COMPATIBILITY_CLASS_192_BIT = 9, + VK_FORMAT_COMPATIBILITY_CLASS_256_BIT = 10, + VK_FORMAT_COMPATIBILITY_CLASS_BC1_RGB_BIT = 11, + VK_FORMAT_COMPATIBILITY_CLASS_BC1_RGBA_BIT = 12, + VK_FORMAT_COMPATIBILITY_CLASS_BC2_BIT = 13, + VK_FORMAT_COMPATIBILITY_CLASS_BC3_BIT = 14, + VK_FORMAT_COMPATIBILITY_CLASS_BC4_BIT = 15, + VK_FORMAT_COMPATIBILITY_CLASS_BC5_BIT = 16, + VK_FORMAT_COMPATIBILITY_CLASS_BC6H_BIT = 17, + VK_FORMAT_COMPATIBILITY_CLASS_BC7_BIT = 18, + VK_FORMAT_COMPATIBILITY_CLASS_ETC2_RGB_BIT = 19, + VK_FORMAT_COMPATIBILITY_CLASS_ETC2_RGBA_BIT = 20, + VK_FORMAT_COMPATIBILITY_CLASS_ETC2_EAC_RGBA_BIT = 21, + VK_FORMAT_COMPATIBILITY_CLASS_EAC_R_BIT = 22, + VK_FORMAT_COMPATIBILITY_CLASS_EAC_RG_BIT = 23, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_4X4_BIT = 24, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_5X4_BIT = 25, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_5X5_BIT = 26, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_6X5_BIT = 27, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_6X6_BIT = 28, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X5_BIT = 29, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X6_BIT = 20, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X8_BIT = 31, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X5_BIT = 32, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X6_BIT = 33, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X8_BIT = 34, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X10_BIT = 35, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_12X10_BIT = 36, + VK_FORMAT_COMPATIBILITY_CLASS_ASTC_12X12_BIT = 37, + VK_FORMAT_COMPATIBILITY_CLASS_D16_BIT = 38, + VK_FORMAT_COMPATIBILITY_CLASS_D24_BIT = 39, + VK_FORMAT_COMPATIBILITY_CLASS_D32_BIT = 30, + VK_FORMAT_COMPATIBILITY_CLASS_S8_BIT = 41, + VK_FORMAT_COMPATIBILITY_CLASS_D16S8_BIT = 42, + VK_FORMAT_COMPATIBILITY_CLASS_D24S8_BIT = 43, + VK_FORMAT_COMPATIBILITY_CLASS_D32S8_BIT = 44, + VK_FORMAT_COMPATIBILITY_CLASS_MAX_ENUM = 45 +} VkFormatCompatibilityClass; + + static inline bool vk_format_is_undef(VkFormat format) { return (format == VK_FORMAT_UNDEFINED); @@ -51,14 +101,16 @@ static inline bool vk_format_is_color(VkFormat format) return !(vk_format_is_undef(format) || vk_format_is_depth_or_stencil(format)); } -bool vk_format_is_norm(VkFormat format); -bool vk_format_is_int(VkFormat format); -bool vk_format_is_sint(VkFormat format); -bool vk_format_is_uint(VkFormat format); -bool vk_format_is_float(VkFormat format); -bool vk_format_is_srgb(VkFormat format); -bool vk_format_is_compressed(VkFormat format); -size_t vk_format_get_size(VkFormat format); +bool vk_format_is_norm(VkFormat format); +bool vk_format_is_int(VkFormat format); +bool vk_format_is_sint(VkFormat format); +bool vk_format_is_uint(VkFormat format); +bool vk_format_is_float(VkFormat format); +bool vk_format_is_srgb(VkFormat format); +bool vk_format_is_compressed(VkFormat format); +size_t vk_format_get_size(VkFormat format); +unsigned int vk_format_get_channel_count(VkFormat format); +VkFormatCompatibilityClass vk_format_get_compatibility_class(VkFormat format); static inline int u_ffs(int val) { -- 2.7.4