blob: 38f2a5c921dec33233cc06112c55a519ce01ce37 [file] [log] [blame]
/*-------------------------------------------------------------------------
* Vulkan CTS Framework
* --------------------
*
* Copyright (c) 2015 The Khronos Group Inc.
* Copyright (c) 2015 Imagination Technologies Ltd.
* Copyright (c) 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*//*!
* \file
* \brief Utilities for images.
*//*--------------------------------------------------------------------*/
#include "vkImageUtil.hpp"
#include "vkRefUtil.hpp"
#include "vkQueryUtil.hpp"
#include "vkTypeUtil.hpp"
#include "vkCmdUtil.hpp"
#include "tcuTextureUtil.hpp"
#include "deMath.h"
namespace vk
{
bool isFloatFormat (VkFormat format)
{
return tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_FLOATING_POINT;
}
bool isUnormFormat (VkFormat format)
{
return tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
}
bool isSnormFormat (VkFormat format)
{
return tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT;
}
bool isIntFormat (VkFormat format)
{
return tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER;
}
bool isUintFormat (VkFormat format)
{
return tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
}
bool isDepthStencilFormat (VkFormat format)
{
if (isCompressedFormat(format))
return false;
if (isYCbCrFormat(format))
return false;
const tcu::TextureFormat tcuFormat = mapVkFormat(format);
return tcuFormat.order == tcu::TextureFormat::D || tcuFormat.order == tcu::TextureFormat::S || tcuFormat.order == tcu::TextureFormat::DS;
}
bool isSrgbFormat (VkFormat format)
{
switch (mapVkFormat(format).order)
{
case tcu::TextureFormat::sR:
case tcu::TextureFormat::sRG:
case tcu::TextureFormat::sRGB:
case tcu::TextureFormat::sRGBA:
case tcu::TextureFormat::sBGR:
case tcu::TextureFormat::sBGRA:
return true;
default:
return false;
}
}
bool isUfloatFormat (VkFormat format)
{
DE_STATIC_ASSERT(VK_CORE_FORMAT_LAST == 185);
switch (format)
{
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
case VK_FORMAT_BC6H_UFLOAT_BLOCK:
return true;
default:
return false;
}
}
bool isSfloatFormat (VkFormat format)
{
DE_STATIC_ASSERT(VK_CORE_FORMAT_LAST == 185);
switch (format)
{
case VK_FORMAT_R16_SFLOAT:
case VK_FORMAT_R16G16_SFLOAT:
case VK_FORMAT_R16G16B16_SFLOAT:
case VK_FORMAT_R16G16B16A16_SFLOAT:
case VK_FORMAT_R32_SFLOAT:
case VK_FORMAT_R32G32_SFLOAT:
case VK_FORMAT_R32G32B32_SFLOAT:
case VK_FORMAT_R32G32B32A32_SFLOAT:
case VK_FORMAT_R64_SFLOAT:
case VK_FORMAT_R64G64_SFLOAT:
case VK_FORMAT_R64G64B64_SFLOAT:
case VK_FORMAT_R64G64B64A64_SFLOAT:
case VK_FORMAT_D32_SFLOAT:
case VK_FORMAT_BC6H_SFLOAT_BLOCK:
return true;
default:
return false;
}
}
bool isCompressedFormat (VkFormat format)
{
// update this mapping if VkFormat changes
DE_STATIC_ASSERT(VK_CORE_FORMAT_LAST == 185);
switch (format)
{
case VK_FORMAT_BC1_RGB_UNORM_BLOCK:
case VK_FORMAT_BC1_RGB_SRGB_BLOCK:
case VK_FORMAT_BC1_RGBA_UNORM_BLOCK:
case VK_FORMAT_BC1_RGBA_SRGB_BLOCK:
case VK_FORMAT_BC2_UNORM_BLOCK:
case VK_FORMAT_BC2_SRGB_BLOCK:
case VK_FORMAT_BC3_UNORM_BLOCK:
case VK_FORMAT_BC3_SRGB_BLOCK:
case VK_FORMAT_BC4_UNORM_BLOCK:
case VK_FORMAT_BC4_SNORM_BLOCK:
case VK_FORMAT_BC5_UNORM_BLOCK:
case VK_FORMAT_BC5_SNORM_BLOCK:
case VK_FORMAT_BC6H_UFLOAT_BLOCK:
case VK_FORMAT_BC6H_SFLOAT_BLOCK:
case VK_FORMAT_BC7_UNORM_BLOCK:
case VK_FORMAT_BC7_SRGB_BLOCK:
case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:
case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:
case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:
case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
case VK_FORMAT_EAC_R11_UNORM_BLOCK:
case VK_FORMAT_EAC_R11_SNORM_BLOCK:
case VK_FORMAT_EAC_R11G11_UNORM_BLOCK:
case VK_FORMAT_EAC_R11G11_SNORM_BLOCK:
case VK_FORMAT_ASTC_4x4_UNORM_BLOCK:
case VK_FORMAT_ASTC_4x4_SRGB_BLOCK:
case VK_FORMAT_ASTC_5x4_UNORM_BLOCK:
case VK_FORMAT_ASTC_5x4_SRGB_BLOCK:
case VK_FORMAT_ASTC_5x5_UNORM_BLOCK:
case VK_FORMAT_ASTC_5x5_SRGB_BLOCK:
case VK_FORMAT_ASTC_6x5_UNORM_BLOCK:
case VK_FORMAT_ASTC_6x5_SRGB_BLOCK:
case VK_FORMAT_ASTC_6x6_UNORM_BLOCK:
case VK_FORMAT_ASTC_6x6_SRGB_BLOCK:
case VK_FORMAT_ASTC_8x5_UNORM_BLOCK:
case VK_FORMAT_ASTC_8x5_SRGB_BLOCK:
case VK_FORMAT_ASTC_8x6_UNORM_BLOCK:
case VK_FORMAT_ASTC_8x6_SRGB_BLOCK:
case VK_FORMAT_ASTC_8x8_UNORM_BLOCK:
case VK_FORMAT_ASTC_8x8_SRGB_BLOCK:
case VK_FORMAT_ASTC_10x5_UNORM_BLOCK:
case VK_FORMAT_ASTC_10x5_SRGB_BLOCK:
case VK_FORMAT_ASTC_10x6_UNORM_BLOCK:
case VK_FORMAT_ASTC_10x6_SRGB_BLOCK:
case VK_FORMAT_ASTC_10x8_UNORM_BLOCK:
case VK_FORMAT_ASTC_10x8_SRGB_BLOCK:
case VK_FORMAT_ASTC_10x10_UNORM_BLOCK:
case VK_FORMAT_ASTC_10x10_SRGB_BLOCK:
case VK_FORMAT_ASTC_12x10_UNORM_BLOCK:
case VK_FORMAT_ASTC_12x10_SRGB_BLOCK:
case VK_FORMAT_ASTC_12x12_UNORM_BLOCK:
case VK_FORMAT_ASTC_12x12_SRGB_BLOCK:
return true;
default:
return false;
}
}
bool isYCbCrFormat (VkFormat format)
{
switch (format)
{
case VK_FORMAT_G8B8G8R8_422_UNORM_KHR:
case VK_FORMAT_B8G8R8G8_422_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:
case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:
case VK_FORMAT_R10X6_UNORM_PACK16_KHR:
case VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR:
case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR:
case VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:
case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:
case VK_FORMAT_R12X4_UNORM_PACK16_KHR:
case VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR:
case VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR:
case VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:
case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:
case VK_FORMAT_G16B16G16R16_422_UNORM_KHR:
case VK_FORMAT_B16G16R16G16_422_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:
case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:
case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR:
return true;
default:
return false;
}
}
bool isYCbCr420Format (VkFormat format)
{
switch (format)
{
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:
case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:
return true;
default:
return false;
}
}
bool isYCbCr422Format (VkFormat format)
{
switch (format)
{
case VK_FORMAT_G8B8G8R8_422_UNORM_KHR:
case VK_FORMAT_B8G8R8G8_422_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:
case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:
case VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:
case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:
case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G16B16G16R16_422_UNORM_KHR:
case VK_FORMAT_B16G16R16G16_422_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:
case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:
return true;
default:
return false;
}
}
const PlanarFormatDescription& getYCbCrPlanarFormatDescription (VkFormat format)
{
using tcu::TextureFormat;
const deUint32 chanR = PlanarFormatDescription::CHANNEL_R;
const deUint32 chanG = PlanarFormatDescription::CHANNEL_G;
const deUint32 chanB = PlanarFormatDescription::CHANNEL_B;
const deUint32 chanA = PlanarFormatDescription::CHANNEL_A;
const deUint8 unorm = (deUint8)tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
static const PlanarFormatDescription s_formatInfo[] =
{
// VK_FORMAT_G8B8G8R8_422_UNORM_KHR
{
1, // planes
chanR|chanG|chanB,
2,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_G8B8G8R8_422_UNORM_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 24, 8, 4 }, // R
{ 0, unorm, 0, 8, 2 }, // G
{ 0, unorm, 8, 8, 4 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_B8G8R8G8_422_UNORM_KHR
{
1, // planes
chanR|chanG|chanB,
2,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_B8G8R8G8_422_UNORM_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 16, 8, 4 }, // R
{ 0, unorm, 8, 8, 2 }, // G
{ 0, unorm, 0, 8, 4 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_R8_UNORM },
{ 1, 2, 2, VK_FORMAT_R8_UNORM },
{ 1, 2, 2, VK_FORMAT_R8_UNORM },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 0, 8, 1 }, // R
{ 0, unorm, 0, 8, 1 }, // G
{ 1, unorm, 0, 8, 1 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR
{
2, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_R8_UNORM },
{ 2, 2, 2, VK_FORMAT_R8G8_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 1, unorm, 8, 8, 2 }, // R
{ 0, unorm, 0, 8, 1 }, // G
{ 1, unorm, 0, 8, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_R8_UNORM },
{ 1, 2, 1, VK_FORMAT_R8_UNORM },
{ 1, 2, 1, VK_FORMAT_R8_UNORM },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 0, 8, 1 }, // R
{ 0, unorm, 0, 8, 1 }, // G
{ 1, unorm, 0, 8, 1 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR
{
2, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_R8_UNORM },
{ 2, 2, 1, VK_FORMAT_R8G8_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 1, unorm, 8, 8, 2 }, // R
{ 0, unorm, 0, 8, 1 }, // G
{ 1, unorm, 0, 8, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_R8_UNORM },
{ 1, 1, 1, VK_FORMAT_R8_UNORM },
{ 1, 1, 1, VK_FORMAT_R8_UNORM },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 0, 8, 1 }, // R
{ 0, unorm, 0, 8, 1 }, // G
{ 1, unorm, 0, 8, 1 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_R10X6_UNORM_PACK16_KHR
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R10X6_UNORM_PACK16_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 6, 10, 2 }, // R
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
}
},
// VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR
{
1, // planes
chanR|chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 6, 10, 4 }, // R
{ 0, unorm, 22, 10, 4 }, // G
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
}
},
// VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 6, 10, 8 }, // R
{ 0, unorm, 22, 10, 8 }, // G
{ 0, unorm, 38, 10, 8 }, // B
{ 0, unorm, 54, 10, 8 }, // A
}
},
// VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR
{
1, // planes
chanR|chanG|chanB,
2,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 54, 10, 8 }, // R
{ 0, unorm, 6, 10, 4 }, // G
{ 0, unorm, 22, 10, 8 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR
{
1, // planes
chanR|chanG|chanB,
2,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 38, 10, 8 }, // R
{ 0, unorm, 22, 10, 4 }, // G
{ 0, unorm, 6, 10, 8 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R10X6_UNORM_PACK16 },
{ 2, 2, 2, VK_FORMAT_R10X6_UNORM_PACK16 },
{ 2, 2, 2, VK_FORMAT_R10X6_UNORM_PACK16 },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 6, 10, 2 }, // R
{ 0, unorm, 6, 10, 2 }, // G
{ 1, unorm, 6, 10, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR
{
2, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R10X6_UNORM_PACK16 },
{ 4, 2, 2, VK_FORMAT_R10X6G10X6_UNORM_2PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 1, unorm, 22, 10, 4 }, // R
{ 0, unorm, 6, 10, 2 }, // G
{ 1, unorm, 6, 10, 4 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R10X6_UNORM_PACK16 },
{ 2, 2, 1, VK_FORMAT_R10X6_UNORM_PACK16 },
{ 2, 2, 1, VK_FORMAT_R10X6_UNORM_PACK16 },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 6, 10, 2 }, // R
{ 0, unorm, 6, 10, 2 }, // G
{ 1, unorm, 6, 10, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR
{
2, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R10X6_UNORM_PACK16 },
{ 4, 2, 1, VK_FORMAT_R10X6G10X6_UNORM_2PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 1, unorm, 22, 10, 4 }, // R
{ 0, unorm, 6, 10, 2 }, // G
{ 1, unorm, 6, 10, 4 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R10X6_UNORM_PACK16 },
{ 2, 1, 1, VK_FORMAT_R10X6_UNORM_PACK16 },
{ 2, 1, 1, VK_FORMAT_R10X6_UNORM_PACK16 },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 6, 10, 2 }, // R
{ 0, unorm, 6, 10, 2 }, // G
{ 1, unorm, 6, 10, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_R12X4_UNORM_PACK16_KHR
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R12X4_UNORM_PACK16_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 4, 12, 2 }, // R
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
}
},
// VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR
{
1, // planes
chanR|chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 4, 12, 4 }, // R
{ 0, unorm, 20, 12, 4 }, // G
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
}
},
// VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 4, 12, 8 }, // R
{ 0, unorm, 20, 12, 8 }, // G
{ 0, unorm, 36, 12, 8 }, // B
{ 0, unorm, 52, 12, 8 }, // A
}
},
// VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR
{
1, // planes
chanR|chanG|chanB,
2,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 52, 12, 8 }, // R
{ 0, unorm, 4, 12, 4 }, // G
{ 0, unorm, 20, 12, 8 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR
{
1, // planes
chanR|chanG|chanB,
2,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 36, 12, 8 }, // R
{ 0, unorm, 20, 12, 4 }, // G
{ 0, unorm, 4, 12, 8 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R12X4_UNORM_PACK16 },
{ 2, 2, 2, VK_FORMAT_R12X4_UNORM_PACK16 },
{ 2, 2, 2, VK_FORMAT_R12X4_UNORM_PACK16 },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 4, 12, 2 }, // R
{ 0, unorm, 4, 12, 2 }, // G
{ 1, unorm, 4, 12, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR
{
2, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R12X4_UNORM_PACK16 },
{ 4, 2, 2, VK_FORMAT_R12X4G12X4_UNORM_2PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 1, unorm, 20, 12, 4 }, // R
{ 0, unorm, 4, 12, 2 }, // G
{ 1, unorm, 4, 12, 4 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R12X4_UNORM_PACK16 },
{ 2, 2, 1, VK_FORMAT_R12X4_UNORM_PACK16 },
{ 2, 2, 1, VK_FORMAT_R12X4_UNORM_PACK16 },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 4, 12, 2 }, // R
{ 0, unorm, 4, 12, 2 }, // G
{ 1, unorm, 4, 12, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR
{
2, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R12X4_UNORM_PACK16 },
{ 4, 2, 1, VK_FORMAT_R12X4G12X4_UNORM_2PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 1, unorm, 20, 12, 4 }, // R
{ 0, unorm, 4, 12, 2 }, // G
{ 1, unorm, 4, 12, 4 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R12X4_UNORM_PACK16 },
{ 2, 1, 1, VK_FORMAT_R12X4_UNORM_PACK16 },
{ 2, 1, 1, VK_FORMAT_R12X4_UNORM_PACK16 },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 4, 12, 2 }, // R
{ 0, unorm, 4, 12, 2 }, // G
{ 1, unorm, 4, 12, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G16B16G16R16_422_UNORM_KHR
{
1, // planes
chanR|chanG|chanB,
2,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_G16B16G16R16_422_UNORM_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 48, 16, 8 }, // R
{ 0, unorm, 0, 16, 4 }, // G
{ 0, unorm, 16, 16, 8 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_B16G16R16G16_422_UNORM_KHR
{
1, // planes
chanR|chanG|chanB,
2,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_B16G16R16G16_422_UNORM_KHR },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 32, 16, 8 }, // R
{ 0, unorm, 16, 16, 4 }, // G
{ 0, unorm, 0, 16, 8 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R16_UNORM },
{ 2, 2, 2, VK_FORMAT_R16_UNORM },
{ 2, 2, 2, VK_FORMAT_R16_UNORM },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 0, 16, 2 }, // R
{ 0, unorm, 0, 16, 2 }, // G
{ 1, unorm, 0, 16, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR
{
2, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R16_UNORM },
{ 4, 2, 2, VK_FORMAT_R16G16_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 1, unorm, 16, 16, 4 }, // R
{ 0, unorm, 0, 16, 2 }, // G
{ 1, unorm, 0, 16, 4 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R16_UNORM },
{ 2, 2, 1, VK_FORMAT_R16_UNORM },
{ 2, 2, 1, VK_FORMAT_R16_UNORM },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 0, 16, 2 }, // R
{ 0, unorm, 0, 16, 2 }, // G
{ 1, unorm, 0, 16, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR
{
2, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R16_UNORM },
{ 4, 2, 1, VK_FORMAT_R16G16_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 1, unorm, 16, 16, 4 }, // R
{ 0, unorm, 0, 16, 2 }, // G
{ 1, unorm, 0, 16, 4 }, // B
{ 0, 0, 0, 0, 0 }
}
},
// VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR
{
3, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R16_UNORM },
{ 2, 1, 1, VK_FORMAT_R16_UNORM },
{ 2, 1, 1, VK_FORMAT_R16_UNORM },
},
{
// Plane Type Offs Size Stride
{ 2, unorm, 0, 16, 2 }, // R
{ 0, unorm, 0, 16, 2 }, // G
{ 1, unorm, 0, 16, 2 }, // B
{ 0, 0, 0, 0, 0 }
}
},
};
const size_t offset = (size_t)VK_FORMAT_G8B8G8R8_422_UNORM_KHR;
DE_ASSERT(de::inBounds<size_t>((size_t)format, offset, offset+(size_t)DE_LENGTH_OF_ARRAY(s_formatInfo)));
return s_formatInfo[(size_t)format-offset];
}
PlanarFormatDescription getCorePlanarFormatDescription (VkFormat format)
{
const deUint8 snorm = (deUint8)tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT;
const deUint8 unorm = (deUint8)tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
const deUint8 sint = (deUint8)tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER;
const deUint8 uint = (deUint8)tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
const deUint8 sfloat = (deUint8)tcu::TEXTURECHANNELCLASS_FLOATING_POINT;
const deUint8 chanR = (deUint8)PlanarFormatDescription::CHANNEL_R;
const deUint8 chanG = (deUint8)PlanarFormatDescription::CHANNEL_G;
const deUint8 chanB = (deUint8)PlanarFormatDescription::CHANNEL_B;
const deUint8 chanA = (deUint8)PlanarFormatDescription::CHANNEL_A;
DE_ASSERT(de::inBounds<deUint32>(format, VK_FORMAT_UNDEFINED+1, VK_CORE_FORMAT_LAST));
#if (DE_ENDIANNESS != DE_LITTLE_ENDIAN)
# error "Big-endian is not supported"
#endif
switch (format)
{
case VK_FORMAT_R8_UNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_R8_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 8, 1 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R8_SNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_R8_SNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, snorm, 0, 8, 1 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R8G8_UNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R8G8_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 8, 2 }, // R
{ 0, unorm, 8, 8, 2 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R8G8_SNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R8G8_SNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, snorm, 0, 8, 2 }, // R
{ 0, snorm, 8, 8, 2 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R16_UNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R16_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 16, 2 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R16_SNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R16_SNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, snorm, 0, 16, 2 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R16G16_UNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R16G16_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 16, 4 }, // R
{ 0, unorm, 16, 16, 4 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R16G16_SNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R16G16_SNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, snorm, 0, 16, 4 }, // R
{ 0, snorm, 16, 16, 4 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_B10G11R11_UFLOAT_PACK32 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 11, 4 }, // R
{ 0, unorm, 11, 11, 4 }, // G
{ 0, unorm, 22, 10, 4 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R4G4_UNORM_PACK8:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_R4G4_UNORM_PACK8 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 4, 4, 1 }, // R
{ 0, unorm, 0, 4, 1 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R4G4B4A4_UNORM_PACK16:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R4G4B4A4_UNORM_PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 12, 4, 2 }, // R
{ 0, unorm, 8, 4, 2 }, // G
{ 0, unorm, 4, 4, 2 }, // B
{ 0, unorm, 0, 4, 2 } // A
}
};
return desc;
}
case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_B4G4R4A4_UNORM_PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 4, 4, 2 }, // R
{ 0, unorm, 8, 4, 2 }, // G
{ 0, unorm, 12, 4, 2 }, // B
{ 0, unorm, 0, 4, 2 } // A
}
};
return desc;
}
case VK_FORMAT_R5G6B5_UNORM_PACK16:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R5G6B5_UNORM_PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 11, 5, 2 }, // R
{ 0, unorm, 5, 6, 2 }, // G
{ 0, unorm, 0, 5, 2 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_B5G6R5_UNORM_PACK16:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_B5G6R5_UNORM_PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 5, 2 }, // R
{ 0, unorm, 5, 6, 2 }, // G
{ 0, unorm, 11, 5, 2 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R5G5B5A1_UNORM_PACK16:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R5G5B5A1_UNORM_PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 11, 5, 2 }, // R
{ 0, unorm, 6, 5, 2 }, // G
{ 0, unorm, 1, 5, 2 }, // B
{ 0, unorm, 0, 1, 2 } // A
}
};
return desc;
}
case VK_FORMAT_B5G5R5A1_UNORM_PACK16:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_B5G5R5A1_UNORM_PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 1, 5, 2 }, // R
{ 0, unorm, 6, 5, 2 }, // G
{ 0, unorm, 11, 5, 2 }, // B
{ 0, unorm, 0, 1, 2 } // A
}
};
return desc;
}
case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_A1R5G5B5_UNORM_PACK16 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 10, 5, 2 }, // R
{ 0, unorm, 5, 5, 2 }, // G
{ 0, unorm, 0, 5, 2 }, // B
{ 0, unorm, 15, 1, 2 } // A
}
};
return desc;
}
case VK_FORMAT_R8G8B8_UNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 3, 1, 1, VK_FORMAT_R8G8B8_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 8, 3 }, // R
{ 0, unorm, 8, 8, 3 }, // G
{ 0, unorm, 16, 8, 3 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_B8G8R8_UNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 3, 1, 1, VK_FORMAT_B8G8R8_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 16, 8, 3 }, // R
{ 0, unorm, 8, 8, 3 }, // G
{ 0, unorm, 0, 8, 3 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R8G8B8A8_UNORM:
case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R8G8B8A8_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 8, 4 }, // R
{ 0, unorm, 8, 8, 4 }, // G
{ 0, unorm, 16, 8, 4 }, // B
{ 0, unorm, 24, 8, 4 } // A
}
};
return desc;
}
case VK_FORMAT_B8G8R8A8_UNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_B8G8R8A8_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 16, 8, 4 }, // R
{ 0, unorm, 8, 8, 4 }, // G
{ 0, unorm, 0, 8, 4 }, // B
{ 0, unorm, 24, 8, 4 } // A
}
};
return desc;
}
case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_A2R10G10B10_UNORM_PACK32 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 20, 10, 4 }, // R
{ 0, unorm, 10, 10, 4 }, // G
{ 0, unorm, 0, 10, 4 }, // B
{ 0, unorm, 30, 2, 4 } // A
}
};
return desc;
}
case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_A2B10G10R10_UNORM_PACK32 },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 10, 4 }, // R
{ 0, unorm, 10, 10, 4 }, // G
{ 0, unorm, 20, 10, 4 }, // B
{ 0, unorm, 30, 2, 4 } // A
}
};
return desc;
}
case VK_FORMAT_R16G16B16_UNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 6, 1, 1, VK_FORMAT_R16G16B16_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 16, 6 }, // R
{ 0, unorm, 16, 16, 6 }, // G
{ 0, unorm, 32, 16, 6 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R16G16B16A16_UNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_R16G16B16A16_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 16, 8 }, // R
{ 0, unorm, 16, 16, 8 }, // G
{ 0, unorm, 32, 16, 8 }, // B
{ 0, unorm, 48, 16, 8 } // A
}
};
return desc;
}
case VK_FORMAT_R8_SINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_R8_SINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sint, 0, 8, 1 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R16_SINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R16_SINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sint, 0, 16, 2 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R32_SINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R32_SINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sint, 0, 32, 4 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R8G8_SINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R8G8_SINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sint, 0, 8, 2 }, // R
{ 0, sint, 8, 8, 2 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R16G16_SINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R16G16_SINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sint, 0, 16, 4 }, // R
{ 0, sint, 16, 16, 4 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R32G32_SINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_R32G32_SINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sint, 0, 32, 8 }, // R
{ 0, sint, 32, 32, 8 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R8G8B8A8_SINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG | chanB | chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R8G8B8A8_SINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sint, 0, 8, 4 }, // R
{ 0, sint, 8, 8, 4 }, // G
{ 0, sint, 16, 8, 4 }, // B
{ 0, sint, 24, 8, 4 } // A
}
};
return desc;
}
case VK_FORMAT_R16G16B16A16_SINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG | chanB | chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_R16G16B16A16_SINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sint, 0, 16, 8 }, // R
{ 0, sint, 16, 16, 8 }, // G
{ 0, sint, 32, 16, 8 }, // B
{ 0, sint, 48, 16, 8 } // A
}
};
return desc;
}
case VK_FORMAT_R32G32B32A32_SINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG | chanB | chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 16, 1, 1, VK_FORMAT_R32G32B32A32_SINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sint, 0, 32, 16 }, // R
{ 0, sint, 32, 32, 16 }, // G
{ 0, sint, 64, 32, 16 }, // B
{ 0, sint, 96, 32, 16 } // A
}
};
return desc;
}
case VK_FORMAT_R8_UINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_R8_UINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, uint, 0, 8, 1 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R16_UINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R16_UINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, uint, 0, 16, 2 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R32_UINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R32_UINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, uint, 0, 32, 4 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R8G8_UINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_R8G8_UINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, uint, 0, 8, 2 }, // R
{ 0, uint, 8, 8, 2 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R16G16_UINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R16G16_UINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, uint, 0, 16, 4 }, // R
{ 0, uint, 16, 16, 4 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R32G32_UINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_R32G32_UINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, uint, 0, 32, 8 }, // R
{ 0, uint, 32, 32, 8 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R8G8B8A8_UINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG | chanB | chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R8G8B8A8_UINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, uint, 0, 8, 4 }, // R
{ 0, uint, 8, 8, 4 }, // G
{ 0, uint, 16, 8, 4 }, // B
{ 0, uint, 24, 8, 4 } // A
}
};
return desc;
}
case VK_FORMAT_R16G16B16A16_UINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG | chanB | chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_R16G16B16A16_UINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, uint, 0, 16, 8 }, // R
{ 0, uint, 16, 16, 8 }, // G
{ 0, uint, 32, 16, 8 }, // B
{ 0, uint, 48, 16, 8 } // A
}
};
return desc;
}
case VK_FORMAT_R32G32B32A32_UINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG | chanB | chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 16, 1, 1, VK_FORMAT_R32G32B32A32_UINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, uint, 0, 32, 16 }, // R
{ 0, uint, 32, 32, 16 }, // G
{ 0, uint, 64, 32, 16 }, // B
{ 0, uint, 96, 32, 16 } // A
}
};
return desc;
}
case VK_FORMAT_R8G8B8A8_SNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG | chanB | chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R8G8B8A8_SNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, snorm, 0, 8, 4 }, // R
{ 0, snorm, 8, 8, 4 }, // G
{ 0, snorm, 16, 8, 4 }, // B
{ 0, snorm, 24, 8, 4 } // A
}
};
return desc;
}
case VK_FORMAT_R16G16B16A16_SNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR | chanG | chanB | chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 8, 1, 1, VK_FORMAT_R16G16B16A16_SNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, snorm, 0, 16, 8 }, // R
{ 0, snorm, 16, 16, 8 }, // G
{ 0, snorm, 32, 16, 8 }, // B
{ 0, snorm, 48, 16, 8 } // A
}
};
return desc;
}
case VK_FORMAT_R32_SFLOAT:
case VK_FORMAT_D32_SFLOAT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 4, 1, 1, VK_FORMAT_R32_SFLOAT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sfloat, 0, 32, 4 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_D16_UNORM:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 2, 1, 1, VK_FORMAT_D16_UNORM },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, unorm, 0, 16, 2 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_S8_UINT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 1, 1, 1, VK_FORMAT_S8_UINT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED},
},
{
// Plane Type Offs Size Stride
{ 0, uint, 0, 8, 1 }, // R
{ 0, 0, 0, 0, 0 }, // G
{ 0, 0, 0, 0, 0 }, // B
{ 0, 0, 0, 0, 0 } // A
}
};
return desc;
}
case VK_FORMAT_R32G32B32A32_SFLOAT:
{
const PlanarFormatDescription desc =
{
1, // planes
chanR|chanG|chanB|chanA,
1,1,
{
// Size WDiv HDiv planeCompatibleFormat
{ 16, 1, 1, VK_FORMAT_R32G32B32A32_SFLOAT },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
{ 0, 0, 0, VK_FORMAT_UNDEFINED },
},
{
// Plane Type Offs Size Stride
{ 0, sfloat, 0, 32, 16 }, // R
{ 0, sfloat, 32, 32, 16 }, // G
{ 0, sfloat, 64, 32, 16 }, // B
{ 0, sfloat, 96, 32, 16 }, // A
}
};
return desc;
}
default:
TCU_THROW(InternalError, "Not implemented");
}
}
PlanarFormatDescription getPlanarFormatDescription (VkFormat format)
{
if (isYCbCrFormat(format))
return getYCbCrPlanarFormatDescription(format);
else
return getCorePlanarFormatDescription(format);
}
int getPlaneCount (VkFormat format)
{
switch (format)
{
case VK_FORMAT_G8B8G8R8_422_UNORM_KHR:
case VK_FORMAT_B8G8R8G8_422_UNORM_KHR:
case VK_FORMAT_R10X6_UNORM_PACK16_KHR:
case VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR:
case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR:
case VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:
case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:
case VK_FORMAT_R12X4_UNORM_PACK16_KHR:
case VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR:
case VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR:
case VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:
case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:
case VK_FORMAT_G16B16G16R16_422_UNORM_KHR:
case VK_FORMAT_B16G16R16G16_422_UNORM_KHR:
return 1;
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:
case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:
case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:
return 2;
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR:
return 3;
default:
DE_FATAL("Not YCbCr format");
return 0;
}
}
deUint32 getMipmapCount(VkFormat format, const vk::PlanarFormatDescription& formatDescription, const VkImageFormatProperties& imageFormatProperties, const VkExtent3D& extent)
{
if (isYCbCrFormat(format))
return 1;
tcu::UVec3 imageAlignment = getImageSizeAlignment(formatDescription);
deUint32 mipmapEdge = std::max(std::max(extent.width, extent.height), extent.depth);
if (imageAlignment.x() > 1)
mipmapEdge = std::min(mipmapEdge, extent.width / imageAlignment.x());
if (imageAlignment.y() > 1)
mipmapEdge = std::min(mipmapEdge, extent.height / imageAlignment.y());
if (imageAlignment.z() > 1)
mipmapEdge = std::min(mipmapEdge, extent.depth / imageAlignment.z());
return std::min(static_cast<deUint32>(deFloatLog2(static_cast<float>(mipmapEdge))) + 1u, imageFormatProperties.maxMipLevels);
}
deUint32 getPlaneSizeInBytes (const PlanarFormatDescription& formatInfo,
const VkExtent3D& baseExtents,
const deUint32 planeNdx,
const deUint32 mipmapLevel,
const deUint32 mipmapMemoryAlignment)
{
VkExtent3D imageExtent = getPlaneExtent(formatInfo, baseExtents, planeNdx, mipmapLevel);
imageExtent.width /= formatInfo.blockWidth;
imageExtent.height /= formatInfo.blockHeight;
return deAlign32( formatInfo.planes[planeNdx].elementSizeBytes * imageExtent.width * imageExtent.height * imageExtent.depth, mipmapMemoryAlignment);
}
deUint32 getPlaneSizeInBytes (const PlanarFormatDescription& formatInfo,
const tcu::UVec2& baseExtents,
const deUint32 planeNdx,
const deUint32 mipmapLevel,
const deUint32 mipmapMemoryAlignment)
{
tcu::UVec2 mipExtents = getPlaneExtent(formatInfo, baseExtents, planeNdx, mipmapLevel) / tcu::UVec2(formatInfo.blockWidth, formatInfo.blockHeight);
return deAlign32( formatInfo.planes[planeNdx].elementSizeBytes * mipExtents.x() * mipExtents.y(), mipmapMemoryAlignment);
}
VkExtent3D getPlaneExtent(const PlanarFormatDescription& formatInfo,
const VkExtent3D& baseExtents,
const deUint32 planeNdx,
const deUint32 mipmapLevel)
{
deUint32 widthDivisor = formatInfo.planes[planeNdx].widthDivisor;
deUint32 heightDivisor = formatInfo.planes[planeNdx].heightDivisor;
deUint32 depthDivisor = 1u;
VkExtent3D mip0Extents { baseExtents.width / widthDivisor, baseExtents.height / heightDivisor, baseExtents.depth / depthDivisor };
return mipLevelExtents(mip0Extents, mipmapLevel);
}
tcu::UVec2 getPlaneExtent(const PlanarFormatDescription& formatInfo,
const tcu::UVec2& baseExtents,
const deUint32 planeNdx,
const deUint32 mipmapLevel)
{
deUint32 widthDivisor = formatInfo.planes[planeNdx].widthDivisor;
deUint32 heightDivisor = formatInfo.planes[planeNdx].heightDivisor;
tcu::UVec2 mip0Extents { baseExtents.x() / widthDivisor, baseExtents.y() / heightDivisor };
return tcu::UVec2
{
std::max(mip0Extents.x() >> mipmapLevel, 1u),
std::max(mip0Extents.y() >> mipmapLevel, 1u)
};
}
tcu::UVec3 getImageSizeAlignment(VkFormat format)
{
return getImageSizeAlignment(getPlanarFormatDescription(format));
}
tcu::UVec3 getImageSizeAlignment(const PlanarFormatDescription& formatInfo)
{
tcu::UVec3 imgAlignment{ formatInfo.blockWidth, formatInfo.blockHeight, 1 };
for (deUint32 planeNdx = 0; planeNdx < formatInfo.numPlanes; ++planeNdx)
{
imgAlignment.x() = std::max(imgAlignment.x(), static_cast<deUint32>(formatInfo.planes[planeNdx].widthDivisor));
imgAlignment.y() = std::max(imgAlignment.y(), static_cast<deUint32>(formatInfo.planes[planeNdx].heightDivisor));
}
return imgAlignment;
}
tcu::UVec2 getBlockExtent(VkFormat format)
{
return getBlockExtent(getPlanarFormatDescription(format));
}
tcu::UVec2 getBlockExtent(const PlanarFormatDescription& formatInfo)
{
return tcu::UVec2{ formatInfo.blockWidth, formatInfo.blockHeight };
}
VkFormat getPlaneCompatibleFormat(VkFormat format, deUint32 planeNdx)
{
return getPlaneCompatibleFormat(getPlanarFormatDescription(format), planeNdx);
}
VkFormat getPlaneCompatibleFormat(const PlanarFormatDescription& formatInfo, deUint32 planeNdx)
{
DE_ASSERT(planeNdx < formatInfo.numPlanes);
return formatInfo.planes[planeNdx].planeCompatibleFormat;
}
VkImageAspectFlagBits getPlaneAspect (deUint32 planeNdx)
{
DE_ASSERT(de::inBounds(planeNdx, 0u, 3u));
return (VkImageAspectFlagBits)(VK_IMAGE_ASPECT_PLANE_0_BIT_KHR << planeNdx);
}
deUint32 getAspectPlaneNdx (VkImageAspectFlagBits flags)
{
switch (flags)
{
case VK_IMAGE_ASPECT_PLANE_0_BIT_KHR: return 0;
case VK_IMAGE_ASPECT_PLANE_1_BIT_KHR: return 1;
case VK_IMAGE_ASPECT_PLANE_2_BIT_KHR: return 2;
default:
DE_FATAL("Invalid plane aspect");
return 0;
}
}
bool isChromaSubsampled (VkFormat format)
{
switch (format)
{
case VK_FORMAT_G8B8G8R8_422_UNORM_KHR:
case VK_FORMAT_B8G8R8G8_422_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:
case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:
case VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:
case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:
case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:
case VK_FORMAT_G16B16G16R16_422_UNORM_KHR:
case VK_FORMAT_B16G16R16G16_422_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:
case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:
case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR:
return true;
default:
return false;
}
}
bool isSupportedByFramework (VkFormat format)
{
if (format == VK_FORMAT_UNDEFINED || format > VK_CORE_FORMAT_LAST)
return false;
switch (format)
{
case VK_FORMAT_R64_UINT:
case VK_FORMAT_R64_SINT:
case VK_FORMAT_R64_SFLOAT:
case VK_FORMAT_R64G64_UINT:
case VK_FORMAT_R64G64_SINT:
case VK_FORMAT_R64G64_SFLOAT:
case VK_FORMAT_R64G64B64_UINT:
case VK_FORMAT_R64G64B64_SINT:
case VK_FORMAT_R64G64B64_SFLOAT:
case VK_FORMAT_R64G64B64A64_UINT:
case VK_FORMAT_R64G64B64A64_SINT:
case VK_FORMAT_R64G64B64A64_SFLOAT:
// \todo [2016-12-01 pyry] Support 64-bit channel types
return false;
case VK_FORMAT_BC1_RGB_UNORM_BLOCK:
case VK_FORMAT_BC1_RGB_SRGB_BLOCK:
case VK_FORMAT_BC1_RGBA_UNORM_BLOCK:
case VK_FORMAT_BC1_RGBA_SRGB_BLOCK:
case VK_FORMAT_BC2_UNORM_BLOCK:
case VK_FORMAT_BC2_SRGB_BLOCK:
case VK_FORMAT_BC3_UNORM_BLOCK:
case VK_FORMAT_BC3_SRGB_BLOCK:
case VK_FORMAT_BC4_UNORM_BLOCK:
case VK_FORMAT_BC4_SNORM_BLOCK:
case VK_FORMAT_BC5_UNORM_BLOCK:
case VK_FORMAT_BC5_SNORM_BLOCK:
case VK_FORMAT_BC6H_UFLOAT_BLOCK:
case VK_FORMAT_BC6H_SFLOAT_BLOCK:
case VK_FORMAT_BC7_UNORM_BLOCK:
case VK_FORMAT_BC7_SRGB_BLOCK:
return false;
default:
return true;
}
}
void checkImageSupport (const InstanceInterface& vki, VkPhysicalDevice physicalDevice, const VkImageCreateInfo& imageCreateInfo)
{
VkImageFormatProperties imageFormatProperties;
if (vki.getPhysicalDeviceImageFormatProperties(physicalDevice, imageCreateInfo.format, imageCreateInfo.imageType,
imageCreateInfo.tiling, imageCreateInfo.usage, imageCreateInfo.flags,
&imageFormatProperties))
{
TCU_THROW(NotSupportedError, "Image format not supported.");
}
if (((VkSampleCountFlagBits)imageFormatProperties.sampleCounts & imageCreateInfo.samples) == 0)
{
TCU_THROW(NotSupportedError, "Sample count not supported.");
}
if (imageFormatProperties.maxArrayLayers < imageCreateInfo.arrayLayers)
{
TCU_THROW(NotSupportedError, "Layer count not supported.");
}
}
VkFormat mapTextureFormat (const tcu::TextureFormat& format)
{
DE_STATIC_ASSERT(tcu::TextureFormat::CHANNELORDER_LAST < (1<<16));
DE_STATIC_ASSERT(tcu::TextureFormat::CHANNELTYPE_LAST < (1<<16));
#define PACK_FMT(ORDER, TYPE) ((int(ORDER) << 16) | int(TYPE))
#define FMT_CASE(ORDER, TYPE) PACK_FMT(tcu::TextureFormat::ORDER, tcu::TextureFormat::TYPE)
// update this mapping if VkFormat changes
DE_STATIC_ASSERT(VK_CORE_FORMAT_LAST == 185);
switch (PACK_FMT(format.order, format.type))
{
case FMT_CASE(RG, UNORM_BYTE_44): return VK_FORMAT_R4G4_UNORM_PACK8;
case FMT_CASE(RGB, UNORM_SHORT_565): return VK_FORMAT_R5G6B5_UNORM_PACK16;
case FMT_CASE(RGBA, UNORM_SHORT_4444): return VK_FORMAT_R4G4B4A4_UNORM_PACK16;
case FMT_CASE(RGBA, UNORM_SHORT_5551): return VK_FORMAT_R5G5B5A1_UNORM_PACK16;
case FMT_CASE(BGR, UNORM_SHORT_565): return VK_FORMAT_B5G6R5_UNORM_PACK16;
case FMT_CASE(BGRA, UNORM_SHORT_4444): return VK_FORMAT_B4G4R4A4_UNORM_PACK16;
case FMT_CASE(BGRA, UNORM_SHORT_5551): return VK_FORMAT_B5G5R5A1_UNORM_PACK16;
case FMT_CASE(ARGB, UNORM_SHORT_1555): return VK_FORMAT_A1R5G5B5_UNORM_PACK16;
case FMT_CASE(R, UNORM_INT8): return VK_FORMAT_R8_UNORM;
case FMT_CASE(R, SNORM_INT8): return VK_FORMAT_R8_SNORM;
case FMT_CASE(R, UNSIGNED_INT8): return VK_FORMAT_R8_UINT;
case FMT_CASE(R, SIGNED_INT8): return VK_FORMAT_R8_SINT;
case FMT_CASE(sR, UNORM_INT8): return VK_FORMAT_R8_SRGB;
case FMT_CASE(RG, UNORM_INT8): return VK_FORMAT_R8G8_UNORM;
case FMT_CASE(RG, SNORM_INT8): return VK_FORMAT_R8G8_SNORM;
case FMT_CASE(RG, UNSIGNED_INT8): return VK_FORMAT_R8G8_UINT;
case FMT_CASE(RG, SIGNED_INT8): return VK_FORMAT_R8G8_SINT;
case FMT_CASE(sRG, UNORM_INT8): return VK_FORMAT_R8G8_SRGB;
case FMT_CASE(RGB, UNORM_INT8): return VK_FORMAT_R8G8B8_UNORM;
case FMT_CASE(RGB, SNORM_INT8): return VK_FORMAT_R8G8B8_SNORM;
case FMT_CASE(RGB, UNSIGNED_INT8): return VK_FORMAT_R8G8B8_UINT;
case FMT_CASE(RGB, SIGNED_INT8): return VK_FORMAT_R8G8B8_SINT;
case FMT_CASE(sRGB, UNORM_INT8): return VK_FORMAT_R8G8B8_SRGB;
case FMT_CASE(RGBA, UNORM_INT8): return VK_FORMAT_R8G8B8A8_UNORM;
case FMT_CASE(RGBA, SNORM_INT8): return VK_FORMAT_R8G8B8A8_SNORM;
case FMT_CASE(RGBA, UNSIGNED_INT8): return VK_FORMAT_R8G8B8A8_UINT;
case FMT_CASE(RGBA, SIGNED_INT8): return VK_FORMAT_R8G8B8A8_SINT;
case FMT_CASE(sRGBA, UNORM_INT8): return VK_FORMAT_R8G8B8A8_SRGB;
case FMT_CASE(RGBA, UNORM_INT_1010102_REV): return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
case FMT_CASE(RGBA, SNORM_INT_1010102_REV): return VK_FORMAT_A2B10G10R10_SNORM_PACK32;
case FMT_CASE(RGBA, UNSIGNED_INT_1010102_REV): return VK_FORMAT_A2B10G10R10_UINT_PACK32;
case FMT_CASE(RGBA, SIGNED_INT_1010102_REV): return VK_FORMAT_A2B10G10R10_SINT_PACK32;
case FMT_CASE(R, UNORM_INT16): return VK_FORMAT_R16_UNORM;
case FMT_CASE(R, SNORM_INT16): return VK_FORMAT_R16_SNORM;
case FMT_CASE(R, UNSIGNED_INT16): return VK_FORMAT_R16_UINT;
case FMT_CASE(R, SIGNED_INT16): return VK_FORMAT_R16_SINT;
case FMT_CASE(R, HALF_FLOAT): return VK_FORMAT_R16_SFLOAT;
case FMT_CASE(RG, UNORM_INT16): return VK_FORMAT_R16G16_UNORM;
case FMT_CASE(RG, SNORM_INT16): return VK_FORMAT_R16G16_SNORM;
case FMT_CASE(RG, UNSIGNED_INT16): return VK_FORMAT_R16G16_UINT;
case FMT_CASE(RG, SIGNED_INT16): return VK_FORMAT_R16G16_SINT;
case FMT_CASE(RG, HALF_FLOAT): return VK_FORMAT_R16G16_SFLOAT;
case FMT_CASE(RGB, UNORM_INT16): return VK_FORMAT_R16G16B16_UNORM;
case FMT_CASE(RGB, SNORM_INT16): return VK_FORMAT_R16G16B16_SNORM;
case FMT_CASE(RGB, UNSIGNED_INT16): return VK_FORMAT_R16G16B16_UINT;
case FMT_CASE(RGB, SIGNED_INT16): return VK_FORMAT_R16G16B16_SINT;
case FMT_CASE(RGB, HALF_FLOAT): return VK_FORMAT_R16G16B16_SFLOAT;
case FMT_CASE(RGBA, UNORM_INT16): return VK_FORMAT_R16G16B16A16_UNORM;
case FMT_CASE(RGBA, SNORM_INT16): return VK_FORMAT_R16G16B16A16_SNORM;
case FMT_CASE(RGBA, UNSIGNED_INT16): return VK_FORMAT_R16G16B16A16_UINT;
case FMT_CASE(RGBA, SIGNED_INT16): return VK_FORMAT_R16G16B16A16_SINT;
case FMT_CASE(RGBA, HALF_FLOAT): return VK_FORMAT_R16G16B16A16_SFLOAT;
case FMT_CASE(R, UNSIGNED_INT32): return VK_FORMAT_R32_UINT;
case FMT_CASE(R, SIGNED_INT32): return VK_FORMAT_R32_SINT;
case FMT_CASE(R, FLOAT): return VK_FORMAT_R32_SFLOAT;
case FMT_CASE(RG, UNSIGNED_INT32): return VK_FORMAT_R32G32_UINT;
case FMT_CASE(RG, SIGNED_INT32): return VK_FORMAT_R32G32_SINT;
case FMT_CASE(RG, FLOAT): return VK_FORMAT_R32G32_SFLOAT;
case FMT_CASE(RGB, UNSIGNED_INT32): return VK_FORMAT_R32G32B32_UINT;
case FMT_CASE(RGB, SIGNED_INT32): return VK_FORMAT_R32G32B32_SINT;
case FMT_CASE(RGB, FLOAT): return VK_FORMAT_R32G32B32_SFLOAT;
case FMT_CASE(RGBA, UNSIGNED_INT32): return VK_FORMAT_R32G32B32A32_UINT;
case FMT_CASE(RGBA, SIGNED_INT32): return VK_FORMAT_R32G32B32A32_SINT;
case FMT_CASE(RGBA, FLOAT): return VK_FORMAT_R32G32B32A32_SFLOAT;
case FMT_CASE(R, FLOAT64): return VK_FORMAT_R64_SFLOAT;
case FMT_CASE(RG, FLOAT64): return VK_FORMAT_R64G64_SFLOAT;
case FMT_CASE(RGB, FLOAT64): return VK_FORMAT_R64G64B64_SFLOAT;
case FMT_CASE(RGBA, FLOAT64): return VK_FORMAT_R64G64B64A64_SFLOAT;
case FMT_CASE(RGB, UNSIGNED_INT_11F_11F_10F_REV): return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
case FMT_CASE(RGB, UNSIGNED_INT_999_E5_REV): return VK_FORMAT_E5B9G9R9_UFLOAT_PACK32;
case FMT_CASE(BGR, UNORM_INT8): return VK_FORMAT_B8G8R8_UNORM;
case FMT_CASE(BGR, SNORM_INT8): return VK_FORMAT_B8G8R8_SNORM;
case FMT_CASE(BGR, UNSIGNED_INT8): return VK_FORMAT_B8G8R8_UINT;
case FMT_CASE(BGR, SIGNED_INT8): return VK_FORMAT_B8G8R8_SINT;
case FMT_CASE(sBGR, UNORM_INT8): return VK_FORMAT_B8G8R8_SRGB;
case FMT_CASE(BGRA, UNORM_INT8): return VK_FORMAT_B8G8R8A8_UNORM;
case FMT_CASE(BGRA, SNORM_INT8): return VK_FORMAT_B8G8R8A8_SNORM;
case FMT_CASE(BGRA, UNSIGNED_INT8): return VK_FORMAT_B8G8R8A8_UINT;
case FMT_CASE(BGRA, SIGNED_INT8): return VK_FORMAT_B8G8R8A8_SINT;
case FMT_CASE(sBGRA, UNORM_INT8): return VK_FORMAT_B8G8R8A8_SRGB;
case FMT_CASE(BGRA, UNORM_INT_1010102_REV): return VK_FORMAT_A2R10G10B10_UNORM_PACK32;
case FMT_CASE(BGRA, SNORM_INT_1010102_REV): return VK_FORMAT_A2R10G10B10_SNORM_PACK32;
case FMT_CASE(BGRA, UNSIGNED_INT_1010102_REV): return VK_FORMAT_A2R10G10B10_UINT_PACK32;
case FMT_CASE(BGRA, SIGNED_INT_1010102_REV): return VK_FORMAT_A2R10G10B10_SINT_PACK32;
case FMT_CASE(D, UNORM_INT16): return VK_FORMAT_D16_UNORM;
case FMT_CASE(D, UNSIGNED_INT_24_8_REV): return VK_FORMAT_X8_D24_UNORM_PACK32;
case FMT_CASE(D, FLOAT): return VK_FORMAT_D32_SFLOAT;
case FMT_CASE(S, UNSIGNED_INT8): return VK_FORMAT_S8_UINT;
case FMT_CASE(DS, UNSIGNED_INT_16_8_8): return VK_FORMAT_D16_UNORM_S8_UINT;
case FMT_CASE(DS, UNSIGNED_INT_24_8_REV): return VK_FORMAT_D24_UNORM_S8_UINT;
case FMT_CASE(DS, FLOAT_UNSIGNED_INT_24_8_REV): return VK_FORMAT_D32_SFLOAT_S8_UINT;
case FMT_CASE(R, UNORM_SHORT_10): return VK_FORMAT_R10X6_UNORM_PACK16_KHR;
case FMT_CASE(RG, UNORM_SHORT_10): return VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR;
case FMT_CASE(RGBA, UNORM_SHORT_10): return VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR;
case FMT_CASE(R, UNORM_SHORT_12): return VK_FORMAT_R12X4_UNORM_PACK16_KHR;
case FMT_CASE(RG, UNORM_SHORT_12): return VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR;
case FMT_CASE(RGBA, UNORM_SHORT_12): return VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR;
case FMT_CASE(R, USCALED_INT8): return VK_FORMAT_R8_USCALED;
case FMT_CASE(RG, USCALED_INT8): return VK_FORMAT_R8G8_USCALED;
case FMT_CASE(RGB, USCALED_INT8): return VK_FORMAT_R8G8B8_USCALED;
case FMT_CASE(RGBA, USCALED_INT8): return VK_FORMAT_R8G8B8A8_USCALED;
case FMT_CASE(R, USCALED_INT16): return VK_FORMAT_R16_USCALED;
case FMT_CASE(RG, USCALED_INT16): return VK_FORMAT_R16G16_USCALED;
case FMT_CASE(RGB, USCALED_INT16): return VK_FORMAT_R16G16B16_USCALED;
case FMT_CASE(RGBA, USCALED_INT16): return VK_FORMAT_R16G16B16A16_USCALED;
case FMT_CASE(R, SSCALED_INT8): return VK_FORMAT_R8_SSCALED;
case FMT_CASE(RG, SSCALED_INT8): return VK_FORMAT_R8G8_SSCALED;
case FMT_CASE(RGB, SSCALED_INT8): return VK_FORMAT_R8G8B8_SSCALED;
case FMT_CASE(RGBA, SSCALED_INT8): return VK_FORMAT_R8G8B8A8_SSCALED;
case FMT_CASE(R, SSCALED_INT16): return VK_FORMAT_R16_SSCALED;
case FMT_CASE(RG, SSCALED_INT16): return VK_FORMAT_R16G16_SSCALED;
case FMT_CASE(RGB, SSCALED_INT16): return VK_FORMAT_R16G16B16_SSCALED;
case FMT_CASE(RGBA, SSCALED_INT16): return VK_FORMAT_R16G16B16A16_SSCALED;
case FMT_CASE(RGBA, USCALED_INT_1010102_REV): return VK_FORMAT_A2B10G10R10_USCALED_PACK32;
case FMT_CASE(RGBA, SSCALED_INT_1010102_REV): return VK_FORMAT_A2B10G10R10_SSCALED_PACK32;
default:
TCU_THROW(InternalError, "Unknown texture format");
}
#undef PACK_FMT
#undef FMT_CASE
}
VkFormat mapCompressedTextureFormat (const tcu::CompressedTexFormat format)
{
// update this mapping if CompressedTexFormat changes
DE_STATIC_ASSERT(tcu::COMPRESSEDTEXFORMAT_LAST == 55);
switch (format)
{
case tcu::COMPRESSEDTEXFORMAT_ETC2_RGB8: return VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ETC2_SRGB8: return VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1: return VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: return VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ETC2_EAC_RGBA8: return VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ETC2_EAC_SRGB8_ALPHA8: return VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_EAC_R11: return VK_FORMAT_EAC_R11_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_EAC_SIGNED_R11: return VK_FORMAT_EAC_R11_SNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_EAC_RG11: return VK_FORMAT_EAC_R11G11_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_EAC_SIGNED_RG11: return VK_FORMAT_EAC_R11G11_SNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_4x4_RGBA: return VK_FORMAT_ASTC_4x4_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_4x4_SRGB8_ALPHA8: return VK_FORMAT_ASTC_4x4_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_5x4_RGBA: return VK_FORMAT_ASTC_5x4_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_5x4_SRGB8_ALPHA8: return VK_FORMAT_ASTC_5x4_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_5x5_RGBA: return VK_FORMAT_ASTC_5x5_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_5x5_SRGB8_ALPHA8: return VK_FORMAT_ASTC_5x5_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_6x5_RGBA: return VK_FORMAT_ASTC_6x5_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_6x5_SRGB8_ALPHA8: return VK_FORMAT_ASTC_6x5_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_6x6_RGBA: return VK_FORMAT_ASTC_6x6_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_6x6_SRGB8_ALPHA8: return VK_FORMAT_ASTC_6x6_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_8x5_RGBA: return VK_FORMAT_ASTC_8x5_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_8x5_SRGB8_ALPHA8: return VK_FORMAT_ASTC_8x5_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_8x6_RGBA: return VK_FORMAT_ASTC_8x6_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_8x6_SRGB8_ALPHA8: return VK_FORMAT_ASTC_8x6_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_8x8_RGBA: return VK_FORMAT_ASTC_8x8_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_8x8_SRGB8_ALPHA8: return VK_FORMAT_ASTC_8x8_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_10x5_RGBA: return VK_FORMAT_ASTC_10x5_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_10x5_SRGB8_ALPHA8: return VK_FORMAT_ASTC_10x5_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_10x6_RGBA: return VK_FORMAT_ASTC_10x6_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_10x6_SRGB8_ALPHA8: return VK_FORMAT_ASTC_10x6_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_10x8_RGBA: return VK_FORMAT_ASTC_10x8_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_10x8_SRGB8_ALPHA8: return VK_FORMAT_ASTC_10x8_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_10x10_RGBA: return VK_FORMAT_ASTC_10x10_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_10x10_SRGB8_ALPHA8: return VK_FORMAT_ASTC_10x10_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_12x10_RGBA: return VK_FORMAT_ASTC_12x10_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_12x10_SRGB8_ALPHA8: return VK_FORMAT_ASTC_12x10_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_12x12_RGBA: return VK_FORMAT_ASTC_12x12_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_ASTC_12x12_SRGB8_ALPHA8: return VK_FORMAT_ASTC_12x12_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC1_RGB_UNORM_BLOCK: return VK_FORMAT_BC1_RGB_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC1_RGB_SRGB_BLOCK: return VK_FORMAT_BC1_RGB_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC1_RGBA_UNORM_BLOCK: return VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC1_RGBA_SRGB_BLOCK: return VK_FORMAT_BC1_RGBA_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC2_UNORM_BLOCK: return VK_FORMAT_BC2_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC2_SRGB_BLOCK: return VK_FORMAT_BC2_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC3_UNORM_BLOCK: return VK_FORMAT_BC3_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC3_SRGB_BLOCK: return VK_FORMAT_BC3_SRGB_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC4_UNORM_BLOCK: return VK_FORMAT_BC4_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC4_SNORM_BLOCK: return VK_FORMAT_BC4_SNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC5_UNORM_BLOCK: return VK_FORMAT_BC5_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC5_SNORM_BLOCK: return VK_FORMAT_BC5_SNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC6H_UFLOAT_BLOCK: return VK_FORMAT_BC6H_UFLOAT_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC6H_SFLOAT_BLOCK: return VK_FORMAT_BC6H_SFLOAT_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC7_UNORM_BLOCK: return VK_FORMAT_BC7_UNORM_BLOCK;
case tcu::COMPRESSEDTEXFORMAT_BC7_SRGB_BLOCK: return VK_FORMAT_BC7_SRGB_BLOCK;
default:
TCU_THROW(InternalError, "Unknown texture format");
return VK_FORMAT_UNDEFINED;
}
}
tcu::TextureFormat mapVkFormat (VkFormat format)
{
using tcu::TextureFormat;
// update this mapping if VkFormat changes
DE_STATIC_ASSERT(VK_CORE_FORMAT_LAST == 185);
switch (format)
{
case VK_FORMAT_R4G4_UNORM_PACK8: return TextureFormat(TextureFormat::RG, TextureFormat::UNORM_BYTE_44);
case VK_FORMAT_R5G6B5_UNORM_PACK16: return TextureFormat(TextureFormat::RGB, TextureFormat::UNORM_SHORT_565);
case VK_FORMAT_R4G4B4A4_UNORM_PACK16: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_SHORT_4444);
case VK_FORMAT_R5G5B5A1_UNORM_PACK16: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_SHORT_5551);
case VK_FORMAT_B5G6R5_UNORM_PACK16: return TextureFormat(TextureFormat::BGR, TextureFormat::UNORM_SHORT_565);
case VK_FORMAT_B4G4R4A4_UNORM_PACK16: return TextureFormat(TextureFormat::BGRA, TextureFormat::UNORM_SHORT_4444);
case VK_FORMAT_B5G5R5A1_UNORM_PACK16: return TextureFormat(TextureFormat::BGRA, TextureFormat::UNORM_SHORT_5551);
case VK_FORMAT_A1R5G5B5_UNORM_PACK16: return TextureFormat(TextureFormat::ARGB, TextureFormat::UNORM_SHORT_1555);
case VK_FORMAT_R8_UNORM: return TextureFormat(TextureFormat::R, TextureFormat::UNORM_INT8);
case VK_FORMAT_R8_SNORM: return TextureFormat(TextureFormat::R, TextureFormat::SNORM_INT8);
case VK_FORMAT_R8_USCALED: return TextureFormat(TextureFormat::R, TextureFormat::