7#include <vulkan/vulkan_core.h>
38 [[nodiscard]]
const uint8_t*
bytes()
const
56 std::vector<uint8_t>().swap(
allData);
Ktx2Loader()=default
Creates a stateless KTX loader.
~Ktx2Loader()=default
Destroys the loader.
Textures::Ktx2TextureData load(const std::filesystem::path &filename)
Loads image data and mip metadata from a KTX or KTX2 file.
Ktx2TextureType
OpenGL internal format constants for KTX1 texture compression types.
@ BC5_Signed
GL_COMPRESSED_SIGNED_RG_RGTC2.
@ BC7_SRGB
GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM.
@ BC6H_Unsigned
GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT.
@ BC5_Unsigned
GL_COMPRESSED_RG_RGTC2.
@ BC6H_Signed
GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT.
@ BC4_Unsigned
GL_COMPRESSED_RED_RGTC1.
@ BC4_Signed
GL_COMPRESSED_SIGNED_RED_RGTC1.
@ BC7_RGBA
GL_COMPRESSED_RGBA_BPTC_UNORM.
Ktx2TextureData extractMipRange(const Ktx2TextureData &source, uint32_t firstMip, uint32_t mipCount)
Copies a contiguous mip range into a new KTX data object.
Stores all data loaded from a KTX2 file including mip chain.
const uint8_t * externalData
Borrowed image bytes from an external owner.
std::vector< uint32_t > mipWidths
Width for each local mip level.
std::vector< VkDeviceSize > mipSizes
Byte size for each local mip level.
uint32_t baseWidth
Width of mip level 0 in this data object.
std::vector< uint8_t > allData
Owned contiguous image bytes.
void releaseBytes()
Releases owned and externally held image bytes.
VkFormat vkFormat
Vulkan format used for upload.
bool isCompressed
True when the format uses block compression.
uint32_t mipLevels
Number of mip levels stored in this data object.
const uint8_t * bytes() const
Returns the contiguous image bytes, whether owned or externally held.
uint32_t sourceMipLevels
Number of mip levels in the original source texture.
uint32_t sourceHeight
Height of the original source texture before mip extraction.
uint32_t sourceWidth
Width of the original source texture before mip extraction.
std::shared_ptr< void > externalDataOwner
Owner that keeps externalData alive.
uint32_t baseHeight
Height of mip level 0 in this data object.
uint32_t sourceBaseMip
Source mip index represented by local mip level 0.
std::vector< uint32_t > mipHeights
Height for each local mip level.
std::vector< VkDeviceSize > mipOffsets
Byte offset for each local mip level.
std::string uri
Source URI or filename used for diagnostics.
bool hasBytes() const
Returns true when image bytes are available.