diff --git a/thirdparty/README.md b/thirdparty/README.md index d144d071e59..eac7cfe590f 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -558,7 +558,7 @@ Patches: ## libktx - Upstream: https://github.com/KhronosGroup/KTX-Software -- Version: 4.4.0 (beef80159525d9fb7abb8645ea85f4c4f6842e8f, 2025) +- Version: 4.4.2 (4d6fc70eaf62ad0558e63e8d97eb9766118327a6, 2025) - License: Apache 2.0 Files extracted from upstream source: @@ -568,7 +568,7 @@ Files extracted from upstream source: - `external/dfdutils/LICENSE.adoc` as `LICENSE.dfdutils.adoc` (in root) - `external/dfdutils/LICENSES/Apache-2.0.txt` as `Apache-2.0.txt` (in root) - `external/dfdutils/{KHR/,dfd.h,colourspaces.c,createdfd.c,interpretdfd.c,printdfd.c,queries.c,dfd2vk.inl,vk2dfd.*}` -- `lib/{basis_sgd.h,formatsize.h,gl_format.h,ktxint.h,uthash.h,vk_format.h,vkformat_enum.h,checkheader.c,swap.c,hashlist.c,vkformat_check.c,vkformat_typesize.c,basis_transcode.cpp,miniz_wrapper.cpp,filestream.*,memstream.*,texture*}` +- `lib/{basis_sgd.h,formatsize.h,gl_format.h,ktxint.h,uthash.h,vk_format.h,vkformat_enum.h,checkheader.c,swap.c,hashlist.c,vkformat_check*.c,vkformat_typesize.c,basis_transcode.cpp,miniz_wrapper.cpp,filestream.*,memstream.*,texture*}` - `other_include/KHR/` - `utils/unused.h` diff --git a/thirdparty/libktx/external/dfdutils/createdfd.c b/thirdparty/libktx/external/dfdutils/createdfd.c index d063f419736..bb79ebd72f8 100644 --- a/thirdparty/libktx/external/dfdutils/createdfd.c +++ b/thirdparty/libktx/external/dfdutils/createdfd.c @@ -603,7 +603,7 @@ static uint32_t compBytes[] = { * @param bwidth Block width in texel coordinates. * @param bheight Block height in texel coordinates. * @param bdepth Block depth in texel coordinates. - * @author Mark Callow, Edgewise Consulting. + * @author Mark Callow, github.com/MarkCallow. * @param suffix Indicates the format suffix for the type. * * @return A data format descriptor in malloc'd data. The caller is responsible diff --git a/thirdparty/libktx/include/ktx.h b/thirdparty/libktx/include/ktx.h index 8360117c313..8889c91a437 100644 --- a/thirdparty/libktx/include/ktx.h +++ b/thirdparty/libktx/include/ktx.h @@ -1274,14 +1274,17 @@ typedef enum ktx_pack_astc_block_dimension_e { /** * @~English - * @brief Options specifying ASTC encoder profile mode - * This and function is used later to derive the profile. + * @brief Options specifying ASTC encoder mode. */ typedef enum ktx_pack_astc_encoder_mode_e { KTX_PACK_ASTC_ENCODER_MODE_DEFAULT, + /*!< Selects LDR mode if component size is <= 8-bit, HDR otherwise. */ KTX_PACK_ASTC_ENCODER_MODE_LDR, + /*!< Always encode in low dynamic range mode. */ KTX_PACK_ASTC_ENCODER_MODE_HDR, + /*!< Always encode in high dynamic range mode. */ KTX_PACK_ASTC_ENCODER_MODE_MAX = KTX_PACK_ASTC_ENCODER_MODE_HDR + /*!< Indicates the maximum permissible value. */ } ktx_pack_astc_encoder_mode_e; extern KTX_API const ktx_uint32_t KTX_ETC1S_DEFAULT_COMPRESSION_LEVEL; @@ -1800,7 +1803,13 @@ KTX_API KTX_error_code KTX_APIENTRY ktxPrintInfoForNamedFile(const char* const f KTX_API KTX_error_code KTX_APIENTRY ktxPrintInfoForMemory(const ktx_uint8_t* bytes, ktx_size_t size); /*===========================================================* - * Utilities for printing info about a KTX2 file. * + * Utilities for printing info about a KTX v1 file. * + *===========================================================*/ + + KTX_API KTX_error_code KTX_APIENTRY ktxPrintKTX1InfoTextForStream(ktxStream* stream); + +/*===========================================================* + * Utilities for printing info about a KTX v2 file. * *===========================================================*/ KTX_API KTX_error_code KTX_APIENTRY ktxPrintKTX2InfoTextForMemory(const ktx_uint8_t* bytes, ktx_size_t size); diff --git a/thirdparty/libktx/include/ktxvulkan.h b/thirdparty/libktx/include/ktxvulkan.h index 2162b1fc591..47ae45b37d5 100644 --- a/thirdparty/libktx/include/ktxvulkan.h +++ b/thirdparty/libktx/include/ktxvulkan.h @@ -22,7 +22,7 @@ * means that vulkan.h must be included @e before including this file. The * alternative is duplicating unattractively large parts of it. * - * @author Mark Callow, Edgewise Consulting + * @author Mark Callow, github.com/MarkCallow */ #include diff --git a/thirdparty/libktx/lib/basis_transcode.cpp b/thirdparty/libktx/lib/basis_transcode.cpp index 9268b8f31b5..eccfbe48bdd 100644 --- a/thirdparty/libktx/lib/basis_transcode.cpp +++ b/thirdparty/libktx/lib/basis_transcode.cpp @@ -15,7 +15,7 @@ * * Two worlds collide here too. More uglyness! * - * @author Mark Callow, www.edgewise-consulting.com + * @author Mark Callow, github.com/MarkCallow */ #include diff --git a/thirdparty/libktx/lib/formatsize.h b/thirdparty/libktx/lib/formatsize.h index 149ff18d61f..8af0f98b85d 100644 --- a/thirdparty/libktx/lib/formatsize.h +++ b/thirdparty/libktx/lib/formatsize.h @@ -13,7 +13,7 @@ * * @brief Struct for returning size information about an image format. * - * @author Mark Callow, www.edgewise-consulting.com + * @author Mark Callow, github.com/MarkCallow */ #ifndef _FORMATSIZE_H_ diff --git a/thirdparty/libktx/lib/gl_format.h b/thirdparty/libktx/lib/gl_format.h index 44abd2c6d41..901f3e4280c 100644 --- a/thirdparty/libktx/lib/gl_format.h +++ b/thirdparty/libktx/lib/gl_format.h @@ -74,7 +74,7 @@ static inline unsigned int glGetTypeSizeFromType( const GLenum type ); MODIFICATIONS for use in libktx =============================== -2018.3.23 Added glGetTypeSizeFromType. Mark Callow, Edgewise Consulting. +2018.3.23 Added glGetTypeSizeFromType. Mark Callow, github.com/MarkCallow. 2019.3.09 #if 0 around GL type declarations. 〃 2019.5.30 Use common ktxFormatSize to return results. 〃 2019.5.30 Return blockSizeInBits 0 for default case of glGetFormatSize. 〃 diff --git a/thirdparty/libktx/lib/swap.c b/thirdparty/libktx/lib/swap.c index 02ea6de2d8d..3fdeb4f3a46 100644 --- a/thirdparty/libktx/lib/swap.c +++ b/thirdparty/libktx/lib/swap.c @@ -1,7 +1,7 @@ /* -*- tab-width: 4; -*- */ /* vi: set sw=2 ts=4 expandtab: */ -/* $Id$ */ +/* $Id: 02ea6de2d8db512ca3af08f48b98ab5f6c35e7e5 $ */ /* * Copyright 2010-2020 The Khronos Group Inc. diff --git a/thirdparty/libktx/lib/texture.c b/thirdparty/libktx/lib/texture.c index ede6cd151a9..14abc418ae5 100644 --- a/thirdparty/libktx/lib/texture.c +++ b/thirdparty/libktx/lib/texture.c @@ -13,7 +13,7 @@ * * @brief ktxTexture implementation. * - * @author Mark Callow, www.edgewise-consulting.com + * @author Mark Callow, github.com/MarkCallow */ #if defined(_WIN32) diff --git a/thirdparty/libktx/lib/texture1.c b/thirdparty/libktx/lib/texture1.c index 4bd23590eeb..7396f051c72 100644 --- a/thirdparty/libktx/lib/texture1.c +++ b/thirdparty/libktx/lib/texture1.c @@ -13,7 +13,7 @@ * * @brief ktxTexture1 implementation. Support for KTX format. * - * @author Mark Callow, www.edgewise-consulting.com + * @author Mark Callow, github.com/MarkCallow */ #if defined(_WIN32) @@ -284,8 +284,10 @@ ktxTexture1_constructFromStreamAndHeader(ktxTexture1* This, ktxStream* pStream, } result = stream->read(stream, pKvd, kvdLen); - if (result != KTX_SUCCESS) + if (result != KTX_SUCCESS) { + free(pKvd); goto cleanup; + } if (private->_needSwap) { /* Swap the counts inside the key & value data. */ diff --git a/thirdparty/libktx/lib/texture2.c b/thirdparty/libktx/lib/texture2.c index 6a061187496..a15f3531041 100644 --- a/thirdparty/libktx/lib/texture2.c +++ b/thirdparty/libktx/lib/texture2.c @@ -13,7 +13,7 @@ * * @brief ktxTexture2 implementation. Support for KTX2 format. * - * @author Mark Callow, www.edgewise-consulting.com + * @author Mark Callow, github.com/MarkCallow */ #if defined(_WIN32) @@ -55,8 +55,11 @@ struct ktxTexture_vtblInt ktxTexture2_vtblInt; struct sampleType { uint32_t bitOffset: 16; uint32_t bitLength: 8; - uint32_t channelType: 8; // Includes qualifiers - uint32_t samplePosition0: 8; + // MSVC 14.44 introduced a warning when mixing enums of different types. + // To avoid doing that make separate channelId and qualifier fields. + uint32_t channelId : 4; + uint32_t datatypeQualifiers : 4; + uint32_t samplePosition0 : 8; uint32_t samplePosition1: 8; uint32_t samplePosition2: 8; uint32_t samplePosition3: 8; @@ -115,7 +118,8 @@ struct BDFD e5b9g9r9_ufloat_comparator = { .samples[0] = { .bitOffset = 0, .bitLength = 8, - .channelType = KHR_DF_CHANNEL_RGBSDA_RED, + .channelId = KHR_DF_CHANNEL_RGBSDA_RED, + .datatypeQualifiers = 0, .samplePosition0 = 0, .samplePosition1 = 0, .samplePosition2 = 0, @@ -126,7 +130,10 @@ struct BDFD e5b9g9r9_ufloat_comparator = { .samples[1] = { .bitOffset = 27, .bitLength = 4, - .channelType = KHR_DF_CHANNEL_RGBSDA_RED | KHR_DF_SAMPLE_DATATYPE_EXPONENT, + .channelId = KHR_DF_CHANNEL_RGBSDA_RED, + // The constant is defined to be ORed with a channelId into + // an 8-bit value. Shift to make it suitable for the 4-bit field. + .datatypeQualifiers = (KHR_DF_SAMPLE_DATATYPE_EXPONENT >> 4U), .samplePosition0 = 0, .samplePosition1 = 0, .samplePosition2 = 0, @@ -137,7 +144,8 @@ struct BDFD e5b9g9r9_ufloat_comparator = { .samples[2] = { .bitOffset = 9, .bitLength = 8, - .channelType = KHR_DF_CHANNEL_RGBSDA_GREEN, + .channelId = KHR_DF_CHANNEL_RGBSDA_GREEN, + .datatypeQualifiers = 0, .samplePosition0 = 0, .samplePosition1 = 0, .samplePosition2 = 0, @@ -148,7 +156,9 @@ struct BDFD e5b9g9r9_ufloat_comparator = { .samples[3] = { .bitOffset = 27, .bitLength = 4, - .channelType = KHR_DF_CHANNEL_RGBSDA_GREEN | KHR_DF_SAMPLE_DATATYPE_EXPONENT, + .channelId = KHR_DF_CHANNEL_RGBSDA_GREEN, + // Ditto comment in samples[1]. + .datatypeQualifiers = (KHR_DF_SAMPLE_DATATYPE_EXPONENT >> 4U), .samplePosition0 = 0, .samplePosition1 = 0, .samplePosition2 = 0, @@ -159,7 +169,8 @@ struct BDFD e5b9g9r9_ufloat_comparator = { .samples[4] = { .bitOffset = 18, .bitLength = 8, - .channelType = KHR_DF_CHANNEL_RGBSDA_BLUE, + .channelId = KHR_DF_CHANNEL_RGBSDA_BLUE, + .datatypeQualifiers = 0, .samplePosition0 = 0, .samplePosition1 = 0, .samplePosition2 = 0, @@ -170,7 +181,9 @@ struct BDFD e5b9g9r9_ufloat_comparator = { .samples[5] = { .bitOffset = 27, .bitLength = 4, - .channelType = KHR_DF_CHANNEL_RGBSDA_BLUE | KHR_DF_SAMPLE_DATATYPE_EXPONENT, + .channelId = KHR_DF_CHANNEL_RGBSDA_BLUE, + // Ditto comment in samples[1]. + .datatypeQualifiers = (KHR_DF_SAMPLE_DATATYPE_EXPONENT >> 4U), .samplePosition0 = 0, .samplePosition1 = 0, .samplePosition2 = 0, @@ -887,8 +900,10 @@ ktxTexture2_constructFromStreamAndHeader(ktxTexture2* This, ktxStream* pStream, } result = stream->read(stream, pKvd, kvdLen); - if (result != KTX_SUCCESS) + if (result != KTX_SUCCESS) { + free(pKvd); goto cleanup; + } if (IS_BIG_ENDIAN) { /* Swap the counts inside the key & value data. */ diff --git a/thirdparty/libktx/lib/vk_format.h b/thirdparty/libktx/lib/vk_format.h index ab8a1ecbb6a..3367c2f6964 100644 --- a/thirdparty/libktx/lib/vk_format.h +++ b/thirdparty/libktx/lib/vk_format.h @@ -71,7 +71,7 @@ static inline void vkGetFormatSize( const VkFormat format, VkFormatSize * pForma MODIFICATIONS for use in libktx =============================== -2019.5.30 Use common ktxFormatSize to return results. Mark Callow, Edgewise Consulting. +2019.5.30 Use common ktxFormatSize to return results. Mark Callow, github.com/MarkCallow. 2019.6.12 Add mapping of PVRTC formats. " ================================================================================================