KTX is a file format that can be used for storing GPU-ready texture data (with cubemaps, mip levels, etc). Like DDS but with more features and more formal specification. It supports Basis Universal transcodable formats and supercompression which can yield JPEG-sized universal textures. glTF will use Basis Universal textures in KTX v2 containers.
Click these links to see the latest published versions of the
KTX File Format Specification
or the KTX Fragment URI Specification
from the Khronos KTX Registry, visit the project's
GitHub Pages to see formatted
versions of the latest commits to main
(both options look much better than
the ersatz views provided by GitHub) or run
make
in a Unix-like environment with AsciiDoctor
installed to generate the publishable specs. They are the files out/specs/ktxspec.v2.html
and out/specs/ktx-frag.html
.
Everything needed is inlined.
The canonical KTX spec. text is in the file ktxspec.adoc
. The canonical fragment URI spec. text is in the file ktx-frag.html
.
If you have questions or comments that don't merit creating an issue such as "why did you do so-and-so?" use GitHub Discussions.
To ensure correct mappings from Vulkan's VkFormat
to other GPU APIs, this repo additionally contains:
- JSON database (schema) with mappings to OpenGL, Direct3D, and Metal enums.
- Switch-case generator that produces 5 files with simple C-like case-return statements.
Usage:
./generate_format_switches.rb [<out_dir>]
- Compile test of the case statements that serves as an example of use. To try the compile test do
cd switch_test
make
or
make testswitches