Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
3c374a8
feat(ktx): add initial ktx input/output support.
walcht May 5, 2026
289bc14
Remove BCn and ETC encoders/decoders dependencies
walcht Jun 22, 2026
5f707f5
Merge branch 'main' into main
walcht Jun 22, 2026
dd28a48
Only build or find libktx on MSVC, Clang, or GCC
walcht Jun 22, 2026
b5e85b6
Merge branch 'main' of github.com:walcht/OpenImageIO
walcht Jun 22, 2026
3453812
Add to-native-data-format conversion
walcht Jun 29, 2026
1e60868
Override C/C++ compiler for KTX; revert CMAKE_VERSION in CI; misc ref…
walcht Jul 4, 2026
bef354e
Remove <vkformat_enum> include
walcht Jul 4, 2026
ae63741
Add alpha and ioproxy support to ktxinput/ktxoutput
walcht Jul 5, 2026
8b68531
Fix mismatching deallocation
walcht Jul 5, 2026
f1c19a9
CI: lower libktx version for 'oldest' CI runners
walcht Jul 5, 2026
7593501
Add Ktx_VERSION and use it in ktxinput
walcht Jul 5, 2026
e7c1fe3
Fix buffer cleanup using unique_ptr
walcht Jul 5, 2026
415b36d
Replace Ktx_GIT_TAG with Ktx_BUILD_VERSION
walcht Jul 5, 2026
29d45c6
Fix Intel-based MacOS libktx build issues
walcht Jul 5, 2026
a133b1f
Use set_cache() instead of set() to expose vars to CI runners
walcht Jul 5, 2026
05e3dde
Add description to set_cache()
walcht Jul 5, 2026
a7f95f6
Add support for older ktx build (v4.3.2)
walcht Jul 8, 2026
403f7f3
Add support for libktx 4.3.2
walcht Jul 8, 2026
f07af6e
Fix libktx 4.3.2 support
walcht Jul 8, 2026
9c918fc
Update libktx commit hash
walcht Jul 9, 2026
17e8f8d
Fix Ktx_VERSION and unique_ptr ktxTexture2 access
walcht Jul 9, 2026
534be09
Attempt to fix linkage issues with Intel-MacOS CI
walcht Jul 9, 2026
4822d66
Add support for libktx v0.0.0 to target main:HEAD of libktx
walcht Jul 9, 2026
7219ddf
Disable SSE4.2 for Intel-based MacOS CI
walcht Jul 10, 2026
a1ed2d3
TMP: disbable simd on Intel-MacOS and disable all other jobs
walcht Jul 10, 2026
61bee60
Remove custom libktx repository for Intel-MacOS
walcht Jul 10, 2026
e2b0c10
tmp
walcht Jul 10, 2026
f87f443
tmp
walcht Jul 10, 2026
01490b6
tmp
walcht Jul 10, 2026
a773a4c
tmp
walcht Jul 10, 2026
4bd07f9
Fix Intel-MacOS libktx linkage issues
walcht Jul 11, 2026
11034c5
Fix libktx CMAKE_ARGS lists
walcht Jul 11, 2026
c31baf0
Fix CMAKE_ARGS list
walcht Jul 11, 2026
c4134c6
tmp commit to save status
walcht Jul 17, 2026
0644e14
Add ktx input tests and remove libktx v4.3.2 support
walcht Jul 18, 2026
a883e53
Replace std::from_char with std::stol/std::stol
walcht Jul 18, 2026
b72dc17
fix: add ENABLE_KTX=0 to disable Ktx building and testing on old CIs
walcht Jul 18, 2026
68e223f
Update libktx commit hash and remove libktx 4.3.2 CMake support
walcht Jul 18, 2026
437abab
Fix UASTC/ETC1S Basis Universal attributes
walcht Jul 22, 2026
6ae4462
Replace OIIO_DASSERT* with OIIO_ASSERT
walcht Jul 22, 2026
35dbd42
Remove usage of designated initializers
walcht Jul 22, 2026
44fad0e
Merge remote-tracking branch 'oiio/main'
walcht Jul 22, 2026
0482ab5
Update libktx commit hash
walcht Jul 22, 2026
c037288
fixes: hdr support; uastc-hdr-4x4 transcoding; erroneous libktx assert
walcht Jul 27, 2026
b5634dd
Merge https://github.com/AcademySoftwareFoundation/OpenImageIO
walcht Aug 25, 2026
24520af
update libktx to 5.0.0-rc2 & address misc review comments
walcht Aug 27, 2026
a0c6c90
remove KTXwriterScParams from testsuite output
walcht Aug 27, 2026
985b9c5
clang-format-17
walcht Aug 27, 2026
72744ef
remove REQUIRED from jpegturbo dependency
walcht Aug 27, 2026
bc68244
reduce duplicate/unused includes
walcht Aug 28, 2026
2f51a1d
fix reading of metadata KVD; add cubemap & orientation support;
walcht Aug 31, 2026
f4c1f7d
Merge branch 'main' of github.com:AcademySoftwareFoundation/OpenImageIO
walcht Aug 31, 2026
8cdc724
clang-format-22
walcht Aug 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ jobs:
UHDR_CMAKE_CXX_COMPILER=g++
openjph_CMAKE_C_COMPILER=gcc
openjph_CMAKE_CXX_COMPILER=g++
# Building libuhdr with icx results in test failures
KTX_CMAKE_C_COMPILER=gcc
KTX_CMAKE_CXX_COMPILER=g++
# Building libuhdr and libktx with icx results in test failures
optional_deps_append: "LibRaw;Ptex;Qt6"
- desc: VFX2026 gcc14/C++20 py3.13 exr3.4 ocio2.5
nametag: linux-vfx2026
Expand Down Expand Up @@ -517,8 +519,10 @@ jobs:
TIFF_BUILD_VERSION=4.1.0
TIFF_GIT_COMMIT=e0d707dc1524d8c0e20f03396f234e0f1b07b3f4
LIBRAW_VERSION=0.21.0
ENABLE_KTX=0
# OpenJPEG_BUILD_VERSION=2.2.0
# OpenJPEG_GIT_COMMIT=3d7cde5fc9fbc5618d02160900d32e02ed12a00e
# libktx > 4.3.2 requires CMake >= 3.22
optional_deps_append: 'FFmpeg;LibRaw;Ptex;Qt6'
build_local_deps: 'TIFF'
- desc: oldest clang11/C++17 py3.9 exr3.1 ocio2.3
Expand Down Expand Up @@ -555,8 +559,10 @@ jobs:
LIBRAW_VERSION=0.21.0
nanobind_GIT_TAG=v2.8.0
nanobind_GIT_COMMIT=0e7aa61a75052034453cd2b906a79fe222792697
ENABLE_KTX=0
# OpenJPEG_BUILD_VERSION=2.2.0
# OpenJPEG_GIT_COMMIT=3d7cde5fc9fbc5618d02160900d32e02ed12a00e
# libktx > 4.3.2 requires CMake >= 3.22
optional_deps_append: 'FFmpeg;LibRaw;Ptex;Qt6'
build_local_deps: 'TIFF'

Expand Down Expand Up @@ -595,6 +601,8 @@ jobs:
Robinmap_GIT_COMMIT=188c45569cc2a5dd768077c193830b51d33a5020
TIFF_BUILD_VERSION=4.1.0
TIFF_GIT_COMMIT=e0d707dc1524d8c0e20f03396f234e0f1b07b3f4
ENABLE_KTX=0
# libktx > 4.3.2 requires CMake >= 3.22
required_deps: none
build_local_deps: 'TIFF'

Expand Down Expand Up @@ -657,6 +665,9 @@ jobs:
ctest_test_timeout: 1200
setenvs: export MACOSX_DEPLOYMENT_TARGET=12.0
INSTALL_QT=0 INSTALL_OPENCV=0 INSTALL_OPENVDB=0
Ktx_ASTCENC_ISA=ASTCENC_ISA_SSE41
# Intel-based MacOS runners don't support AVX2 SIMD which is the
# default set by libktx. Explicitly set to SSE4.1 (2nd fastest after AVX2)
optional_deps_append: 'OpenCV;OpenVDB;Qt5;Qt6'
benchmark: 1
- desc: MacOS-14-ARM aclang15/C++20/py3.13
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ gastest.o
/*.jxl
/*.tx
/*.log
/*.ktx2

# AI coding tool directories — generated locally by .agents/setup-agent
.claude/
Expand Down
90 changes: 90 additions & 0 deletions src/cmake/build_Ktx.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO

# TODO: update to v5.0.0 once libktx v5.0.0 is released
set_cache (Ktx_BUILD_VERSION v5.0.0-rc2 "Ktx version for local builds")
set (Ktx_GIT_REPOSITORY "https://github.com/KhronosGroup/KTX-Software.git")
set_cache (Ktx_GIT_TAG "${Ktx_BUILD_VERSION}" "Git branch or tag")
set_cache (Ktx_GIT_COMMIT "16059fa93d834242a0aaed9bb54952d76b143fac"
"commit hash to verify tag/branch against")
set_cache (Ktx_BUILD_SHARED_LIBS OFF #${LOCAL_BUILD_SHARED_LIBS_DEFAULT}
DOC "Should a local Ktx build, if necessary, build shared libraries" ADVANCED)

# TODO: if libktx is built as a shared library, astcenc have to be linked-against.
# I don't know how to 'cleanly' do this in OIIO CMake (yet).
# Even though all CIs pass, do not merge before addressing this!

string (MAKE_C_IDENTIFIER ${Ktx_BUILD_VERSION} Ktx_VERSION_IDENT)

# Override C/C++ compiler (useful when running CI with unsupported Intel's compiler ICX)
set_cache (KTX_CMAKE_C_COMPILER ${CMAKE_C_COMPILER} "libktx build C compiler override" ADVANCED)
set_cache (KTX_CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} "libktx build C++ compiler override" ADVANCED)

# The only tested libktx versions are:
# - v0.0.0 (main:HEAD which is versionless)
# - v5.0.0-rc1 (newest supported)
#
# for detailed build instructions, see:
# https://github.com/KhronosGroup/KTX-Software/blob/main/BUILDING.md
#
# KTX-Software not only provides Ktx but also a set of CLI tools and load
# test applications that we do not need. We only need the libktx component
# without any GPU texture loading functionalities.
#
# On x86_64, libktx defaults to using AVX2 for ASTC. For Intel-based MacOS, the
# default AVX2 requires x86_64h which may not be available (e.g., Intel-based
# MacOS Github Actions CIs). For ARM64 libktx defaults to using Neon. For
# 'unknown' CPUs, SIMD is disabled (see KTX-Software/lib/CMakeLists.txt for details).
#
# Possible values:
# - "": default, let libktx decide
# - ASTCENC_ISA_NATIVE: native SIMD
# - ASTCENC_ISA_NONE: disable SIMD
# - ASTCENC_ISA_SVE_256: slowest on Arm
# - ASTCENC_ISA_SVE_128: 2nd fastest on Arm
# - ASTCENC_ISA_NEON: fasted on Arm
# - ASTCENC_ISA_AVX2: fastest on x86_64 (may not be supported on Intel-based MacOS runners)
# - ASTCENC_ISA_SSE41: 2nd fastest on x86_64 (guaranteed to be supported)
# - ASTCENC_ISA_SSE2: slowest on x86_64 (guaranteed to be supported)
#
set_cache (Ktx_ASTCENC_ISA "" "ASTC specific SIMD instruction set. See astc-encoder/CMakeLists.txt for more details" ADVANCED)

set(CMAKE_ARGS_LIST
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_C_COMPILER=${KTX_CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${KTX_CMAKE_CXX_COMPILER}
-DBUILD_SHARED_LIBS=${Ktx_BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_LIBDIR=lib
-DLIBKTX_VERSION_READ_ONLY=OFF
-DLIBKTX_VERSION_FULL=ON
-DLIBKTX_FEATURE_KTX1=ON # Setting this to OFF causes linker issues
-DLIBKTX_FEATURE_KTX2=ON
-DLIBKTX_FEATURE_VK_UPLOAD=OFF
-DLIBKTX_FEATURE_GL_UPLOAD=OFF
-DLIBKTX_FEATURE_ETC_UNPACK=OFF # This has some weird licensing and I don't feel comfortable including it ...
)

if(Ktx_ASTCENC_ISA)
list(APPEND CMAKE_ARGS_LIST -D${Ktx_ASTCENC_ISA}=ON)
endif()

build_dependency_with_cmake(Ktx
VERSION ${Ktx_BUILD_VERSION}
GIT_REPOSITORY ${Ktx_GIT_REPOSITORY}
GIT_TAG ${Ktx_GIT_TAG}
GIT_COMMIT ${Ktx_GIT_COMMIT}
SOURCE_SUBDIR lib # To only build Ktx, cmake has to point to: KTX-Software/lib
CMAKE_ARGS ${CMAKE_ARGS_LIST}
)

# Set some things up that we'll need for a subsequent find_package to work
set (Ktx_ROOT ${Ktx_LOCAL_INSTALL_DIR})

# Signal to caller that we need to find again at the installed location
set (Ktx_REFIND TRUE)
set (Ktx_REFIND_ARGS CONFIG)

if (Ktx_BUILD_SHARED_LIBS)
install_local_dependency_libs (Ktx ktx) # notice libname is lowercase
endif ()
9 changes: 9 additions & 0 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,15 @@ else ()
get_target_property(FMT_INCLUDE_DIR fmt::fmt-header-only INTERFACE_INCLUDE_DIRECTORIES)
endif ()

# Note for Ktx plugin developers:
# set VERSION_MIN to 0.0.0 if you have a locally-built libktx tracking
# main branch of KTX-Software because building non-tagged libktx sets
# the version to 0.0.0.
checked_find_package (Ktx
# VERSION_MIN 0.0.0 # If you target main branch of KTX-Software (versionless)
VERSION_MIN 5.0.0
BUILD_LOCAL missing
)

###########################################################################

Expand Down
7 changes: 6 additions & 1 deletion src/cmake/testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ macro (oiio_add_all_tests)
oiio_add_tests (dpx
ENABLEVAR ENABLE_DPX
IMAGEDIR oiio-images/dpx URL "Recent checkout of OpenImageIO-images")
oiio_add_tests (ktx
ENABLEVAR ENABLE_KTX
IMAGEDIR oiio-images/ktx2)
oiio_add_tests (dds
ENABLEVAR ENABLE_DDS
IMAGEDIR oiio-images/dds URL "Recent checkout of OpenImageIO-images")
Expand Down Expand Up @@ -608,9 +611,11 @@ function (oiio_get_test_data name)
endfunction()

function (oiio_setup_test_data)
# TODO: revert this to target dev branch before merging
oiio_get_test_data (oiio-images
REPO https://github.com/AcademySoftwareFoundation/OpenImageIO-images.git
BRANCH dev-${OpenImageIO_VERSION_MAJOR}.${OpenImageIO_VERSION_MINOR})
BRANCH main)
# BRANCH dev-${OpenImageIO_VERSION_MAJOR}.${OpenImageIO_VERSION_MINOR})
oiio_get_test_data (openexr-images
REPO https://github.com/AcademySoftwareFoundation/openexr-images.git
BRANCH main)
Expand Down
Loading