libktx: Update to 4.4.2

This commit is contained in:
Rémi Verschelde 2025-12-12 22:14:48 +01:00
parent 08e6cd181f
commit d0b157317a
No known key found for this signature in database
GPG Key ID: C3336907360768E1
12 changed files with 51 additions and 25 deletions

View File

@ -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`

View File

@ -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

View File

@ -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);

View File

@ -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 <ktx.h>

View File

@ -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 <inttypes.h>

View File

@ -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_

View File

@ -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.

View File

@ -1,7 +1,7 @@
/* -*- tab-width: 4; -*- */
/* vi: set sw=2 ts=4 expandtab: */
/* $Id$ */
/* $Id: 02ea6de2d8db512ca3af08f48b98ab5f6c35e7e5 $ */
/*
* Copyright 2010-2020 The Khronos Group Inc.

View File

@ -13,7 +13,7 @@
*
* @brief ktxTexture implementation.
*
* @author Mark Callow, www.edgewise-consulting.com
* @author Mark Callow, github.com/MarkCallow
*/
#if defined(_WIN32)

View File

@ -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. */

View File

@ -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. */

View File

@ -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. "
================================================================================================