Repository navigation
v5.0.0-rc2
Pre-releaseSummary
Version 5 is a major release. Although the reason for bumping the major number is a small but incompatible change in the libktx API, there are major changes throughout the software.
ktxBasisParamsAPI has two incompatible changes.- Support for the Binomial UASTC HDR formats has been added to all supported API bindings and relevant tools.
- The ktx tool suite is now a superset of the legacy tools.
- The legacy tools have been removed.
- A CMake project has been added to build libktx.
- Source code of dependencies is no longer included in CMake target source lists. All dependencies are now built by their own CMake projects and linked to libktx.
This is a pre-release because the version of the KTX specification with which it is compliant, Document Revision 5, has not yet been published. The source of the draft is available at KhronosGroup/KTX-Specification#216.
User-facing Changes Since v5.0.0-rc1
Most of the changes are bug fixes, robustness fixes and updates to included third-party software. See Commits since v5.0.0-rc1 for details. Here is a list of the user-facing changes.
- New UASTC HDR transcode targets: KTX_TTF_RGB_HALF and KTX_TTF_RGB9E5.
- New ETC1S/BasisLZ transcode flag: KTX_TF_NO_ETC1S_CHROMA_FILTERING.
- Print SSIM and PSNR metrics to stderr if the output file set to stdout.
- Extract explicitly marks linear output PNG files as such.
- Fix crash when reading tiled EXR files.
- Fix transcode failure on 3D HDR textures.
- Fix transcode failure on some levels in files with certain mip-level sizes.
- Change typedef of
ktx_off_ton Windows to a signed type as originally intended.
For developers v5.0.0-rc2 enables running builds and tests across multiple jobs greatly reducing the elapsed wall-time.
Huge thanks to Walid Chtioui (@walcht) who contributed the majority of the bug fixes, all the robustness improvements and fixed the issues preventing parallel builds and tests.
New Features in v5.0
Tools
- Images can be encoded to the Binomial UASTC HDR 4x4 and UASTC HDR 6x6 Intermediate formats in ktx create and ktx encode. Images in these formats can be transcoded to ASTC HDR or BC6H Unsigned formats.
- ktx extract can extract images in ASTC HDR formats from KTX v2 files. It writes them to
.exrfiles. It will applyKTXmapRangeduring extraction. - ktx create accepts a
--premultiply-alphaoption. - ktx create can resize or scale its input files, except
.raw. - ktx create accepts file name listing files as input. Prefix the name of such a file with
@or@@. - ktx convert for converting KTX v1 files.
This shows the equivalent new tool for each removed legacy tool.
| Legacy Tool | ktx tool |
|---|---|
| ktx2ktx2 | convert -t ktx |
| ktx2check | validate |
| ktxinfo | info |
| ktxsc | deflate or encode |
| toktx | create |
libktx functions
ktxTexture2_CompressBasisExcan now encode to Binomial UASTC HDR 4x4 and UASTC HDR 6x6 Intermediate formats. There are two incompatible changes in the structktxBasisParamspassed to this function:ktx_bool_t uastcis nowktx_basis_codec_e codecwhich accepts the following valuesKTX_BASIS_CODEC_NONEKTX_BASIS_CODEC_ETC1SKTX_BASIS_CODEC_UASTC_LDR_4x4KTX_BASIS_CODEC_UASTC_HDR_4x4KTX_BASIS_CODEC_UASTC_HDR_6x6_INTERMEDIATE
compressionLevelis now namedetc1sCompressionLevel
ktxTexture2_DecodeAstccan now decode ASTC HDR files.ktxTexture2_TranscodeBasiscan transcode images in UASTC HDR 4x4 and UASTC HDR 6x6 Intermediate formats to ASTC HDR or BC6H Unsigned.
The new functionality is exposed in the Java, JavaScript and Python bindings.
Notable Fixes in v5.0
- A crash in ktx create when reading tiled
.exrfiles has been fixed. - An extra swizzle, when generating mip levels when the output image components are not in RGBA order, leading to incorrect colors in some mip levels has been fixed.
- The default wrap mode when generating mip levels in ktx create has been changed to
CLAMP, the same default that was set in toktx. - When loading
.exrfiles inktx create, the default primaries are set toBT709instead ofUNSPECIFIED. - Non-sRGB ASTC format KTX v1 files are mapped to the
VK_FORMAT_ASTC_*_SFLOAT_BLOCKformat with the same block dimensions when uploaded to Vulkan or converted to KTX v2 instead of theVK_FORMAT_ASTC_*_UNORM_BLOCKformat. - Per a bug fix in the Khronos Data Format Specification, the Data Format Descriptor's
channelTypefield is now calledchannelId. This change is visible in the outputs of ktx info and ktx compare. New schema versions have been published for their JSON outputs.
Known Issues
-
Files deflated with zlib using libktx compiled with GCC and run on x86_64 may not be bit-identical with those using libktx compiled with GCC and run on arm64.
-
Users making Basis Universal encoded or GPU block compressed textures for WebGL must be aware of WebGL restrictions with regard to texture size and may need to resize input images appropriately before using ktx create, or use the
--resizefeature to produce an appropriately sized texture. In general, the dimensions of block compressed textures must be a multiple of the block size in WebGL and for WebGL 1.0 textures must have power-of-two dimensions. Additional portability restrictions apply for glTF per the KHR_texture_basisu extension which can be verified using the--gltf-basisucommand-line option of ktx validate. -
UASTC RDO results differ from run to run unless multi-threading or RDO multi-threading is disabled. In ktx create or ktx encode use
--threads 1for the former or--uastc_rdo_mfor the latter. Results are valid but level sizes will differ slightly. See issue #151 in the basis_universal repository. -
Neither the Vulkan nor GL loaders support depth/stencil textures.
Acknowledgements
Thanks to all who have contributed to this release. Their GitHub handles are included in the list of commits below. Particluar thanks to:
- Rich Geldreich (@richgel999) for creating the transcodable HDR technology.
- Phasmatic (@ViNeek and @agkar) who did the bulk of the HDR-related work under contract from Khronos.
- Google for funding that work.
- Marco Hutter (@javagl) for adding the HDR api to the Java binding.
- @jiangzhhhh for adding pre-multiplied alpha support to ktx create.
Commits since v5.0.0-rc1 (by part with details)
Note: commits will appear in each part they affected.
libktx
-
Fix incorrect padding of accumulated data size rather than current level's size (#1242) (2114e2f) (@MarkCallow)
The transcode functions were padding the accumulated level sizes. They
should have been padding the current level's size before adding it to
the accumulated size. This led to a check for an output buffer of
sufficient size to fail in the underlying Basis transcoders.While investigating I observed that the transcode functions were
unnecessarily keeping track of level sizes and writing the level index
fields of the prototype transcoded texture based on this tracking. The
level index is correctly set when the prototype is created. Now it is
used to pass write offsets to the underlying Basis transcoders and this
PR deletes the unnecessary tracking and level-index writes. A nice
simplification.Fixes #1241.
-
Fix SGD image desc indexing for 3D UASTC HDR 6x6i textures (#1237) (2355409) (@SashaRX)
Fixes transcoding of 3D textures encoded to UASTC HDR 6x6 intermediate.
Problem
transcodeUastcHDR6x6_intermediateindexes the SGD image description
table withsgdImageDescIndex = level * levelImageCount + imageusing the current level's image count. The encoder
(basis_encode.cpp) writes thektxUASTCHDR6x6IntermediateImageDesc
entries in level order, level 0 first, with each level contributing
numLayers × numFaces × depth(level)descriptions. The two agree only
while every level has the same image count. For 3D textures, depth halves
with each mip level, so the transcoder selects descriptions belonging to
other levels; since slice offsets are relative to their own level's
data, transcoding fails withKTX_TRANSCODE_FAILED(or could silently
read wrong slices when the offsets happen to stay in range).This reproduces with libktx's own encoder output: encode a 24×24×8
VK_FORMAT_R16G16B16A16_SFLOATtexture with 4 mip levels via
ktxTexture2_CompressBasisExwith
KTX_BASIS_CODEC_UASTC_HDR_6x6_INTERMEDIATE, then
ktxTexture2_TranscodeBasis(..., KTX_TTF_ASTC_HDR_6x6_RGBA, 0)fails. A
2D texture with otherwise identical parameters transcodes fine —
presumably why this hasn't been noticed.Fix
Accumulate per-level first-image indices before the level loop and index
withfirstImages[level] + image— the same approachtranscodeEtc1s
already uses with itsfirstImagestable. No behavior change for
textures where every level has the same image count (2D, arrays,
cubemaps): for thosefirstImages[level] == level * levelImageCount.Since
firstImages[numLevels]is the image count implied by the
texture's dimensions, the descriptor table size is now also validated up
front: a table that is not exactly that many descriptions, or not a
whole number of them, is rejected withKTX_FILE_DATA_ERRORbefore any
level is processed, instead of surfacing asKTX_TRANSCODE_FAILEDper
image.Tests
Adds generated 2D control and 3D multi-mip round-trip regression tests
totranscodetests(in-process encode → transcode), with no new binary
test resources. The 3D case fails without the fix and passes with it;
both verify the post-transcode state (vkFormat, supercompression
scheme, image data present).Found while studying the transcoder for the per-level streaming work
discussed in #1224.Co-authored-by: SashaRX 6702929+SashaRX@users.noreply.github.com
-
Allocate the replacement DFD before mutating the texture in the UASTC HDR 4x4 relabel path (#1236) (8c915cd) (@SashaRX)
Small defensive robustness fix in the UASTC_HDR_4x4 → ASTC_HDR_4x4 early
exit ofktxTexture2_TranscodeBasis, related to the passthrough discussion in
#1224.Problem
The early exit frees
This->pDfdand updatesThis->vkFormatbefore
constructing the replacement DFD withvk2dfd().If DFD creation ever reports a failure, the function returns with a
partially mutated texture: the original DFD has already been freed and
vkFormatalready describes ASTC HDR.Fix
Construct the replacement DFD first. Only after successful construction,
free the old DFD and commit the newpDfdandvkFormat.There is no behavior change on the success path. The path was
smoke-tested with an encode → relabel-transcode round trip.No regression test is included because the current generated mapping
containsVK_FORMAT_ASTC_4x4_SFLOAT_BLOCK, and there is no existing
failure-injection mechanism forvk2dfd(). This is therefore a defensive
transactional-ordering fix rather than a currently reproducible input-driven
failure.Co-authored-by: SashaRX 6702929+SashaRX@users.noreply.github.com
-
Expose more transcode formats and flags. (#1234) (02f39de) (@MarkCallow)
Expose the following that are in basis_universal but not previously in
libktx.HDR Formats: KTX_TTF_RGB_HALF, KTX_TTF_RGB9E5.
Flags: KTX_TF_NO_ETC1S_CHROMA_FILTERING.Rename KTX_TTF_BC6HU to KTX_TTF_BC6HU_RGB. Retain but deprecate the
old name.Deprecate KTX_TTF_ASTC_4x4_RGBA in favour of KTX_TTF_ASTC_LDR_4x4_RGBA
Fix description of KTX_TTF_RGBA_HALF and a multitude of errors in the
documentation for the ktxTexture2 transcode functions.Fixes #1221.
-
fix: ktxTexture_GetRowPitch erroneous padding with KTXv2 inputs (#1230) (5b7e9aa) (@walcht)
Fixes #1228.
-
Prior to this commit, ktxTexture_GetRowPitch always peforms padding to
4 even for KTXv2 inputs which should never be padded. -
Adds regression tests for ktxTexture_GetRowPitch vs.
ktxTexture_GetImageSize.
Signed-off-by: Walid Chtioui walid.chtioui.main@gmail.com
-
-
fix: minor memory leak with invalid ktxTexture2CreateInfo dimensions (#1227) (920ec48) (@walcht)
Fixes #1222.
The test I added fails, prior to this commit, when ran through ASan:
Signed-off-by: Walid Chtioui walid.chtioui.main@gmail.com
-
Fix docstring typo in ktx.h (#1219) (89d2b6e) (@petar-andrejic)
Docstring for
numLayerswas written asnumLevelswhich made it not
appear in the doxygen pages -
Fix use of StreambufStream for output by ktx tool suite (#1215) (e2f9480) (@MarkCallow)
The issue was that ktxStream
getpos()in theStreambufStream
implementation was always returning KTX_SUCCESS even when the stream was
not seekable. This led to a failed assert, so the failures were only
seen in Debug configurations.Add support to
StreambufStreamfor reading from std::cin and add tests
to streamtests. The ktx tool suite reads std::cin into a buffer which
it passes toStreambufStreamso does not need this functionality but
asStreambufStreamis available for anyone to use, it should support
it.Remove the stdio workaround the tool suite was using instead of
StreambufStream.IMPORTANT NOTE
This changes the typedef of
ktx_off_ton Windows from an unsigned to a
signed type which was always intended. The error was spotted during this
work as it caused a signed/unsigned mismatch with value of -1 returned
bystd::streambuf::pubseekoffon failure. -
Fix memory issues reported by asan (#1205) (926d495) (@walcht)
Also:
- change streamtests, texturetests, transcodetests and unittests to use smart pointers;
- add job to linux.yml to run Asan during CI;
- change streamtests to use
sbufstream.himplementation ofStreambufStreaminstead
of its own; - fix
StreambufStream::streambufimplementation to prevent link errors; - remove unnecessary destructor and destruct trampoline from
StreambufStream.
Signed-off-by: Walid Chtioui walid.chtioui.main@gmail.com
-
Update ASTC encoder to 5.6.0 (#1207) (2ca7d54) (@MarkCallow)
- Adapt our 3 direct callers, astc_codec, ktxdiff and command_extract,
to a small API change. - Switch imageio to use tinyexr.h from basis_universal which is
self-contained. The updated tinyexr.h in 5.6.0 requires either miniz.h,
which is not present in astc-encoder, or stb_zlib.h. It was easier to
use the self-contained one than figure out how to make dependent
projects find stb_zlib.h. - Adapt exrinput.cc to a small API change in TinyEXR present in
tinyexr.h in both astc-encoder and basis-universal which are very much
newer than the one in the previous version of atsc-encoder. - Remove unneeded link of imageio with libktx.
- Make explicit in the imageio #include directives where the header
files from other parts of the KTX-Software source come from. - Upgrade Android CI to NDK r27d from r25c to get more recent clang to
avoid "unsupported use of floating point exceptions" warning. r25c clang
was v14. cmake does not print the compiler version in r27d.
-ffp-exception-behaviordoes not appear in the compiles that are
failing. I suspect the culprit is-fno-math-errno, which is newly used
in 5.6.0, though the clang documentation for it says nothing about
exceptions.
- Adapt our 3 direct callers, astc_codec, ktxdiff and command_extract,
-
Fix memory leak in ktxHashList_DeleteKVPair/Entry functions (#1203) (44038c7) (@walcht)
Fixes #1202.
Signed-off-by: Walid Chtioui walid.chtioui.main@gmail.com
-
Fix minor documentation issues (#1199) (76b88d1) (@MarkCallow)
- A copy-paste error in ktx.h.
- Inadvertent inclusion of internal header in example code.
-
Export some missing functions (#1197) (d523970) (@tuket)
This PR exports some missing functions in ktx.h.
You could call those functions though the macros that do the vtable
dispatch. However, I have found that those macros are not suitable for
creating C# bindings.
Yes, you can call find those function pointers manually from C# and
perform the calls: I have done that and it works in Windows. The problem
comes when you compile for other platforms such as iOS and Wasm with AOT
(ahead of time compilation). When compiling with AOT calling function
pointers from C# will crash. -
Update basisu to v2.1.0 (#1170) (1dacc4b) (@MarkCallow)
git subrepo clone --branch=fixes_for_ktx --force https://github.com/KhronosGroup/basis\_universal.git external/basis_universal
subrepo:
subdir: "external/basis_universal"
merged: "a660e7be1"
upstream:
origin: "https://github.com/KhronosGroup/basis\_universal.git"
branch: "fixes_for_ktx"
commit: "a660e7be1"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7"Changes in KTX-Software to match the above:
- Remove check for unsupported stream semantic version in UASTC 6x6i as,
with this update, both versions are now supported. - Adapt to member name changes in basisu_compressor_params class.
- Use set_rgb_options() instead of individually setting the various sRGB related
options in basisu_compressor_params for increased robustness to future changes
and to handle changed default for m_ktx2_and_basis_srgb_transfer_function.
- Remove check for unsupported stream semantic version in UASTC 6x6i as,
-
Add workflow to check determinism (#1164) (bc8d0c2) (@MarkCallow)
A manually dispatched workflow to that runs the CTS, set to require exact
matches to golden files, on macOS, Ubuntu and Windows using arm64
and x86_86 processors, with ktx and libktx compiled with clang and gcc
and, in addition, on macOS AppleClang and on Windows ClangCL and msvc.Of necessity to avoid a build failure on the macos-15-intel runner, update
the version of zstd included in external/basis_universal/zstd.The failure arose due to a combination of three factors: zstd_errors.h
was not inexternal/basis_universal/zstdbut inother_Includewhich
is marked as a system directory; macos-15-intel has a newer version
installed in/usr/local/includewhich omits declaration of a function
libktx uses; the AppleClang version on that runner was searching
/usr/local/includebefore directories specified with-isystem, in
what looks like a bug. The updated version, from basis_universal 2.0,
declares the function that libktx uses inzstd.h. Furthermore it
includeszstd_errors.hin the same directory nullifying the-isystem
and conflicting version problems.
Tools
-
fix: metrics output to stderr if stdout is in use (#1240) (31145d1) (@walcht)
- PSNR and SSIM metrics now ouput to stderr if stdout is in use. This is
done to avoid polluting KTX file ouput to stdout which causes issues
when, for instance, output gets piped to ktx extract tool. - Fixes #1233
Signed-off-by: Walid Chtioui walid.chtioui.main@gmail.com
- PSNR and SSIM metrics now ouput to stderr if stdout is in use. This is
-
Expose more transcode formats and flags. (#1234) (02f39de) (@MarkCallow)
Expose the following that are in basis_universal but not previously in
libktx.HDR Formats: KTX_TTF_RGB_HALF, KTX_TTF_RGB9E5.
Flags: KTX_TF_NO_ETC1S_CHROMA_FILTERING.Rename KTX_TTF_BC6HU to KTX_TTF_BC6HU_RGB. Retain but deprecate the
old name.Deprecate KTX_TTF_ASTC_4x4_RGBA in favour of KTX_TTF_ASTC_LDR_4x4_RGBA
Fix description of KTX_TTF_RGBA_HALF and a multitude of errors in the
documentation for the ktxTexture2 transcode functions.Fixes #1221.
-
Fix use of StreambufStream for output by ktx tool suite (#1215) (e2f9480) (@MarkCallow)
The issue was that ktxStream
getpos()in theStreambufStream
implementation was always returning KTX_SUCCESS even when the stream was
not seekable. This led to a failed assert, so the failures were only
seen in Debug configurations.Add support to
StreambufStreamfor reading from std::cin and add tests
to streamtests. The ktx tool suite reads std::cin into a buffer which
it passes toStreambufStreamso does not need this functionality but
asStreambufStreamis available for anyone to use, it should support
it.Remove the stdio workaround the tool suite was using instead of
StreambufStream.IMPORTANT NOTE
This changes the typedef of
ktx_off_ton Windows from an unsigned to a
signed type which was always intended. The error was spotted during this
work as it caused a signed/unsigned mismatch with value of -1 returned
bystd::streambuf::pubseekoffon failure. -
Fix memory issues reported by asan (#1205) (926d495) (@walcht)
Also:
- change streamtests, texturetests, transcodetests and unittests to use smart pointers;
- add job to linux.yml to run Asan during CI;
- change streamtests to use
sbufstream.himplementation ofStreambufStreaminstead
of its own; - fix
StreambufStream::streambufimplementation to prevent link errors; - remove unnecessary destructor and destruct trampoline from
StreambufStream.
Signed-off-by: Walid Chtioui walid.chtioui.main@gmail.com
-
Update ASTC encoder to 5.6.0 (#1207) (2ca7d54) (@MarkCallow)
- Adapt our 3 direct callers, astc_codec, ktxdiff and command_extract,
to a small API change. - Switch imageio to use tinyexr.h from basis_universal which is
self-contained. The updated tinyexr.h in 5.6.0 requires either miniz.h,
which is not present in astc-encoder, or stb_zlib.h. It was easier to
use the self-contained one than figure out how to make dependent
projects find stb_zlib.h. - Adapt exrinput.cc to a small API change in TinyEXR present in
tinyexr.h in both astc-encoder and basis-universal which are very much
newer than the one in the previous version of atsc-encoder. - Remove unneeded link of imageio with libktx.
- Make explicit in the imageio #include directives where the header
files from other parts of the KTX-Software source come from. - Upgrade Android CI to NDK r27d from r25c to get more recent clang to
avoid "unsupported use of floating point exceptions" warning. r25c clang
was v14. cmake does not print the compiler version in r27d.
-ffp-exception-behaviordoes not appear in the compiles that are
failing. I suspect the culprit is-fno-math-errno, which is newly used
in 5.6.0, though the clang documentation for it says nothing about
exceptions.
- Adapt our 3 direct callers, astc_codec, ktxdiff and command_extract,
-
Write PNG colorspace info for linear inputs. (#1195) (b9bcfeb) (@MarkCallow)
Update CTS ref.
Fixes #1194.
Thanks to @walcht for the patch.
The good news is that a bunch of tests failed. I.e the tests include
many linear inputs. Now that the golden files have been regenerated, the
CTS will flag any regression. -
Record ASTC options in ktx encode (#1190) (5b65657) (@walcht)
Fixes #1188.
Signed-off-by: Walid Chtioui walid.chtioui.main@gmail.com
-
Fix ktx encode ASTC threads CL option capture (#1186) (04452ea) (@walcht)
Fixes #1185.
Signed-off-by: Walid Chtioui walid.chtioui.main@gmail.com
-
Fix handling of edge tiles in EXR input. (#1174) (93e5999) (@MarkCallow)
Use
tile.width&tlle.heightfor pointer calculations instead of header.tile_size.[xy]
thus avoiding crashes.Fixes #1173.
-
Fix tolerance handling for unnormalized formats (#1166) (4e0b328) (@MarkCallow)
The tolerance for unnormalized formats is now specified as a fraction of
the minimum of the two values being compared, given as a value between 0
and 1. For normalized formats the tolerance is, as before, specified as
the normalized value of the acceptable difference.The PR also adds a comparison for 16-bit unorm values.
Co-authored-by: Vineek nickvitsas@gmail.com
JS Bindings
-
Expose more transcode formats and flags. (#1234) (02f39de) (@MarkCallow)
Expose the following that are in basis_universal but not previously in
libktx.HDR Formats: KTX_TTF_RGB_HALF, KTX_TTF_RGB9E5.
Flags: KTX_TF_NO_ETC1S_CHROMA_FILTERING.Rename KTX_TTF_BC6HU to KTX_TTF_BC6HU_RGB. Retain but deprecate the
old name.Deprecate KTX_TTF_ASTC_4x4_RGBA in favour of KTX_TTF_ASTC_LDR_4x4_RGBA
Fix description of KTX_TTF_RGBA_HALF and a multitude of errors in the
documentation for the ktxTexture2 transcode functions.Fixes #1221.
-
Update KTX2Loader to use new UASTC_LDR_4x4 name. (#1208) (50536fd) (@MarkCallow)
Update UASTC4x4 names in doc. comments in transcoder.
-
Update basisu to v2.1.0 (#1170) (1dacc4b) (@MarkCallow)
git subrepo clone --branch=fixes_for_ktx --force https://github.com/KhronosGroup/basis\_universal.git external/basis_universal
subrepo:
subdir: "external/basis_universal"
merged: "a660e7be1"
upstream:
origin: "https://github.com/KhronosGroup/basis\_universal.git"
branch: "fixes_for_ktx"
commit: "a660e7be1"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7"Changes in KTX-Software to match the above:
- Remove check for unsupported stream semantic version in UASTC 6x6i as,
with this update, both versions are now supported. - Adapt to member name changes in basisu_compressor_params class.
- Use set_rgb_options() instead of individually setting the various sRGB related
options in basisu_compressor_params for increased robustness to future changes
and to handle changed default for m_ktx2_and_basis_srgb_transfer_function.
- Remove check for unsupported stream semantic version in UASTC 6x6i as,
-
Add basis_tex_format HDR names. (a880b32) (@MarkCallow)
-
Fix missing double-quote in doxygen comment. (f2d0ba2) (@MarkCallow)
Java Bindings
-
Expose more transcode formats and flags. (#1234) (02f39de) (@MarkCallow)
Expose the following that are in basis_universal but not previously in
libktx.HDR Formats: KTX_TTF_RGB_HALF, KTX_TTF_RGB9E5.
Flags: KTX_TF_NO_ETC1S_CHROMA_FILTERING.Rename KTX_TTF_BC6HU to KTX_TTF_BC6HU_RGB. Retain but deprecate the
old name.Deprecate KTX_TTF_ASTC_4x4_RGBA in favour of KTX_TTF_ASTC_LDR_4x4_RGBA
Fix description of KTX_TTF_RGBA_HALF and a multitude of errors in the
documentation for the ktxTexture2 transcode functions.Fixes #1221.
Python Bindings
-
Expose more transcode formats and flags. (#1234) (02f39de) (@MarkCallow)
Expose the following that are in basis_universal but not previously in
libktx.HDR Formats: KTX_TTF_RGB_HALF, KTX_TTF_RGB9E5.
Flags: KTX_TF_NO_ETC1S_CHROMA_FILTERING.Rename KTX_TTF_BC6HU to KTX_TTF_BC6HU_RGB. Retain but deprecate the
old name.Deprecate KTX_TTF_ASTC_4x4_RGBA in favour of KTX_TTF_ASTC_LDR_4x4_RGBA
Fix description of KTX_TTF_RGBA_HALF and a multitude of errors in the
documentation for the ktxTexture2 transcode functions.Fixes #1221.
-
Bump setuptools from 78.1.1 to 83.0.0 in /interface/python_binding (#1226) (6373ffb) (@dependabot[bot])
Recommended by dependabot for vulnerability.
External Package Dependencies
-
git subrepo pull external/basis_universal for updated CMakeLists.txt (#1232) (48b4e82) (@MarkCallow)
This updates the way of finding the python11 package to remove the need
for soon to be removed OLD CMP0148 policy, quieting warnings from
CMake >= 4.1.0.subrepo:
subdir: "external/basis_universal"
merged: "9bba38d63"
upstream:
origin: "https://github.com/KhronosGroup/basis\_universal.git"
branch: "fixes_for_ktx"
commit: "9bba38d63"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7" -
Update dfdutils for UB fix (left shift on signed int channel setting sign bit) (#1217) (96521b2) (@MarkCallow)
subrepo:
subdir: "external/dfdutils"
merged: "875e493a7"
upstream:
origin: "https://github.com/KhronosGroup/dfdutils.git"
branch: "main"
commit: "875e493a7"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7" -
Update ASTC encoder to 5.6.0 (#1207) (2ca7d54) (@MarkCallow)
- Adapt our 3 direct callers, astc_codec, ktxdiff and command_extract,
to a small API change. - Switch imageio to use tinyexr.h from basis_universal which is
self-contained. The updated tinyexr.h in 5.6.0 requires either miniz.h,
which is not present in astc-encoder, or stb_zlib.h. It was easier to
use the self-contained one than figure out how to make dependent
projects find stb_zlib.h. - Adapt exrinput.cc to a small API change in TinyEXR present in
tinyexr.h in both astc-encoder and basis-universal which are very much
newer than the one in the previous version of atsc-encoder. - Remove unneeded link of imageio with libktx.
- Make explicit in the imageio #include directives where the header
files from other parts of the KTX-Software source come from. - Upgrade Android CI to NDK r27d from r25c to get more recent clang to
avoid "unsupported use of floating point exceptions" warning. r25c clang
was v14. cmake does not print the compiler version in r27d.
-ffp-exception-behaviordoes not appear in the compiles that are
failing. I suspect the culprit is-fno-math-errno, which is newly used
in 5.6.0, though the clang documentation for it says nothing about
exceptions.
- Adapt our 3 direct callers, astc_codec, ktxdiff and command_extract,
-
git subrepo pull external/dfdutils for out-of-bounds memaccess fix (#1209) (8f87e76) (@MarkCallow)
subrepo:
subdir: "external/dfdutils"
merged: "fd3349ca0"
upstream:
origin: "https://github.com/KhronosGroup/dfdutils.git"
branch: "main"
commit: "fd3349ca0"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7" -
git subrepo pull external/dfdutils (c160217) (@MarkCallow)
subrepo:
subdir: "external/dfdutils"
merged: "d30085644"
upstream:
origin: "https://github.com/KhronosGroup/dfdutils.git"
branch: "main"
commit: "d30085644"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7" -
Update basisu to v2.1.0 (#1170) (1dacc4b) (@MarkCallow)
git subrepo clone --branch=fixes_for_ktx --force https://github.com/KhronosGroup/basis\_universal.git external/basis_universal
subrepo:
subdir: "external/basis_universal"
merged: "a660e7be1"
upstream:
origin: "https://github.com/KhronosGroup/basis\_universal.git"
branch: "fixes_for_ktx"
commit: "a660e7be1"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7"Changes in KTX-Software to match the above:
- Remove check for unsupported stream semantic version in UASTC 6x6i as,
with this update, both versions are now supported. - Adapt to member name changes in basisu_compressor_params class.
- Use set_rgb_options() instead of individually setting the various sRGB related
options in basisu_compressor_params for increased robustness to future changes
and to handle changed default for m_ktx2_and_basis_srgb_transfer_function.
- Remove check for unsupported stream semantic version in UASTC 6x6i as,
-
git subrepo push external/dfdutils (c827def) (@MarkCallow)
subrepo:
subdir: "external/dfdutils"
merged: "5c40d719a"
upstream:
origin: "https://github.com/KhronosGroup/dfdutils.git"
branch: "main"
commit: "5c40d719a"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7" -
git subrepo push external/basis_universal (4cbc043) (@MarkCallow)
subrepo:
subdir: "external/basis_universal"
merged: "e72b15c65"
upstream:
origin: "https://github.com/KhronosGroup/basis\_universal.git"
branch: "fixes_for_ktx_v5"
commit: "e72b15c65"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7" -
Add workflow to check determinism (#1164) (bc8d0c2) (@MarkCallow)
A manually dispatched workflow to that runs the CTS, set to require exact
matches to golden files, on macOS, Ubuntu and Windows using arm64
and x86_86 processors, with ktx and libktx compiled with clang and gcc
and, in addition, on macOS AppleClang and on Windows ClangCL and msvc.Of necessity to avoid a build failure on the macos-15-intel runner, update
the version of zstd included in external/basis_universal/zstd.The failure arose due to a combination of three factors: zstd_errors.h
was not inexternal/basis_universal/zstdbut inother_Includewhich
is marked as a system directory; macos-15-intel has a newer version
installed in/usr/local/includewhich omits declaration of a function
libktx uses; the AppleClang version on that runner was searching
/usr/local/includebefore directories specified with-isystem, in
what looks like a bug. The updated version, from basis_universal 2.0,
declares the function that libktx uses inzstd.h. Furthermore it
includeszstd_errors.hin the same directory nullifying the-isystem
and conflicting version problems.
Commits since v4.4.2 (by part with details)
Note: commits will appear in each part they affected.
libktx
-
Bump default version number. (#1161) (6c474d8) (@MarkCallow)
Various other issues were encountered and fixed while checking the
version number related changes.- Fix
-aoption ofmkversion. It did not visitlib/srcand ended
with an error due to a misplacedfi. - Fix RE in ktx convert that resulted in an extra space in an edited
KTXwriterScParams when the originalzcmpoption had a parameter. - Fix
ktxTexture2_IsHDRwhich was only checking for a FLOAT qualifier
on DFD samples for the ASTC color model. Add a test for it.
Fixes #1112.
- Fix
-
Fix build issues (#1160) (f2d222d) (@MarkCallow)
- Suppress what looks to be a bogus stringop-overflow warning from GCC,
observed with both versions 13 and 15. - Change outdated SSE and OPENCL option names to current names so they
are acted on properly.
Given the issues being fixed here, I am unable to understand why our CI
builds have been green. - Suppress what looks to be a bogus stringop-overflow warning from GCC,
-
Remove
--rec2020flag and add range mapping functionality toktx createandktx extract(#1157) (20211a2) (@ViNeek)This PR fixes #1142 and fixes #1127.
For #1127, it removes the flag from
ktx createandktx encodeand
makes sure that the profile is automatically inferred from the loaded
EXR file.For #1142 It adds 3 knew flags to
ktx create, namely,
map-range-auto,map-range-offsetandmap-range-scaleto be used
for mapping of floating point values in HDR formats.ktx extractis also updated to handle inverse mapping of values when
theKTXmapRangekey/value pair is present in a KTX2 file.Currenlty,
offsetandscaleare not used for the alpha channel.
Currently, range mapping only works with floating point data types and
the new HDR formats. -
Proper handling of --uastc-quality and --uastc-hdr-6x6i-level option values (#1149) (de9a41a) (@ViNeek)
This PR fixes #1146. The values are properly forwarded to the basis
encoder.Includes fix to make ktxdiff properly compare half-float files.
-
Ensure enums with ktx_uint32_t equivalents really are unsigned. (#1152) (23f560d) (@MarkCallow)
-
Update basisu for fixes backported from 2.0 (#1151) (43c716c) (@MarkCallow)
These are:
- Critical fixes for extreme inputs/outputs
- Compiler warning
- Fix parsing of uint64 in KTX2 header
- Fix initialization of astc_helper tables for transcoding.
Remove our workaround for the astc_helper tables not being initialized.
Fix ktxdiff to choose correct transcode target when comparing HDR
payloads. -
Expose HDR support in Python binding (#1150) (5444378) (@MarkCallow)
Fixes #1145.
Additional fixes:
- Adds
num_layersproperty that was curiously missing. - Exposes ktxTexture[12]_IsHDR in the c API.
- Reformats documentation comments for UASTC HDR ktxBasisParams to
reduce line width.
- Adds
-
Fix dumping of encoder input data (7ad1889) (@MarkCallow)
for compilers supporting std::filesystem and for HDR.
-
Fix validation warning for VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL c… (#1148) (2914abe) (@MarkCallow)
…ase.
For the
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMALcase of
setImageLayout, wheredstAccessMaskisVK_ACCESS_SHADER_READ_BIT,
settingdestStageFlagstoVK_PIPELINE_STAGE_ALL_COMMANDS_BITis
invalid usage and is flagged by the validator in recent Vulkan SDKs.
ChangedstStageFlagsfor this case to
VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT.Fixes #1092.
Includes completely unrelated fixes for warnings that are new in
Emscripten 5.0.3 so that CI builds are successful.- Set -Wno-experimental to disable compile- and link-time warnings that
sdl3 is still experimental. - Change
EMSCRIPTENpre-processor macro to__EMSCRIPTEN__to stop
deprecation warnings.
- Set -Wno-experimental to disable compile- and link-time warnings that
-
Document that GL_COMPRESSED_RGBA_ASTC formats are converted to SFLOAT equivalents. (1499a55) (@MarkCallow)
-
Enable decode and extraction of ASTC HDR. (#1143) (af3039c) (@MarkCallow)
Fixes #1140.
-
Remove dead code. (535c77d) (@MarkCallow)
-
CMake improvements for installing and dependencies (#1133) (8b925f2) (@MarkCallow)
- Handle installation of
KHR/khr_df.hfor KTX-Software in KTX-Software
(lib/CMakeLists.txt) avoiding some confusion and making installation
in a framework possible. - Use add_lib_dependency macro to add dfdutils dependency to libktx and
remove unnecessary PUBLIC export. - Use FILE_SETs for installation of both dfdutils and libktx include
files to handle the KHR subdirectory, with a workaround for framework
installation. - Up the cmake minimum version to 3.23 in both dfdutils CMakeLists and
lib CMakeLists.txt This is so- FILE_SET can be used
- KTX-Software can override options settings with ordinary variables
thus hiding unnecessary DFDUTILS options from the CMake GUI.
- Add option to turn off dfdutils docs build so
lib/CMakeLists.txtcan
do so. - Update dfdutils install to install library and
dfd.hin addition to
KHR/khr_df.h. This is behind an option so the KTX-Software build can
turn it off. - Include GNUInstallDirs to get proper values for CMAKE_INSTALL_.
- Normalize the indentation in dfdutils/CMakeLists.txt.
- Improve command clarity.
cmake --build ... --target installand the installable packages have
been tested on all 3 desktop platforms and the framework in the iOS .zip
file and content of the Android .zip file have been verified. All have
the expected content. - Handle installation of
-
Fix issue with HDR transcode and extract (#1139) (5d29c57) (@ViNeek)
The PR should fix the issues with
ktx extractfor both UASTC 4x4 and
UASTC 6x6i (see issue #1134). The code has also been patched to properly
extract mip map levels. Thank you @richgel999 for providing the code
snippet.Extraction from regular ASTC data
ktx extract --all astc_hdr_6x6.ktx2
won't work. Direct encoding/decoding of VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK
and VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK (or any other SFLOAT block size) is
not supported by the current version of the software. Same goes with
ktx create:A command like
ktx create --format VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK input.exr output.ktx2does not support the creation of an
VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK-encoded ktx2 file.Fixes #1134.
-
Add HDR support to vkloadtests (#1130) (dcc4346) (@MarkCallow)
Invoke with
--hdrto get an R16G16B16 HDR rendering surface.- Add support for transcoding the new HDR formats.
- Add a sample in each of UASTC HDR 4x4 and UASTC HDR 6x6i.
-
HDR Support for libktx and tools (#1100) (c0a32ef) (@ViNeek)
The pull request adds initial support for HDR data in libktx and tools
In particular,
- The CLI ktx tool is updated so that:
- the
ktx infocommand supports UASTC HDR payload formats as
defined in the KTX Specification. - the
ktx validatecommand implements new validation clauses related
to the UASTC HDR payload formats - the
ktx encodecommand now accepts uastc-hdr-4x4 and
uastc-hdr-6x6i as codec strings. - These codecs require the input file format to be either
R16G16B16_SFLOAT or R16G16B16A16_SFLOAT. - the
ktx createcommand when the encode parameter is used,
accepts uastc-hdr-4x4 and uastc-hdr-6x6i for the codec
parameter - if the input is raw, these codecs require the format parameter to be
either R16G16B16_SFLOAT or R16G16B16A16_SFLOAT; - if the input is not raw, the input files must be EXR with half-float
data type - the ktx transcode supports the two new codecs for input files:
- uastc-hdr-4x4 inputs must accept three targets: rgba16f,
astc-hdr-4x4, and bc6hu - uastc-hdr-6x6i inputs must accept three targets: rgba16f,
astc-hdr-6x6, and bc6hu - if an input file is neither of these two formats, the targets are
rejected, - the
ktx extractcommand supports the two new codecs for input files - uastc-hdr-4x4 inputs may be extracted as raw, or transcoded as in
ktx transcode - uastc-hdr-6x6i inputs require transcoding as in
ktx transcode
when used with this command - the
ktx comparecommand, when used with UASTC HDR 4x4 or UASTC
HDR 6x6 data and pixel comparison is requested, the image is
transcoded to uncompressed half-float values prior to comparison
- The existing JavaScript bindings is updated to support the new
functionality, specifically transcoding of UASTC HDR payloads
Incidentally fixes #1109.
-
Remove legacy tools (#1110) (05b0e02) (@MarkCallow)
- Remove legacy tools, documentation and references to them.
- Reorganize and normalize the names of still needed test images (now
under tests/resources). - Rewrite genktx2 script to generate needed .ktx2 resources using
ktx
suite. - Fix missing features and bugs in suite discovered when rewriting
genktx2:- Fix default imageio scanline reader to only buffer and rescale a
scanline's worth of pixels. - Add channel add/remove functionality to default scanline reader
asktx createalways requests 4 channels. - Fix ImageT::yflip to not attempt to yflip a 1 row image thus not
crash. - Add listing file support to
ktx createso multiple input files names
can be provided as a list in another file - Fix so sample qualifierLinear does not cause sameUnitAllChannels not
to be set.
- Fix default imageio scanline reader to only buffer and rescale a
- Fix unit tests to compile with c++20 and simplify file handling by
using std::filesystem.- texturetests, transcodetests, streamtests & threadtests now use
std::format. This PR works around GCC 11's (the GCC version on
Ubuntu 22.04 CI runners) lack of support for std::format by using
fmt::format in that case.
- texturetests, transcodetests, streamtests & threadtests now use
-
Add lock around transcoder initialization (#1098) (964acdc) (@MarkCallow)
Fixes #1087.
Add threadtests - though unsure how useful they are.
Update all libktx tests for c++20 as new tests need it for std::barrier.
Fixes basisu_c_binding build when ktx_read target is not included in
build.Big thanks to @vmwalker for reporting the problem and providing the fix.
-
Combine lib dependencies into static libktx on all desktop platforms (#1090) (5a07bc6) (@MarkCallow)
Previously this was only done on macOS - using
libtool. Changed to
a simple, though hard to find, cross-platform way to do this via CMake.Add CI test of build and use of a static library.
Remove macOS 13 build from CI as these runner images have been
retired from GitHub Actions. -
Fix use of libktx project as subproject outside of KTX-Software (#1089) (7f0f889) (@MarkCallow)
The Fix
- Always include
cmake/codesign.cmakeandcmake/cputypetest.cmake.
Addinclude_guard()to them to prevent multiple inclusion. - Add host project for testing sub-project use and update workflow
to build and run it and libktx.
Other Changes
- Add options to select building of full or read-only libktx.
- Fix macOS build when CODE_SIGN_IDENTITY not set. Fixes
both libktx and the larger KTX-Software project.
Fixes #1083
- Always include
-
Fix creating static ktx_read convenience lib (#1081) (4b46cda) (@dg0yt)
Fixes "duplicate member name" warnings:
[130/148] : [...] libtool -static -o /Users/vcpkg/Data/b/ktx/x64-osx-rel/libktx\_read.a /Users/vcpkg/Data/b/ktx/x64-osx-rel/libktx.a /Users/vcpkg/Data/b/ktx/x64-osx-rel/external/astc-encoder/Source/libastcenc-avx2-static.a /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: x86\_64h duplicate member name 'astcenc\_averages\_and\_directions.cpp.o' from '/Users/vcpkg/Data/b/ktx/x64-osx-rel/external/astc-encoder/Source/libastcenc-avx2-static.a(astcenc\_averages\_and\_directions.cpp.o)' and '/Users/vcpkg/Data/b/ktx/x64-osx-rel/libktx.a(astcenc\_averages\_and\_directions.cpp.o)' -
Update basis_universal (#1080) (422f501) (@MarkCallow)
master, in the fork from which we pull basis_universal, has been updated
to basis_universal master as of 2025.11.22, which includes all our
previous warning fixes. The changes there have been merged to the
cmake_fixesbranch we pull from.Also included:
- fix: change basis-related cmake option names to match those in
basis_universal and update workflows to set the new names; - fix: deploy x86_64 package, broken when build moved to x86_64 runner;
- enhancement: apply changes resulting from a review of the cmake_fixes
PR for basis_universal.
git subrepo clone --branch=cmake_fixes --force https://github.com/KhronosGroup/basis\_universal.git external/basis_universal
subrepo:
subdir: "external/basis_universal"
merged: "daf79c6ee"
upstream:
origin: "https://github.com/KhronosGroup/basis\_universal.git"
branch: "cmake_fixes"
commit: "daf79c6ee"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7"Fixes #1079.
- fix: change basis-related cmake option names to match those in
-
Required changes to work with basis_universal release 1.60+. (ac2edf1) (@MarkCallow)
- Stop direct inclusion of sources. Use their cmake project to build the
library as a subproject. - Adapt to renamed functions.
- Update reference files for changed encoder results.
Unrelated but necessary fixes:
- fix bug in build_macos_sh that preventing running of tests when
cross-compiling for x86_64 on arm64; - fix CI to build x86_64 macOS package on an x86_64 runner as the
x86_64 Java and Python tests will not run via Rosetta
- Stop direct inclusion of sources. Use their cmake project to build the
-
Create libktx project (#1071) (6765255) (@MarkCallow)
Move the libktx build from the root CMakeLists.txt to its own in the
libdirectory. Although still within KTX-Software, the new libktx
projectCMakeLists.txtcan be used as either a sub-project of
KTX-Software or as a standalone project to build just libktx.This has been done due to both direct requests, such as
https://github.com/KhronosGroup/KTX-Software/discussions/995 and
indirect requests such as complaints that the root CMakeLists is too
complicated. The effort has led to some useful cleanup and better
modularization.The following FEATURE options have been moved to the libktx project and
consequently renamed with aLIBKTXprefix:- LIBKTX_FEATURE_KTX1
- LIBKTX_FEATURE_KTX2
- LIBKTX_FEATURE_VK_UPLOAD
- LIBKTX_FEATURE_GL_UPLOAD
- LIBKTX_FEATURE_ETC_UNPACK
These options have been duplicated in the libktx project so they can be
set when it is the top-level project:- LIBKTX_EMBED_BITCODE
- LIBKTX_WERROR
When libktx is used as a sub-project, they are set from the similarly
named KTX-Software options.Add a workflow to test configuring and building a standalone libktx.
Along the way, fixed a bug, that caused configurations in the linux.yml
workflow that were supposed to incorporate OpenCL to not do so. However
it is not possible to run the tests on those configurations as the
Actions runners report the cpu type as "generic" so Portable OpenCL
(POCL) can't figure out what to do.Also along the way, update the ignore lists in all the workflow files to
include newer workflows files. -
Fix potential buffer read overflow in ktxTexture2_WriteToStream. (14bc6f0) (@MarkCallow)
This was caused on Android (Linux also?) by
memchrtrying to readnbytes wherenis the guard length passed to it before searching for the wanted character. Fix is to avoidmemchrand any other external function in the homegrownstrnlenused on Android, Linux, Windows and the web.Fixes #1064.
-
ktx create: add premultiply alpha option (#1049) (83d84dc) (@jiangzhhhh)
-
Add alpha pre-multiply function to image.hpp.
-
Update base Texture load test to check for pre-multiplied textures
and add a sample to the tests.
-
Tools
-
Bump default version number. (#1161) (6c474d8) (@MarkCallow)
Various other issues were encountered and fixed while checking the
version number related changes.- Fix
-aoption ofmkversion. It did not visitlib/srcand ended
with an error due to a misplacedfi. - Fix RE in ktx convert that resulted in an extra space in an edited
KTXwriterScParams when the originalzcmpoption had a parameter. - Fix
ktxTexture2_IsHDRwhich was only checking for a FLOAT qualifier
on DFD samples for the ASTC color model. Add a test for it.
Fixes #1112.
- Fix
-
Fix build issues (#1160) (f2d222d) (@MarkCallow)
- Suppress what looks to be a bogus stringop-overflow warning from GCC,
observed with both versions 13 and 15. - Change outdated SSE and OPENCL option names to current names so they
are acted on properly.
Given the issues being fixed here, I am unable to understand why our CI
builds have been green. - Suppress what looks to be a bogus stringop-overflow warning from GCC,
-
Fix handling of DFD linear qualifier (#1158) (3148f72) (@MarkCallow)
Fix
ktx createto set the linear qualifier according to the transfer
function and channel id, instead of always setting it to the default
value for the output VkFormat.Fix the validator to allow values that differ from the default provided
they comply with the KTX specification.Fixes #1156.
-
Change channelType to channelId to match latest KDFS. (#1155) (57ef740) (@MarkCallow)
-
Remove
--rec2020flag and add range mapping functionality toktx createandktx extract(#1157) (20211a2) (@ViNeek)This PR fixes #1142 and fixes #1127.
For #1127, it removes the flag from
ktx createandktx encodeand
makes sure that the profile is automatically inferred from the loaded
EXR file.For #1142 It adds 3 knew flags to
ktx create, namely,
map-range-auto,map-range-offsetandmap-range-scaleto be used
for mapping of floating point values in HDR formats.ktx extractis also updated to handle inverse mapping of values when
theKTXmapRangekey/value pair is present in a KTX2 file.Currenlty,
offsetandscaleare not used for the alpha channel.
Currently, range mapping only works with floating point data types and
the new HDR formats. -
Fix typo in comment. (bc8ec6c) (@MarkCallow)
-
Reinstate ktxtools_mainpage. (4ffa3f0) (@MarkCallow)
Fix issues in its content.
-
Document that GL_COMPRESSED_RGBA_ASTC formats are converted to SFLOAT equivalents. (1499a55) (@MarkCallow)
-
Enable decode and extraction of ASTC HDR. (#1143) (af3039c) (@MarkCallow)
Fixes #1140.
-
CMake improvements for installing and dependencies (#1133) (8b925f2) (@MarkCallow)
- Handle installation of
KHR/khr_df.hfor KTX-Software in KTX-Software
(lib/CMakeLists.txt) avoiding some confusion and making installation
in a framework possible. - Use add_lib_dependency macro to add dfdutils dependency to libktx and
remove unnecessary PUBLIC export. - Use FILE_SETs for installation of both dfdutils and libktx include
files to handle the KHR subdirectory, with a workaround for framework
installation. - Up the cmake minimum version to 3.23 in both dfdutils CMakeLists and
lib CMakeLists.txt This is so- FILE_SET can be used
- KTX-Software can override options settings with ordinary variables
thus hiding unnecessary DFDUTILS options from the CMake GUI.
- Add option to turn off dfdutils docs build so
lib/CMakeLists.txtcan
do so. - Update dfdutils install to install library and
dfd.hin addition to
KHR/khr_df.h. This is behind an option so the KTX-Software build can
turn it off. - Include GNUInstallDirs to get proper values for CMAKE_INSTALL_.
- Normalize the indentation in dfdutils/CMakeLists.txt.
- Improve command clarity.
cmake --build ... --target installand the installable packages have
been tested on all 3 desktop platforms and the framework in the iOS .zip
file and content of the Android .zip file have been verified. All have
the expected content. - Handle installation of
-
Fix issue with HDR transcode and extract (#1139) (5d29c57) (@ViNeek)
The PR should fix the issues with
ktx extractfor both UASTC 4x4 and
UASTC 6x6i (see issue #1134). The code has also been patched to properly
extract mip map levels. Thank you @richgel999 for providing the code
snippet.Extraction from regular ASTC data
ktx extract --all astc_hdr_6x6.ktx2
won't work. Direct encoding/decoding of VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK
and VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK (or any other SFLOAT block size) is
not supported by the current version of the software. Same goes with
ktx create:A command like
ktx create --format VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK input.exr output.ktx2does not support the creation of an
VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK-encoded ktx2 file.Fixes #1134.
-
Fix: stop extra swizzle when generating mipmaps. (#1137) (29a149c) (@MarkCallow)
And generate all mip levels from the base level instead of
the previous level.Fixes #1116.
-
Change default wrap mode to CLAMP. Remove deprecated oetf options. (dcd0e93) (@MarkCallow)
Fixes #1118.
-
Support loading tiled EXR files. (#1135) (3abe70a) (@MarkCallow)
Add face order info to --cubemap info in command_create.
Fixes issue #1111.
-
Change default primaries for EXR (#1128) (f1c169d) (@MarkCallow)
from UNSPECIFIED to BT709, per the EXR spec.
-
HDR Support for libktx and tools (#1100) (c0a32ef) (@ViNeek)
The pull request adds initial support for HDR data in libktx and tools
In particular,
- The CLI ktx tool is updated so that:
- the
ktx infocommand supports UASTC HDR payload formats as
defined in the KTX Specification. - the
ktx validatecommand implements new validation clauses related
to the UASTC HDR payload formats - the
ktx encodecommand now accepts uastc-hdr-4x4 and
uastc-hdr-6x6i as codec strings. - These codecs require the input file format to be either
R16G16B16_SFLOAT or R16G16B16A16_SFLOAT. - the
ktx createcommand when the encode parameter is used,
accepts uastc-hdr-4x4 and uastc-hdr-6x6i for the codec
parameter - if the input is raw, these codecs require the format parameter to be
either R16G16B16_SFLOAT or R16G16B16A16_SFLOAT; - if the input is not raw, the input files must be EXR with half-float
data type - the ktx transcode supports the two new codecs for input files:
- uastc-hdr-4x4 inputs must accept three targets: rgba16f,
astc-hdr-4x4, and bc6hu - uastc-hdr-6x6i inputs must accept three targets: rgba16f,
astc-hdr-6x6, and bc6hu - if an input file is neither of these two formats, the targets are
rejected, - the
ktx extractcommand supports the two new codecs for input files - uastc-hdr-4x4 inputs may be extracted as raw, or transcoded as in
ktx transcode - uastc-hdr-6x6i inputs require transcoding as in
ktx transcode
when used with this command - the
ktx comparecommand, when used with UASTC HDR 4x4 or UASTC
HDR 6x6 data and pixel comparison is requested, the image is
transcoded to uncompressed half-float values prior to comparison
- The existing JavaScript bindings is updated to support the new
functionality, specifically transcoding of UASTC HDR payloads
Incidentally fixes #1109.
-
Fix build problems w/ fmt and C++23 (#1102) (b3619b2) (@ltjax)
Fixes #1101 .
-
Remove legacy tools (#1110) (05b0e02) (@MarkCallow)
- Remove legacy tools, documentation and references to them.
- Reorganize and normalize the names of still needed test images (now
under tests/resources). - Rewrite genktx2 script to generate needed .ktx2 resources using
ktx
suite. - Fix missing features and bugs in suite discovered when rewriting
genktx2:- Fix default imageio scanline reader to only buffer and rescale a
scanline's worth of pixels. - Add channel add/remove functionality to default scanline reader
asktx createalways requests 4 channels. - Fix ImageT::yflip to not attempt to yflip a 1 row image thus not
crash. - Add listing file support to
ktx createso multiple input files names
can be provided as a list in another file - Fix so sample qualifierLinear does not cause sameUnitAllChannels not
to be set.
- Fix default imageio scanline reader to only buffer and rescale a
- Fix unit tests to compile with c++20 and simplify file handling by
using std::filesystem.- texturetests, transcodetests, streamtests & threadtests now use
std::format. This PR works around GCC 11's (the GCC version on
Ubuntu 22.04 CI runners) lack of support for std::format by using
fmt::format in that case.
- texturetests, transcodetests, streamtests & threadtests now use
-
Fix C++20 build issues. (#1104) (9d8594b) (@MarkCallow)
- Remove OutputString:: prefix from in class definition of constructor.
- Add u8string overload of InputStream constructor.
- Fix return type of from_u8string.
- Add from_u8string and to_u8string overloads that take u8string_view
and string_view respectively. - Provide overloads of fmtInFile and fmtOutFile that take u8string_view.
- Avoid use of filesystem::path::u8path in c++20 to avoid deprecation
warning.
-
Support listing files for multiple inputs and u8string utf8 utilities. (#1103) (bb7c7d1) (@MarkCallow)
This is a piece of legacy tool functionality, used in our asset
generation script, that was missing.This PR also adds a u8string version of the utf8 utilities in
platform_utils.h and u8string constructors to OutputStream{,Ex} to make
things work when building with c++20 and newer. All is protected by
macro checks for u8string support. -
Add convert command (#1099) (0eaebb0) (@MarkCallow)
For converting ktx v1 files.
Fixes formatting error in encode man page (doxygen).
-
Add lock around transcoder initialization (#1098) (964acdc) (@MarkCallow)
Fixes #1087.
Add threadtests - though unsure how useful they are.
Update all libktx tests for c++20 as new tests need it for std::barrier.
Fixes basisu_c_binding build when ktx_read target is not included in
build.Big thanks to @vmwalker for reporting the problem and providing the fix.
-
Required changes to work with basis_universal release 1.60+. (ac2edf1) (@MarkCallow)
- Stop direct inclusion of sources. Use their cmake project to build the
library as a subproject. - Adapt to renamed functions.
- Update reference files for changed encoder results.
Unrelated but necessary fixes:
- fix bug in build_macos_sh that preventing running of tests when
cross-compiling for x86_64 on arm64; - fix CI to build x86_64 macOS package on an x86_64 runner as the
x86_64 Java and Python tests will not run via Rosetta
- Stop direct inclusion of sources. Use their cmake project to build the
-
Create libktx project (#1071) (6765255) (@MarkCallow)
Move the libktx build from the root CMakeLists.txt to its own in the
libdirectory. Although still within KTX-Software, the new libktx
projectCMakeLists.txtcan be used as either a sub-project of
KTX-Software or as a standalone project to build just libktx.This has been done due to both direct requests, such as
https://github.com/KhronosGroup/KTX-Software/discussions/995 and
indirect requests such as complaints that the root CMakeLists is too
complicated. The effort has led to some useful cleanup and better
modularization.The following FEATURE options have been moved to the libktx project and
consequently renamed with aLIBKTXprefix:- LIBKTX_FEATURE_KTX1
- LIBKTX_FEATURE_KTX2
- LIBKTX_FEATURE_VK_UPLOAD
- LIBKTX_FEATURE_GL_UPLOAD
- LIBKTX_FEATURE_ETC_UNPACK
These options have been duplicated in the libktx project so they can be
set when it is the top-level project:- LIBKTX_EMBED_BITCODE
- LIBKTX_WERROR
When libktx is used as a sub-project, they are set from the similarly
named KTX-Software options.Add a workflow to test configuring and building a standalone libktx.
Along the way, fixed a bug, that caused configurations in the linux.yml
workflow that were supposed to incorporate OpenCL to not do so. However
it is not possible to run the tests on those configurations as the
Actions runners report the cpu type as "generic" so Portable OpenCL
(POCL) can't figure out what to do.Also along the way, update the ignore lists in all the workflow files to
include newer workflows files. -
ktx create: add premultiply alpha option (#1049) (83d84dc) (@jiangzhhhh)
-
Add alpha pre-multiply function to image.hpp.
-
Update base Texture load test to check for pre-multiplied textures
and add a sample to the tests.
-
JS Bindings
-
Remove
--rec2020flag and add range mapping functionality toktx createandktx extract(#1157) (20211a2) (@ViNeek)This PR fixes #1142 and fixes #1127.
For #1127, it removes the flag from
ktx createandktx encodeand
makes sure that the profile is automatically inferred from the loaded
EXR file.For #1142 It adds 3 knew flags to
ktx create, namely,
map-range-auto,map-range-offsetandmap-range-scaleto be used
for mapping of floating point values in HDR formats.ktx extractis also updated to handle inverse mapping of values when
theKTXmapRangekey/value pair is present in a KTX2 file.Currenlty,
offsetandscaleare not used for the alpha channel.
Currently, range mapping only works with floating point data types and
the new HDR formats. -
HDR Support for libktx and tools (#1100) (c0a32ef) (@ViNeek)
The pull request adds initial support for HDR data in libktx and tools
In particular,
- The CLI ktx tool is updated so that:
- the
ktx infocommand supports UASTC HDR payload formats as
defined in the KTX Specification. - the
ktx validatecommand implements new validation clauses related
to the UASTC HDR payload formats - the
ktx encodecommand now accepts uastc-hdr-4x4 and
uastc-hdr-6x6i as codec strings. - These codecs require the input file format to be either
R16G16B16_SFLOAT or R16G16B16A16_SFLOAT. - the
ktx createcommand when the encode parameter is used,
accepts uastc-hdr-4x4 and uastc-hdr-6x6i for the codec
parameter - if the input is raw, these codecs require the format parameter to be
either R16G16B16_SFLOAT or R16G16B16A16_SFLOAT; - if the input is not raw, the input files must be EXR with half-float
data type - the ktx transcode supports the two new codecs for input files:
- uastc-hdr-4x4 inputs must accept three targets: rgba16f,
astc-hdr-4x4, and bc6hu - uastc-hdr-6x6i inputs must accept three targets: rgba16f,
astc-hdr-6x6, and bc6hu - if an input file is neither of these two formats, the targets are
rejected, - the
ktx extractcommand supports the two new codecs for input files - uastc-hdr-4x4 inputs may be extracted as raw, or transcoded as in
ktx transcode - uastc-hdr-6x6i inputs require transcoding as in
ktx transcode
when used with this command - the
ktx comparecommand, when used with UASTC HDR 4x4 or UASTC
HDR 6x6 data and pixel comparison is requested, the image is
transcoded to uncompressed half-float values prior to comparison
- The existing JavaScript bindings is updated to support the new
functionality, specifically transcoding of UASTC HDR payloads
Incidentally fixes #1109.
-
Required changes to work with basis_universal release 1.60+. (ac2edf1) (@MarkCallow)
- Stop direct inclusion of sources. Use their cmake project to build the
library as a subproject. - Adapt to renamed functions.
- Update reference files for changed encoder results.
Unrelated but necessary fixes:
- fix bug in build_macos_sh that preventing running of tests when
cross-compiling for x86_64 on arm64; - fix CI to build x86_64 macOS package on an x86_64 runner as the
x86_64 Java and Python tests will not run via Rosetta
- Stop direct inclusion of sources. Use their cmake project to build the
Java Bindings
-
Update Java bindings for HDR support (#1147) (459c0a9) (@javagl)
The PR #1100 added HDR
support.This PR updates the Java bindings accordingly so fixes #1144.
What it does:
- Adds the
UASTC_HDR_6X6_INTERMEDIATEsupercompression scheme enum
value - Adds the
RGBA_HALF/ASTC_HDR_4x4_RGBA/ASTC_HDR_6x6_RGBAtranscode
format enum values - Adds a new
KtxBasisCodecclass, corresponding to the codec enum, as
requested in a review
comment - Adds the new fields that have been added to
ktxBasisParams(like
uastcHDRUltraQuantetc) to theKtxBasisParamsclass - (Minor corresponding cleanups)
- Wires the new fields to the native side accordingly, e.g.
initialize
and fills the native
struct - Adds native versions of the
KTX_API ktx_bool_t KTX_APIENTRY ktxTexture1_IsTranscodable(ktxTexture1* This);
functions (forKtxTexture1andKtxTexture2) - Adds
getColorModel,getTransferFunction,isHDR. - Adds a couple of tests.
- Adds the
-
HDR Support for libktx and tools (#1100) (c0a32ef) (@ViNeek)
The pull request adds initial support for HDR data in libktx and tools
In particular,
- The CLI ktx tool is updated so that:
- the
ktx infocommand supports UASTC HDR payload formats as
defined in the KTX Specification. - the
ktx validatecommand implements new validation clauses related
to the UASTC HDR payload formats - the
ktx encodecommand now accepts uastc-hdr-4x4 and
uastc-hdr-6x6i as codec strings. - These codecs require the input file format to be either
R16G16B16_SFLOAT or R16G16B16A16_SFLOAT. - the
ktx createcommand when the encode parameter is used,
accepts uastc-hdr-4x4 and uastc-hdr-6x6i for the codec
parameter - if the input is raw, these codecs require the format parameter to be
either R16G16B16_SFLOAT or R16G16B16A16_SFLOAT; - if the input is not raw, the input files must be EXR with half-float
data type - the ktx transcode supports the two new codecs for input files:
- uastc-hdr-4x4 inputs must accept three targets: rgba16f,
astc-hdr-4x4, and bc6hu - uastc-hdr-6x6i inputs must accept three targets: rgba16f,
astc-hdr-6x6, and bc6hu - if an input file is neither of these two formats, the targets are
rejected, - the
ktx extractcommand supports the two new codecs for input files - uastc-hdr-4x4 inputs may be extracted as raw, or transcoded as in
ktx transcode - uastc-hdr-6x6i inputs require transcoding as in
ktx transcode
when used with this command - the
ktx comparecommand, when used with UASTC HDR 4x4 or UASTC
HDR 6x6 data and pixel comparison is requested, the image is
transcoded to uncompressed half-float values prior to comparison
- The existing JavaScript bindings is updated to support the new
functionality, specifically transcoding of UASTC HDR payloads
Incidentally fixes #1109.
-
Remove legacy tools (#1110) (05b0e02) (@MarkCallow)
- Remove legacy tools, documentation and references to them.
- Reorganize and normalize the names of still needed test images (now
under tests/resources). - Rewrite genktx2 script to generate needed .ktx2 resources using
ktx
suite. - Fix missing features and bugs in suite discovered when rewriting
genktx2:- Fix default imageio scanline reader to only buffer and rescale a
scanline's worth of pixels. - Add channel add/remove functionality to default scanline reader
asktx createalways requests 4 channels. - Fix ImageT::yflip to not attempt to yflip a 1 row image thus not
crash. - Add listing file support to
ktx createso multiple input files names
can be provided as a list in another file - Fix so sample qualifierLinear does not cause sameUnitAllChannels not
to be set.
- Fix default imageio scanline reader to only buffer and rescale a
- Fix unit tests to compile with c++20 and simplify file handling by
using std::filesystem.- texturetests, transcodetests, streamtests & threadtests now use
std::format. This PR works around GCC 11's (the GCC version on
Ubuntu 22.04 CI runners) lack of support for std::format by using
fmt::format in that case.
- texturetests, transcodetests, streamtests & threadtests now use
-
Required changes to work with basis_universal release 1.60+. (ac2edf1) (@MarkCallow)
- Stop direct inclusion of sources. Use their cmake project to build the
library as a subproject. - Adapt to renamed functions.
- Update reference files for changed encoder results.
Unrelated but necessary fixes:
- fix bug in build_macos_sh that preventing running of tests when
cross-compiling for x86_64 on arm64; - fix CI to build x86_64 macOS package on an x86_64 runner as the
x86_64 Java and Python tests will not run via Rosetta
- Stop direct inclusion of sources. Use their cmake project to build the
-
Create libktx project (#1071) (6765255) (@MarkCallow)
Move the libktx build from the root CMakeLists.txt to its own in the
libdirectory. Although still within KTX-Software, the new libktx
projectCMakeLists.txtcan be used as either a sub-project of
KTX-Software or as a standalone project to build just libktx.This has been done due to both direct requests, such as
https://github.com/KhronosGroup/KTX-Software/discussions/995 and
indirect requests such as complaints that the root CMakeLists is too
complicated. The effort has led to some useful cleanup and better
modularization.The following FEATURE options have been moved to the libktx project and
consequently renamed with aLIBKTXprefix:- LIBKTX_FEATURE_KTX1
- LIBKTX_FEATURE_KTX2
- LIBKTX_FEATURE_VK_UPLOAD
- LIBKTX_FEATURE_GL_UPLOAD
- LIBKTX_FEATURE_ETC_UNPACK
These options have been duplicated in the libktx project so they can be
set when it is the top-level project:- LIBKTX_EMBED_BITCODE
- LIBKTX_WERROR
When libktx is used as a sub-project, they are set from the similarly
named KTX-Software options.Add a workflow to test configuring and building a standalone libktx.
Along the way, fixed a bug, that caused configurations in the linux.yml
workflow that were supposed to incorporate OpenCL to not do so. However
it is not possible to run the tests on those configurations as the
Actions runners report the cpu type as "generic" so Portable OpenCL
(POCL) can't figure out what to do.Also along the way, update the ignore lists in all the workflow files to
include newer workflows files.
Python Bindings
-
Bump default version number. (#1161) (6c474d8) (@MarkCallow)
Various other issues were encountered and fixed while checking the
version number related changes.- Fix
-aoption ofmkversion. It did not visitlib/srcand ended
with an error due to a misplacedfi. - Fix RE in ktx convert that resulted in an extra space in an edited
KTXwriterScParams when the originalzcmpoption had a parameter. - Fix
ktxTexture2_IsHDRwhich was only checking for a FLOAT qualifier
on DFD samples for the ASTC color model. Add a test for it.
Fixes #1112.
- Fix
-
Remove
--rec2020flag and add range mapping functionality toktx createandktx extract(#1157) (20211a2) (@ViNeek)This PR fixes #1142 and fixes #1127.
For #1127, it removes the flag from
ktx createandktx encodeand
makes sure that the profile is automatically inferred from the loaded
EXR file.For #1142 It adds 3 knew flags to
ktx create, namely,
map-range-auto,map-range-offsetandmap-range-scaleto be used
for mapping of floating point values in HDR formats.ktx extractis also updated to handle inverse mapping of values when
theKTXmapRangekey/value pair is present in a KTX2 file.Currenlty,
offsetandscaleare not used for the alpha channel.
Currently, range mapping only works with floating point data types and
the new HDR formats. -
Expose HDR support in Python binding (#1150) (5444378) (@MarkCallow)
Fixes #1145.
Additional fixes:
- Adds
num_layersproperty that was curiously missing. - Exposes ktxTexture[12]_IsHDR in the c API.
- Reformats documentation comments for UASTC HDR ktxBasisParams to
reduce line width.
- Adds
-
CMake improvements for installing and dependencies (#1133) (8b925f2) (@MarkCallow)
- Handle installation of
KHR/khr_df.hfor KTX-Software in KTX-Software
(lib/CMakeLists.txt) avoiding some confusion and making installation
in a framework possible. - Use add_lib_dependency macro to add dfdutils dependency to libktx and
remove unnecessary PUBLIC export. - Use FILE_SETs for installation of both dfdutils and libktx include
files to handle the KHR subdirectory, with a workaround for framework
installation. - Up the cmake minimum version to 3.23 in both dfdutils CMakeLists and
lib CMakeLists.txt This is so- FILE_SET can be used
- KTX-Software can override options settings with ordinary variables
thus hiding unnecessary DFDUTILS options from the CMake GUI.
- Add option to turn off dfdutils docs build so
lib/CMakeLists.txtcan
do so. - Update dfdutils install to install library and
dfd.hin addition to
KHR/khr_df.h. This is behind an option so the KTX-Software build can
turn it off. - Include GNUInstallDirs to get proper values for CMAKE_INSTALL_.
- Normalize the indentation in dfdutils/CMakeLists.txt.
- Improve command clarity.
cmake --build ... --target installand the installable packages have
been tested on all 3 desktop platforms and the framework in the iOS .zip
file and content of the Android .zip file have been verified. All have
the expected content. - Handle installation of
-
HDR Support for libktx and tools (#1100) (c0a32ef) (@ViNeek)
The pull request adds initial support for HDR data in libktx and tools
In particular,
- The CLI ktx tool is updated so that:
- the
ktx infocommand supports UASTC HDR payload formats as
defined in the KTX Specification. - the
ktx validatecommand implements new validation clauses related
to the UASTC HDR payload formats - the
ktx encodecommand now accepts uastc-hdr-4x4 and
uastc-hdr-6x6i as codec strings. - These codecs require the input file format to be either
R16G16B16_SFLOAT or R16G16B16A16_SFLOAT. - the
ktx createcommand when the encode parameter is used,
accepts uastc-hdr-4x4 and uastc-hdr-6x6i for the codec
parameter - if the input is raw, these codecs require the format parameter to be
either R16G16B16_SFLOAT or R16G16B16A16_SFLOAT; - if the input is not raw, the input files must be EXR with half-float
data type - the ktx transcode supports the two new codecs for input files:
- uastc-hdr-4x4 inputs must accept three targets: rgba16f,
astc-hdr-4x4, and bc6hu - uastc-hdr-6x6i inputs must accept three targets: rgba16f,
astc-hdr-6x6, and bc6hu - if an input file is neither of these two formats, the targets are
rejected, - the
ktx extractcommand supports the two new codecs for input files - uastc-hdr-4x4 inputs may be extracted as raw, or transcoded as in
ktx transcode - uastc-hdr-6x6i inputs require transcoding as in
ktx transcode
when used with this command - the
ktx comparecommand, when used with UASTC HDR 4x4 or UASTC
HDR 6x6 data and pixel comparison is requested, the image is
transcoded to uncompressed half-float values prior to comparison
- The existing JavaScript bindings is updated to support the new
functionality, specifically transcoding of UASTC HDR payloads
Incidentally fixes #1109.
-
Remove legacy tools (#1110) (05b0e02) (@MarkCallow)
- Remove legacy tools, documentation and references to them.
- Reorganize and normalize the names of still needed test images (now
under tests/resources). - Rewrite genktx2 script to generate needed .ktx2 resources using
ktx
suite. - Fix missing features and bugs in suite discovered when rewriting
genktx2:- Fix default imageio scanline reader to only buffer and rescale a
scanline's worth of pixels. - Add channel add/remove functionality to default scanline reader
asktx createalways requests 4 channels. - Fix ImageT::yflip to not attempt to yflip a 1 row image thus not
crash. - Add listing file support to
ktx createso multiple input files names
can be provided as a list in another file - Fix so sample qualifierLinear does not cause sameUnitAllChannels not
to be set.
- Fix default imageio scanline reader to only buffer and rescale a
- Fix unit tests to compile with c++20 and simplify file handling by
using std::filesystem.- texturetests, transcodetests, streamtests & threadtests now use
std::format. This PR works around GCC 11's (the GCC version on
Ubuntu 22.04 CI runners) lack of support for std::format by using
fmt::format in that case.
- texturetests, transcodetests, streamtests & threadtests now use
-
Required changes to work with basis_universal release 1.60+. (ac2edf1) (@MarkCallow)
- Stop direct inclusion of sources. Use their cmake project to build the
library as a subproject. - Adapt to renamed functions.
- Update reference files for changed encoder results.
Unrelated but necessary fixes:
- fix bug in build_macos_sh that preventing running of tests when
cross-compiling for x86_64 on arm64; - fix CI to build x86_64 macOS package on an x86_64 runner as the
x86_64 Java and Python tests will not run via Rosetta
- Stop direct inclusion of sources. Use their cmake project to build the
-
Create libktx project (#1071) (6765255) (@MarkCallow)
Move the libktx build from the root CMakeLists.txt to its own in the
libdirectory. Although still within KTX-Software, the new libktx
projectCMakeLists.txtcan be used as either a sub-project of
KTX-Software or as a standalone project to build just libktx.This has been done due to both direct requests, such as
https://github.com/KhronosGroup/KTX-Software/discussions/995 and
indirect requests such as complaints that the root CMakeLists is too
complicated. The effort has led to some useful cleanup and better
modularization.The following FEATURE options have been moved to the libktx project and
consequently renamed with aLIBKTXprefix:- LIBKTX_FEATURE_KTX1
- LIBKTX_FEATURE_KTX2
- LIBKTX_FEATURE_VK_UPLOAD
- LIBKTX_FEATURE_GL_UPLOAD
- LIBKTX_FEATURE_ETC_UNPACK
These options have been duplicated in the libktx project so they can be
set when it is the top-level project:- LIBKTX_EMBED_BITCODE
- LIBKTX_WERROR
When libktx is used as a sub-project, they are set from the similarly
named KTX-Software options.Add a workflow to test configuring and building a standalone libktx.
Along the way, fixed a bug, that caused configurations in the linux.yml
workflow that were supposed to incorporate OpenCL to not do so. However
it is not possible to run the tests on those configurations as the
Actions runners report the cpu type as "generic" so Portable OpenCL
(POCL) can't figure out what to do.Also along the way, update the ignore lists in all the workflow files to
include newer workflows files.
Build Scripts and CMake files
-
Fix syntax error. (ba74b8b) (@MarkCallow)
-
Force primary CTS platform for testing. (368132f) (@MarkCallow)
This is a hack. If it is decided to keep this feature it needs to be
done properly, e.g. by passing an argument from the manual workflow
to the those it is using. -
Add explanatory note. (0bb8a0b) (@MarkCallow)
-
Bump default version number. (#1161) (6c474d8) (@MarkCallow)
Various other issues were encountered and fixed while checking the
version number related changes.- Fix
-aoption ofmkversion. It did not visitlib/srcand ended
with an error due to a misplacedfi. - Fix RE in ktx convert that resulted in an extra space in an edited
KTXwriterScParams when the originalzcmpoption had a parameter. - Fix
ktxTexture2_IsHDRwhich was only checking for a FLOAT qualifier
on DFD samples for the ASTC color model. Add a test for it.
Fixes #1112.
- Fix
-
Fix build issues (#1160) (f2d222d) (@MarkCallow)
- Suppress what looks to be a bogus stringop-overflow warning from GCC,
observed with both versions 13 and 15. - Change outdated SSE and OPENCL option names to current names so they
are acted on properly.
Given the issues being fixed here, I am unable to understand why our CI
builds have been green. - Suppress what looks to be a bogus stringop-overflow warning from GCC,
-
Remove
--rec2020flag and add range mapping functionality toktx createandktx extract(#1157) (20211a2) (@ViNeek)This PR fixes #1142 and fixes #1127.
For #1127, it removes the flag from
ktx createandktx encodeand
makes sure that the profile is automatically inferred from the loaded
EXR file.For #1142 It adds 3 knew flags to
ktx create, namely,
map-range-auto,map-range-offsetandmap-range-scaleto be used
for mapping of floating point values in HDR formats.ktx extractis also updated to handle inverse mapping of values when
theKTXmapRangekey/value pair is present in a KTX2 file.Currenlty,
offsetandscaleare not used for the alpha channel.
Currently, range mapping only works with floating point data types and
the new HDR formats. -
Set link option only for Emscripten. (#1153) (cbdc1a6) (@MarkCallow)
-
Fix escaping of underbars in variable names (e2e6d46) (@MarkCallow)
so it only happens if the name is not in a backquoted section.
-
Reinstate ktxtools_mainpage. (4ffa3f0) (@MarkCallow)
Fix issues in its content.
-
Fix validation warning for VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL c… (#1148) (2914abe) (@MarkCallow)
…ase.
For the
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMALcase of
setImageLayout, wheredstAccessMaskisVK_ACCESS_SHADER_READ_BIT,
settingdestStageFlagstoVK_PIPELINE_STAGE_ALL_COMMANDS_BITis
invalid usage and is flagged by the validator in recent Vulkan SDKs.
ChangedstStageFlagsfor this case to
VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT.Fixes #1092.
Includes completely unrelated fixes for warnings that are new in
Emscripten 5.0.3 so that CI builds are successful.- Set -Wno-experimental to disable compile- and link-time warnings that
sdl3 is still experimental. - Change
EMSCRIPTENpre-processor macro to__EMSCRIPTEN__to stop
deprecation warnings.
- Set -Wno-experimental to disable compile- and link-time warnings that
-
Remove dead code. (535c77d) (@MarkCallow)
-
CMake improvements for installing and dependencies (#1133) (8b925f2) (@MarkCallow)
- Handle installation of
KHR/khr_df.hfor KTX-Software in KTX-Software
(lib/CMakeLists.txt) avoiding some confusion and making installation
in a framework possible. - Use add_lib_dependency macro to add dfdutils dependency to libktx and
remove unnecessary PUBLIC export. - Use FILE_SETs for installation of both dfdutils and libktx include
files to handle the KHR subdirectory, with a workaround for framework
installation. - Up the cmake minimum version to 3.23 in both dfdutils CMakeLists and
lib CMakeLists.txt This is so- FILE_SET can be used
- KTX-Software can override options settings with ordinary variables
thus hiding unnecessary DFDUTILS options from the CMake GUI.
- Add option to turn off dfdutils docs build so
lib/CMakeLists.txtcan
do so. - Update dfdutils install to install library and
dfd.hin addition to
KHR/khr_df.h. This is behind an option so the KTX-Software build can
turn it off. - Include GNUInstallDirs to get proper values for CMAKE_INSTALL_.
- Normalize the indentation in dfdutils/CMakeLists.txt.
- Improve command clarity.
cmake --build ... --target installand the installable packages have
been tested on all 3 desktop platforms and the framework in the iOS .zip
file and content of the Android .zip file have been verified. All have
the expected content. - Handle installation of
-
Add HDR support to vkloadtests (#1130) (dcc4346) (@MarkCallow)
Invoke with
--hdrto get an R16G16B16 HDR rendering surface.- Add support for transcoding the new HDR formats.
- Add a sample in each of UASTC HDR 4x4 and UASTC HDR 6x6i.
-
HDR Support for libktx and tools (#1100) (c0a32ef) (@ViNeek)
The pull request adds initial support for HDR data in libktx and tools
In particular,
- The CLI ktx tool is updated so that:
- the
ktx infocommand supports UASTC HDR payload formats as
defined in the KTX Specification. - the
ktx validatecommand implements new validation clauses related
to the UASTC HDR payload formats - the
ktx encodecommand now accepts uastc-hdr-4x4 and
uastc-hdr-6x6i as codec strings. - These codecs require the input file format to be either
R16G16B16_SFLOAT or R16G16B16A16_SFLOAT. - the
ktx createcommand when the encode parameter is used,
accepts uastc-hdr-4x4 and uastc-hdr-6x6i for the codec
parameter - if the input is raw, these codecs require the format parameter to be
either R16G16B16_SFLOAT or R16G16B16A16_SFLOAT; - if the input is not raw, the input files must be EXR with half-float
data type - the ktx transcode supports the two new codecs for input files:
- uastc-hdr-4x4 inputs must accept three targets: rgba16f,
astc-hdr-4x4, and bc6hu - uastc-hdr-6x6i inputs must accept three targets: rgba16f,
astc-hdr-6x6, and bc6hu - if an input file is neither of these two formats, the targets are
rejected, - the
ktx extractcommand supports the two new codecs for input files - uastc-hdr-4x4 inputs may be extracted as raw, or transcoded as in
ktx transcode - uastc-hdr-6x6i inputs require transcoding as in
ktx transcode
when used with this command - the
ktx comparecommand, when used with UASTC HDR 4x4 or UASTC
HDR 6x6 data and pixel comparison is requested, the image is
transcoded to uncompressed half-float values prior to comparison
- The existing JavaScript bindings is updated to support the new
functionality, specifically transcoding of UASTC HDR payloads
Incidentally fixes #1109.
-
Fix installation of test ktx files to resources on Windows. (#1117) (d58b713) (@MarkCallow)
ensure_runtime_dependencies_win was still trying copy a whole directory
which is no longer true after the reorganization. -
Remove legacy tools (#1110) (05b0e02) (@MarkCallow)
- Remove legacy tools, documentation and references to them.
- Reorganize and normalize the names of still needed test images (now
under tests/resources). - Rewrite genktx2 script to generate needed .ktx2 resources using
ktx
suite. - Fix missing features and bugs in suite discovered when rewriting
genktx2:- Fix default imageio scanline reader to only buffer and rescale a
scanline's worth of pixels. - Add channel add/remove functionality to default scanline reader
asktx createalways requests 4 channels. - Fix ImageT::yflip to not attempt to yflip a 1 row image thus not
crash. - Add listing file support to
ktx createso multiple input files names
can be provided as a list in another file - Fix so sample qualifierLinear does not cause sameUnitAllChannels not
to be set.
- Fix default imageio scanline reader to only buffer and rescale a
- Fix unit tests to compile with c++20 and simplify file handling by
using std::filesystem.- texturetests, transcodetests, streamtests & threadtests now use
std::format. This PR works around GCC 11's (the GCC version on
Ubuntu 22.04 CI runners) lack of support for std::format by using
fmt::format in that case.
- texturetests, transcodetests, streamtests & threadtests now use
-
Add convert command (#1099) (0eaebb0) (@MarkCallow)
For converting ktx v1 files.
Fixes formatting error in encode man page (doxygen).
-
Add lock around transcoder initialization (#1098) (964acdc) (@MarkCallow)
Fixes #1087.
Add threadtests - though unsure how useful they are.
Update all libktx tests for c++20 as new tests need it for std::barrier.
Fixes basisu_c_binding build when ktx_read target is not included in
build.Big thanks to @vmwalker for reporting the problem and providing the fix.
-
Combine lib dependencies into static libktx on all desktop platforms (#1090) (5a07bc6) (@MarkCallow)
Previously this was only done on macOS - using
libtool. Changed to
a simple, though hard to find, cross-platform way to do this via CMake.Add CI test of build and use of a static library.
Remove macOS 13 build from CI as these runner images have been
retired from GitHub Actions. -
Fix use of libktx project as subproject outside of KTX-Software (#1089) (7f0f889) (@MarkCallow)
The Fix
- Always include
cmake/codesign.cmakeandcmake/cputypetest.cmake.
Addinclude_guard()to them to prevent multiple inclusion. - Add host project for testing sub-project use and update workflow
to build and run it and libktx.
Other Changes
- Add options to select building of full or read-only libktx.
- Fix macOS build when CODE_SIGN_IDENTITY not set. Fixes
both libktx and the larger KTX-Software project.
Fixes #1083
- Always include
-
mkversion fix: make RE treat $(pwd) value literally. (#1088) (998a719) (@MarkCallow)
Fixes #1084.
-
Revise mkversion invocation (#1085) (2aa509d) (@dg0yt)
This is an untested rewrite of the line invoking
mkversionon
Windows, based on past vcpkg experience. (The current port version 4.4.2
doesn't invoke mkversion.)The original
"\"...\" ...."fails for some configurations.
It is a single CMake list item, with embedded quotes which go into a
build system rule which may or may not get the inner quotes correctly
for the actual invocation of the command.The rule of thumb is:
- Quote for CMake.
There is only outer quotes for items in a cmake list. - Do not assume a particular shell for commands executed by the build
system.
There are different generators for different build systems.
With ninja build files, commands may be executed via a shell or
directly, depending on the system.
With any type of inner quotes, portability will be limited.
The new line is a CMake list of command and items, with quoting for
CMake when items can expand with special characters inside.
(Now this newest version contains an embedded CMake variable
${MKV_VERSION_OPT}which I didn't quote because I assume it is of list
type, i.e. potentially expanding to multiple command line arguments.) - Quote for CMake.
-
Fix creating static ktx_read convenience lib (#1081) (4b46cda) (@dg0yt)
Fixes "duplicate member name" warnings:
[130/148] : [...] libtool -static -o /Users/vcpkg/Data/b/ktx/x64-osx-rel/libktx\_read.a /Users/vcpkg/Data/b/ktx/x64-osx-rel/libktx.a /Users/vcpkg/Data/b/ktx/x64-osx-rel/external/astc-encoder/Source/libastcenc-avx2-static.a /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: x86\_64h duplicate member name 'astcenc\_averages\_and\_directions.cpp.o' from '/Users/vcpkg/Data/b/ktx/x64-osx-rel/external/astc-encoder/Source/libastcenc-avx2-static.a(astcenc\_averages\_and\_directions.cpp.o)' and '/Users/vcpkg/Data/b/ktx/x64-osx-rel/libktx.a(astcenc\_averages\_and\_directions.cpp.o)' -
Update basis_universal (#1080) (422f501) (@MarkCallow)
master, in the fork from which we pull basis_universal, has been updated
to basis_universal master as of 2025.11.22, which includes all our
previous warning fixes. The changes there have been merged to the
cmake_fixesbranch we pull from.Also included:
- fix: change basis-related cmake option names to match those in
basis_universal and update workflows to set the new names; - fix: deploy x86_64 package, broken when build moved to x86_64 runner;
- enhancement: apply changes resulting from a review of the cmake_fixes
PR for basis_universal.
git subrepo clone --branch=cmake_fixes --force https://github.com/KhronosGroup/basis\_universal.git external/basis_universal
subrepo:
subdir: "external/basis_universal"
merged: "daf79c6ee"
upstream:
origin: "https://github.com/KhronosGroup/basis\_universal.git"
branch: "cmake_fixes"
commit: "daf79c6ee"
git-subrepo:
version: "0.4.9"
origin: "https://github.com/MarkCallow/git-subrepo.git"
commit: "4f60dd7"Fixes #1079.
- fix: change basis-related cmake option names to match those in
-
Required changes to work with basis_universal release 1.60+. (ac2edf1) (@MarkCallow)
- Stop direct inclusion of sources. Use their cmake project to build the
library as a subproject. - Adapt to renamed functions.
- Update reference files for changed encoder results.
Unrelated but necessary fixes:
- fix bug in build_macos_sh that preventing running of tests when
cross-compiling for x86_64 on arm64; - fix CI to build x86_64 macOS package on an x86_64 runner as the
x86_64 Java and Python tests will not run via Rosetta
- Stop direct inclusion of sources. Use their cmake project to build the
-
Add KTX_FEATURE_JS option controlling whether
ktx_js[_read]are built. (#1073) (952d74f) (@kring)(Reopening #1072, now targeting
main)Adds a new CMake option called
KTX_FEATURE_JS. It defaults to ON, but
when set to OFF,ktx_jsandktx_js_readare not built, even under
Emscripten.My use-case for this is compiling Cesium for
Unity for the web. Compiling
Unity applications to WebAssembly requires using Unity's version of
Emscripten, which is quite old (v3.1.39), and is not able to compile
ktx_jssuccessfully. This isn't really worth fixing because the
JavaScript bindings aren't used in this context anyway. KTX
functionality is only called from Emscripten'd native code, never from
regular JS code.So with this low-impact PR, it's easy to disable this unnecessary part
of the KTX software suite in order to get a successful build.The slightly bigger picture here is to then expose this via a vcpkg
feature flag. -
Create libktx project (#1071) (6765255) (@MarkCallow)
Move the libktx build from the root CMakeLists.txt to its own in the
libdirectory. Although still within KTX-Software, the new libktx
projectCMakeLists.txtcan be used as either a sub-project of
KTX-Software or as a standalone project to build just libktx.This has been done due to both direct requests, such as
https://github.com/KhronosGroup/KTX-Software/discussions/995 and
indirect requests such as complaints that the root CMakeLists is too
complicated. The effort has led to some useful cleanup and better
modularization.The following FEATURE options have been moved to the libktx project and
consequently renamed with aLIBKTXprefix:- LIBKTX_FEATURE_KTX1
- LIBKTX_FEATURE_KTX2
- LIBKTX_FEATURE_VK_UPLOAD
- LIBKTX_FEATURE_GL_UPLOAD
- LIBKTX_FEATURE_ETC_UNPACK
These options have been duplicated in the libktx project so they can be
set when it is the top-level project:- LIBKTX_EMBED_BITCODE
- LIBKTX_WERROR
When libktx is used as a sub-project, they are set from the similarly
named KTX-Software options.Add a workflow to test configuring and building a standalone libktx.
Along the way, fixed a bug, that caused configurations in the linux.yml
workflow that were supposed to incorporate OpenCL to not do so. However
it is not possible to run the tests on those configurations as the
Actions runners report the cpu type as "generic" so Portable OpenCL
(POCL) can't figure out what to do.Also along the way, update the ignore lists in all the workflow files to
include newer workflows files. -
ktx create: add premultiply alpha option (#1049) (83d84dc) (@jiangzhhhh)
-
Add alpha pre-multiply function to image.hpp.
-
Update base Texture load test to check for pre-multiplied textures
and add a sample to the tests.
-
-
Determine tools version at build time not config time (#1068) (0b3fad6) (@MarkCallow)
Otherwise the tools version may not reflect recent changes in
the worktree.Add comments pointing to docs for git describe output.