Skip to main content

GPU texture container

Keep the texture layout with the payload.

KTX and KTX2 package the metadata needed to interpret texture levels, arrays, cube maps, and compressed GPU data. KTX2 also provides a standard home for Basis Universal payloads.

loaders.gl support​

Portable texture delivery

Package once. Choose the GPU target at runtime.

Containers preserve dimensions and mip levels; portable payloads delay the final format choice until the application knows what the current device supports.

Runtime choice

mipsdevicetranscode

metadata · levels · capabilities

Renderer receives

BC / S3TCdesktop GPU target
ETC2 / ASTCmobile GPU target
Fallback pixelswhen compression is unavailable

The application keeps one asset pipeline while the renderer receives the representation its WebGL or WebGPU device can use efficiently.

Container responsibilities

Describe how the GPU should read the bytes.

KTX containers carry dimensions, levels, layers, faces, and format information alongside the image payload. The loader exposes that structure instead of reducing it to one ordinary image.

Layouts

2D, 3D, array, and cube texture images

Levels

Mip chains with dimensions and byte sizes

Payloads

Native compressed blocks or Basis supercompression

Runtime

Texture metadata for WebGL, WebGPU, or another renderer

KTX is the Khronos texture container format for GPU textures. It is designed to store texture metadata and one or more texture images in a layout that maps cleanly onto graphics APIs.

Detailed guide

KTX structure and runtime support

The sections below compare KTX revisions, describe supported container features, and show the loaders.gl return shapes.

KTX2 is the newer revision of the container. In realtime graphics workflows it is commonly used either for directly stored GPU texture payloads or as a container for Basis Universal supercompressed textures.

Why It Is Used​

KTX containers are designed for texture data rather than conventional images:

  • they can store mip chains
  • they can store array, 3D, and cube texture layouts
  • they preserve GPU-oriented format metadata
  • they avoid re-encoding texture payloads at load time

KTX vs KTX2​

FormatStatusNotes
KTX2Newer revisionCommon in modern realtime pipelines, including use as a container for Basis Universal payloads.
KTXOriginal revisionStill a Khronos texture container, but less flexible than KTX2 for newer workflows.

loaders.gl Support​

Format Featureloaders.gl SupportNotes
KTX container parsing✅Supported by CompressedTextureLoader.
KTX2 container parsing✅Supported by CompressedTextureLoader.
KTX2 Basis transcoding✅Use BasisLoader when the KTX2 payload needs Basis transcoding.
Mip level extraction✅Returned as TextureLevel[] or TextureLevel[][] depending on loader.
GPU format tagging✅loaders.gl maps known container formats to WebGL and canonical texture format identifiers.