mirror of
https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
synced 2025-06-05 23:10:54 +00:00
formats: Remove old format utils
Some checks failed
ci / reuse (push) Has been cancelled
ci / generate_source (push) Has been cancelled
format / clang-format (push) Has been cancelled
ci / chromium (push) Has been cancelled
ci / build_and_test (Debug, macos-latest) (push) Has been cancelled
ci / build_and_test (Debug, ubuntu-22.04) (push) Has been cancelled
ci / build_and_test (Debug, ubuntu-24.04) (push) Has been cancelled
ci / build_and_test (Debug, windows-latest) (push) Has been cancelled
ci / build_and_test (Release, macos-latest) (push) Has been cancelled
ci / build_and_test (Release, ubuntu-22.04) (push) Has been cancelled
ci / build_and_test (Release, ubuntu-24.04) (push) Has been cancelled
ci / build_and_test (Release, windows-latest) (push) Has been cancelled
ci / windows-arm64 (push) Has been cancelled
ci / android (arm64-v8a) (push) Has been cancelled
ci / android (armeabi-v7a) (push) Has been cancelled
Some checks failed
ci / reuse (push) Has been cancelled
ci / generate_source (push) Has been cancelled
format / clang-format (push) Has been cancelled
ci / chromium (push) Has been cancelled
ci / build_and_test (Debug, macos-latest) (push) Has been cancelled
ci / build_and_test (Debug, ubuntu-22.04) (push) Has been cancelled
ci / build_and_test (Debug, ubuntu-24.04) (push) Has been cancelled
ci / build_and_test (Debug, windows-latest) (push) Has been cancelled
ci / build_and_test (Release, macos-latest) (push) Has been cancelled
ci / build_and_test (Release, ubuntu-22.04) (push) Has been cancelled
ci / build_and_test (Release, ubuntu-24.04) (push) Has been cancelled
ci / build_and_test (Release, windows-latest) (push) Has been cancelled
ci / windows-arm64 (push) Has been cancelled
ci / android (arm64-v8a) (push) Has been cancelled
ci / android (armeabi-v7a) (push) Has been cancelled
This commit is contained in:
parent
4f62821046
commit
ae56bd6e65
3 changed files with 0 additions and 130 deletions
|
@ -283,24 +283,6 @@ inline uint32_t vkuFormatTexelsPerBlock(VkFormat format);
|
|||
// When dealing with mulit-planar formats, need to consider using vkuGetPlaneIndex.
|
||||
inline uint32_t vkuFormatTexelBlockSize(VkFormat format);
|
||||
|
||||
// Return size, in bytes, of one element of a VkFormat
|
||||
// Format must not be a depth, stencil, or multiplane format
|
||||
// Deprecated - Use vkuFormatTexelBlockSize - there is no "element" size in the spec
|
||||
inline uint32_t vkuFormatElementSize(VkFormat format);
|
||||
|
||||
// Return the size in bytes of one texel of a VkFormat
|
||||
// For compressed or multi-plane, this may be a fractional number
|
||||
// Deprecated - Use vkuFormatTexelBlockSize - there is no "element" size in the spec
|
||||
inline uint32_t vkuFormatElementSizeWithAspect(VkFormat format, VkImageAspectFlagBits aspectMask);
|
||||
|
||||
// Return the size in bytes of one texel of a VkFormat
|
||||
// Format must not be a depth, stencil, or multiplane format
|
||||
inline double vkuFormatTexelSize(VkFormat format);
|
||||
|
||||
// Return the size in bytes of one texel of a VkFormat
|
||||
// For compressed or multi-plane, this may be a fractional number
|
||||
inline double vkuFormatTexelSizeWithAspect(VkFormat format, VkImageAspectFlagBits aspectMask);
|
||||
|
||||
// Returns whether a VkFormat contains only 8-bit sized components
|
||||
inline bool vkuFormatIs8bit(VkFormat format);
|
||||
|
||||
|
@ -1591,41 +1573,6 @@ inline uint32_t vkuFormatTexelsPerBlock(VkFormat format) { return vkuGetFormatIn
|
|||
|
||||
inline uint32_t vkuFormatTexelBlockSize(VkFormat format) { return vkuGetFormatInfo(format).texel_block_size; }
|
||||
|
||||
// Deprecated - Use vkuFormatTexelBlockSize
|
||||
inline uint32_t vkuFormatElementSize(VkFormat format) {
|
||||
return vkuFormatElementSizeWithAspect(format, VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
}
|
||||
|
||||
// Deprecated - Use vkuFormatTexelBlockSize
|
||||
inline uint32_t vkuFormatElementSizeWithAspect(VkFormat format, VkImageAspectFlagBits aspectMask) {
|
||||
// Depth/Stencil aspect have separate helper functions
|
||||
if (aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
return vkuFormatStencilSize(format) / 8;
|
||||
} else if (aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||
return vkuFormatDepthSize(format) / 8;
|
||||
} else if (vkuFormatIsMultiplane(format)) {
|
||||
// Element of entire multiplane format is not useful,
|
||||
// Want to get just a single plane as the lookup format
|
||||
format = vkuFindMultiplaneCompatibleFormat(format, aspectMask);
|
||||
}
|
||||
|
||||
return vkuGetFormatInfo(format).texel_block_size;
|
||||
}
|
||||
|
||||
inline double vkuFormatTexelSize(VkFormat format) {
|
||||
return vkuFormatTexelSizeWithAspect(format, VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
}
|
||||
|
||||
inline double vkuFormatTexelSizeWithAspect(VkFormat format, VkImageAspectFlagBits aspectMask) {
|
||||
double texel_size = (double)(vkuFormatElementSizeWithAspect(format, aspectMask));
|
||||
VkExtent3D block_extent = vkuFormatTexelBlockExtent(format);
|
||||
uint32_t texels_per_block = block_extent.width * block_extent.height * block_extent.depth;
|
||||
if (1 < texels_per_block) {
|
||||
texel_size /= (double)(texels_per_block);
|
||||
}
|
||||
return texel_size;
|
||||
}
|
||||
|
||||
inline bool vkuFormatIs8bit(VkFormat format) {
|
||||
switch (format) {
|
||||
case VK_FORMAT_A8_UNORM:
|
||||
|
|
|
@ -236,24 +236,6 @@ inline uint32_t vkuFormatTexelsPerBlock(VkFormat format);
|
|||
// When dealing with mulit-planar formats, need to consider using vkuGetPlaneIndex.
|
||||
inline uint32_t vkuFormatTexelBlockSize(VkFormat format);
|
||||
|
||||
// Return size, in bytes, of one element of a VkFormat
|
||||
// Format must not be a depth, stencil, or multiplane format
|
||||
// Deprecated - Use vkuFormatTexelBlockSize - there is no "element" size in the spec
|
||||
inline uint32_t vkuFormatElementSize(VkFormat format);
|
||||
|
||||
// Return the size in bytes of one texel of a VkFormat
|
||||
// For compressed or multi-plane, this may be a fractional number
|
||||
// Deprecated - Use vkuFormatTexelBlockSize - there is no "element" size in the spec
|
||||
inline uint32_t vkuFormatElementSizeWithAspect(VkFormat format, VkImageAspectFlagBits aspectMask);
|
||||
|
||||
// Return the size in bytes of one texel of a VkFormat
|
||||
// Format must not be a depth, stencil, or multiplane format
|
||||
inline double vkuFormatTexelSize(VkFormat format);
|
||||
|
||||
// Return the size in bytes of one texel of a VkFormat
|
||||
// For compressed or multi-plane, this may be a fractional number
|
||||
inline double vkuFormatTexelSizeWithAspect(VkFormat format, VkImageAspectFlagBits aspectMask);
|
||||
|
||||
''')
|
||||
for bits in ['8', '16', '32', '64']:
|
||||
out.append(f'// Returns whether a VkFormat contains only {bits}-bit sized components\n')
|
||||
|
@ -643,41 +625,6 @@ inline uint32_t vkuFormatTexelsPerBlock(VkFormat format) { return vkuGetFormatIn
|
|||
|
||||
inline uint32_t vkuFormatTexelBlockSize(VkFormat format) { return vkuGetFormatInfo(format).texel_block_size; }
|
||||
|
||||
// Deprecated - Use vkuFormatTexelBlockSize
|
||||
inline uint32_t vkuFormatElementSize(VkFormat format) {
|
||||
return vkuFormatElementSizeWithAspect(format, VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
}
|
||||
|
||||
// Deprecated - Use vkuFormatTexelBlockSize
|
||||
inline uint32_t vkuFormatElementSizeWithAspect(VkFormat format, VkImageAspectFlagBits aspectMask) {
|
||||
// Depth/Stencil aspect have separate helper functions
|
||||
if (aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
return vkuFormatStencilSize(format) / 8;
|
||||
} else if (aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||
return vkuFormatDepthSize(format) / 8;
|
||||
} else if (vkuFormatIsMultiplane(format)) {
|
||||
// Element of entire multiplane format is not useful,
|
||||
// Want to get just a single plane as the lookup format
|
||||
format = vkuFindMultiplaneCompatibleFormat(format, aspectMask);
|
||||
}
|
||||
|
||||
return vkuGetFormatInfo(format).texel_block_size;
|
||||
}
|
||||
|
||||
inline double vkuFormatTexelSize(VkFormat format) {
|
||||
return vkuFormatTexelSizeWithAspect(format, VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
}
|
||||
|
||||
inline double vkuFormatTexelSizeWithAspect(VkFormat format, VkImageAspectFlagBits aspectMask) {
|
||||
double texel_size = (double)(vkuFormatElementSizeWithAspect(format, aspectMask));
|
||||
VkExtent3D block_extent = vkuFormatTexelBlockExtent(format);
|
||||
uint32_t texels_per_block = block_extent.width * block_extent.height * block_extent.depth;
|
||||
if (1 < texels_per_block) {
|
||||
texel_size /= (double)(texels_per_block);
|
||||
}
|
||||
return texel_size;
|
||||
}
|
||||
|
||||
''')
|
||||
# Could loop the components, but faster to just list these
|
||||
for bits in ['8', '16', '32', '64']:
|
||||
|
|
|
@ -546,30 +546,6 @@ TEST(format_utils, vkuFormatTexelBlockSize) {
|
|||
EXPECT_EQ(vkuFormatTexelBlockSize(VK_FORMAT_S8_UINT), 1u);
|
||||
}
|
||||
|
||||
TEST(format_utils, vkuFormatTexelSizeWithAspect) {
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_R64G64_SFLOAT, VK_IMAGE_ASPECT_NONE), 16);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_R64G64_SFLOAT, VK_IMAGE_ASPECT_STENCIL_BIT), 0);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_R64G64_SFLOAT, VK_IMAGE_ASPECT_DEPTH_BIT), 0);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_ASTC_5x4_SRGB_BLOCK, VK_IMAGE_ASPECT_NONE), 16. / 20.);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_ASTC_5x4_SRGB_BLOCK, VK_IMAGE_ASPECT_STENCIL_BIT), 0);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_ASTC_5x4_SRGB_BLOCK, VK_IMAGE_ASPECT_DEPTH_BIT), 0);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, VK_IMAGE_ASPECT_NONE), 0);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, VK_IMAGE_ASPECT_PLANE_0_BIT), 2);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, VK_IMAGE_ASPECT_PLANE_1_BIT), 2);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, VK_IMAGE_ASPECT_PLANE_2_BIT), 2);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, VK_IMAGE_ASPECT_STENCIL_BIT), 0);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, VK_IMAGE_ASPECT_STENCIL_BIT), 0);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, VK_IMAGE_ASPECT_DEPTH_BIT), 0);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_D32_SFLOAT, VK_IMAGE_ASPECT_NONE), 4);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_D32_SFLOAT, VK_IMAGE_ASPECT_STENCIL_BIT), 0);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_D32_SFLOAT, VK_IMAGE_ASPECT_DEPTH_BIT), 4);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_NONE), 5);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_STENCIL_BIT), 1);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_DEPTH_BIT), 4);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_S8_UINT, VK_IMAGE_ASPECT_NONE), 1);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_S8_UINT, VK_IMAGE_ASPECT_STENCIL_BIT), 1);
|
||||
EXPECT_EQ(vkuFormatTexelSizeWithAspect(VK_FORMAT_S8_UINT, VK_IMAGE_ASPECT_DEPTH_BIT), 0);
|
||||
}
|
||||
TEST(format_utils, vkuFormatIs64bit) {
|
||||
for (auto [format, format_str] : magic_enum::enum_entries<VkFormat>()) {
|
||||
if (std::string::npos != format_str.find("R64")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue