The data format descriptor (DFD) says exactly how the texels are stored: the colour
model, the colour space, the block size and where each channel sits in the bits. It is
defined by the Khronos Data Format Specification, and its position is given by
dfdByteOffset in the header. All
words are 32-bit little-endian.
Descriptor
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 4 | dfdTotalSize | Bytes of the whole descriptor including this field; equal to dfdByteLength. |
| 4 | varies | Descriptor blocks | One or more blocks, each a multiple of 4 bytes. KTX 2 files use the basic block below. |
Basic descriptor block
| Word | Bits | Field | Meaning |
|---|---|---|---|
| 0 | 0–16 | vendorId | 0 (Khronos) for the basic block. |
| 0 | 17–31 | descriptorType | 0 for the basic block. |
| 1 | 0–15 | versionNumber | 2 for version 1.3 of the specification. |
| 1 | 16–31 | descriptorBlockSize | Bytes in this block: 24 + 16 × the number of samples. |
| 2 | 0–7 | colorModel | Colour model (below). |
| 2 | 8–15 | colorPrimaries | Primaries and white point (below). |
| 2 | 16–23 | transferFunction | Transfer function (below). |
| 2 | 24–31 | flags | Bit 0: 1 = alpha premultiplied, 0 = straight alpha. |
| 3 | 4 × 8 | texelBlockDimension0–3 | Width, height, depth and fourth dimension of a texel block, each stored minus 1 (0 for single texels, 3 for 4 × 4 blocks). |
| 4–5 | 8 × 8 | bytesPlane0–7 | Bytes per block in each plane; KTX 2 data has one plane, or two for ETC1S with alpha. |
| 6 on | 4 words each | Samples | One per channel or bit field (below). |
Samples
| Word | Bits | Field | Meaning |
|---|---|---|---|
| 0 | 0–15 | bitOffset | First bit of the sample within the block. |
| 0 | 16–23 | bitLength | Number of bits, minus 1. |
| 0 | 24–27 | channelType | Which channel this is, numbered per colour model (below). |
| 0 | 28 | LINEAR | The sample ignores the transfer function (used for alpha in sRGB data). |
| 0 | 29 | EXPONENT | The sample is an exponent. |
| 0 | 30 | SIGNED | The sample is signed. |
| 0 | 31 | FLOAT | The sample is floating point. |
| 1 | 4 × 8 | samplePosition0–3 | Position of the sample within the block in each dimension. |
| 2 | 0–31 | sampleLower | Value that stands for the bottom of the range (0.0, or −1.0 for signed). |
| 3 | 0–31 | sampleUpper | Value that stands for the top of the range (1.0), such as 255 for an 8-bit normalised channel. |
Channel numbers for the RGBSDA model: red 0, green 1, blue 2, stencil 13, depth 14, alpha 15. Block-compressed models have their own channel numbers; for example ETC2 uses red 0, green 1, colour 2 and alpha 15, and ASTC a single data channel 0.
Colour models
| Value | Model | Value | Model |
|---|---|---|---|
| 0 | Unspecified | 128 | BC1A (DXT1) |
| 1 | RGBSDA: red, green, blue, stencil, depth, alpha | 129 | BC2 (DXT2, DXT3) |
| 2 | YUVSDA | 130 | BC3 (DXT4, DXT5) |
| 3 | YIQSDA | 131 | BC4 |
| 4 | LabSDA | 132 | BC5 |
| 5 | CMYKA | 133 | BC6H |
| 6 | XYZW | 134 | BC7 |
| 7 | HSVA, angular hue | 160 | ETC1 |
| 8 | HSLA, angular hue | 161 | ETC2 |
| 9 | HSVA, hexagonal hue | 162 | ASTC |
| 10 | HSLA, hexagonal hue | 163 | ETC1S (Basis Universal) |
| 11 | YCgCoA | 164 | PVRTC |
| 12 | YcCbcCrc (constant luminance) | 165 | PVRTC2 |
| 13 | ICtCp | 166 | UASTC (Basis Universal) |
| 14 | CIE XYZ | ||
| 15 | CIE xyY |
Primaries
| Value | Primaries | Value | Primaries |
|---|---|---|---|
| 0 | Unspecified | 6 | ACES |
| 1 | BT.709 (also sRGB) | 7 | ACEScc |
| 2 | BT.601 EBU | 8 | NTSC 1953 |
| 3 | BT.601 SMPTE | 9 | PAL 525 |
| 4 | BT.2020 | 10 | Display P3 |
| 5 | CIE XYZ | 11 | Adobe RGB |
Transfer functions
| Value | Transfer function | Value | Transfer function |
|---|---|---|---|
| 0 | Unspecified | 10 | PQ EOTF |
| 1 | Linear | 11 | PQ OETF |
| 2 | sRGB | 12 | DCI-P3 |
| 3 | ITU (BT.601, BT.709, BT.2020) | 13 | PAL OETF |
| 4 | NTSC | 14 | PAL 625 EOTF |
| 5 | S-Log | 15 | ST 240 |
| 6 | S-Log2 | 16 | ACEScc |
| 7 | BT.1886 | 17 | ACEScct |
| 8 | HLG OETF | 18 | Adobe RGB |
| 9 | HLG EOTF |
Rules in KTX 2
- With Zstandard or zlib supercompression the descriptor describes the data before compression.
- For BasisLZ the colour model is ETC1S (163), the texel block is 4 × 4
(
texelBlockDimension3, 3), andbytesPlane0is 8 (andbytesPlane18 when there is an alpha slice). The number of samples, one or two, says whether each image has an alpha slice. The channel IDs areETC1S_RGB= 0,ETC1S_RRR= 3,ETC1S_GGG= 4 andETC1S_AAA= 15. The valid combinations are RGB alone (one slice, opaque colour), RGB with AAA (colour plus alpha), RRR alone (one grey slice), and RRR with GGG (two independent grey components).vkFormatisVK_FORMAT_UNDEFINED. A sample’sbitLengthis stored as one less than the real width, so a 64-bit sample has 63; in the KTX 2 example the RGB sample is at bit offset 0 and the AAA sample at 64, both with qualifiers 0. The Data Format Specification’s own ETC1S description uses a single channel (value 0, calledETC1S_COLORorETC1S_DATA) for the whole 64-bit block; KTX 2 refines it with the IDs above. - For UASTC the colour model is UASTC (166) and
vkFormatisVK_FORMAT_UNDEFINED. The channel IDs areUASTC_RGB= 0 (three opaque components),UASTC_RGBA= 3 (colour and alpha),UASTC_RRR= 4 (one component replicated into red, green and blue),UASTC_RRRG= 5 (red replicated, green moved to alpha) andUASTC_RG= 6 (blue and alpha should not be sampled). RRRG cannot be transcoded to the red and green channels of ASTC or BC7. The block layout, bit offsets, lengths and qualifiers come from section 5.6.14 of the Data Format Specification 1.4, which was not read for this check. - For both Basis Universal formats the descriptor must describe the components given to the encoder, not those of the original image: if opaque alpha was removed before encoding, no alpha sample appears. With supercompression the descriptor must keep every field of the data before compression (colour model, transfer function, primaries, flags, block dimensions, bytes per plane, and each sample’s channel, qualifiers, bit offset and length, and lower and upper limits).
- For depth and stencil formats,
colorPrimariesis unspecified. - Earlier files wrote
bytesPlane0as 0 for supercompressed data; readers must still accept that.
A complete descriptor
The descriptor of VK_FORMAT_R8G8B8A8_SRGB: 92 bytes, one basic block
with four 8-bit samples. Alpha carries the LINEAR flag because the sRGB curve does not
apply to it.
5C 00 00 00 dfdTotalSize 92
00 00 00 00 02 00 58 00 vendor 0, type 0; version 2, block size 88
01 01 02 00 RGBSDA, BT.709, sRGB, straight alpha
00 00 00 00 04 00 00 00 00 00 00 00 1 × 1 texel blocks; 4 bytes in plane 0
00 00 07 00 00 00 00 00 00 00 00 00 FF 00 00 00 red: bits 0–7, 0 to 255
08 00 07 01 00 00 00 00 00 00 00 00 FF 00 00 00 green: bits 8–15
10 00 07 02 00 00 00 00 00 00 00 00 FF 00 00 00 blue: bits 16–23
18 00 07 1F 00 00 00 00 00 00 00 00 FF 00 00 00 alpha (15) + LINEAR: bits 24–31
Sources
- KTX File Format Specification, version 2.0 – Khronos Group: section 3.10 (Basis Universal DFD rules, re-read 13 November 2026)
- Khronos Data Format Specification 1.3 – the colour models up to 134 and 160 to 165, and the ETC1S description (re-read; UASTC and the first models were not in the part read)