24 KiB
Textures: the BCPack gap
Measured on 2026-11-21 from one retail Xbox Series install (1.0.2.1). The corpus is all 57
RDS5 texture pools: 46 under data/ttdb/** and 11 under pack/<name>/data/ttdb/**, 57.94 GiB
of files. Nothing below reproduces game data; every number is an aggregate or a descriptor
field.
Outcome
| Textures | |
|---|---|
| catalog entries | 357,115 |
| exported with the complete source mip chain | 98,603 |
| exported with fewer mips | 210,292 |
| exported at least one mip | 308,895 |
| skipped | 48,220 |
Bottom line: the gap is measurable and the codec mapping is certain, but BCPack itself is not decodable from public facts. No BCPack decoder is added. The compact mip chain, which the first measurement called the next tractable work, is now decoded and validated below; the remaining gap is BCPack.
This is the same 308,895 / 48,220 total already recorded in docs/design.md. The recount
splits the 48,220 by cause: the old "(BCPack or unmapped)" label hides 14,713 skips whose
recorded limitation is a layout/format check, not the codec, and overstates unmapped, which
is zero.
Skip breakdown
| Cause | Textures |
|---|---|
BCPack blocks every usable mip (TtpfReader: "All source mips require…") |
33,507 |
| compact mip mapping not in the validated profile table | 14,030 |
2D array / volume descriptor (dimension != 1 or depth != 1) |
678 |
element format not in the parser table (DXGI 11, R16G16B16A16_UNORM) |
5 |
| no mapped allocation ("unmapped shard") | 0 |
| total | 48,220 |
The compact row is not one thing:
- 13,979 of the 14,030 carry the descriptor's auxiliary-mapping bits. 13,954 of those are mode 4 or 6; the other 25 are modes 5, 7, 36 and 38. The other 51 compact records are modes 1, 32 or 34 without the aux flag.
- 11,570 of the 14,030 have no BCPack chunk anywhere. They fail because
ValidatedCompactProfilehas no entry for their(mode, width, height, mips, nonTail, bytes)tuple, not because of a codec. - 19 compact records could not be mapped to a layout for the storage cross-tab. They are included in the 14,030 and also fail the profile table.
The five format-11 records are 4×4, 8×4 or 128×4 R16G16B16A16_UNORM; the parser's
element-size table has no 8-byte entry for format 11. The 678 array/volume records are
non-2D descriptors (arrays or volumes), which the reader deliberately rejects until it has a
validated slice layout.
The BCPack footprint
The skip count is only the fully blocked textures. Counting mip 0 and the lower mips independently of the parser's profile checks gives the full footprint:
| mip 0 | lower mips | Textures |
|---|---|---|
| zlib/raw | zlib/raw | 305,264 |
| BCPack | at least one zlib/raw | 14,935 |
| zlib/raw | at least one BCPack | 9,999 |
| BCPack | every mip BCPack | 26,215 |
| no usable layout | — | 702 |
| total | 357,115 |
- 41,150 textures have BCPack in mip 0 (26,215 + 14,935).
- 26,215 have no zlib/raw mip at all, so they cannot export anything.
- 5,845 export from a lower mip because mip 0 is BCPack (
BaseMipLevel > 0). - 9,090 of the 14,935 are still skipped: 8,515 because no usable mip is entirely zlib/raw (the zlib block is mixed with BCPack or outside the usable range), 575 because the compact profile is not validated.
- 9,356 export the top mip but stop before at least one BCPack lower mip; 643 more are skipped for the compact profile before an export can happen.
Cross-tabulated against the skip table:
| Parser cause | all zlib | mip 0 zlib, lower BCPack | mip 0 BCPack, lower zlib | all BCPack | no layout | total |
|---|---|---|---|---|---|---|
| BCPack | 0 | 0 | 8,515 | 24,992 | 0 | 33,507 |
| compact profile | 11,570 | 643 | 575 | 1,223 | 19 | 14,030 |
| array/volume | 0 | 0 | 0 | 0 | 678 | 678 |
| format 11 | 0 | 0 | 0 | 0 | 5 | 5 |
| total | 11,570 | 643 | 9,090 | 26,215 | 702 | 48,220 |
The partial exports are a separate gap. Of the 210,292:
| Partial reason | Textures |
|---|---|
| compact profile, standalone mips exported, packed tail missing | 196,257 |
| lower mips BCPack | 8,052 |
| catalog top-only record | 314 |
| other (lower-mip export, mixed ranges) | 5,669 |
| total | 210,292 |
The packed-tail gap affects more textures than the BCPack skip count (196,257 partial
exports vs 33,507 skips), but it loses only the small mips. It is also not a BCPack problem:
196,257 textures stop at the descriptor's non_tail field because UsableMipLimit = NonTailMipCount for compact profiles, regardless of codec. The next section measures that
field against the layout and finds that it is not the tail boundary: most of the "packed
tail" is standalone mips the reader drops.
The compact mip chain
The 196,257 partial exports and the 14,030 compact-profile skips are the same layout
problem, not a codec problem. tools/ttpf_mips.py measures and decodes it; the counts below
come from its scan and check over the same 57 pools.
The descriptor mode is a flag plus a tile mode
TtpfReader reads the descriptor mode as one number (b >> 23) and selects a 64 KiB tile
only for mode 0. The observed values split into a low flag bit and a 4-bit Gfx10 tile mode at
bit 1:
(mode >> 1) & 0xF |
Gfx10 mode | Tile | Descriptors |
|---|---|---|---|
| 0 | SW_64KB_D |
64 KiB | 39,283 |
| 1 | SW_4KB_S |
4 KiB | 70,497 |
| 2 | SW_4KB_S |
4 KiB | 195,957 |
| 3 | SW_4KB_S |
4 KiB | 50,811 |
| 9–12 | array/volume | — | 567 |
Modes 9–12 are exactly the 567 cube descriptors; the other 111 array/volume records use tile
mode 0 or 1. Bit 0 of the field is independent: modes 4/5 share tile mode 2, 6/7 share tile
mode 3, and 36/38 share tile modes 2/3. The reader's mode == 0 test therefore gives a 4 KiB
layout to modes 1 and 32, which are 64 KiB. Fifteen mode 1/32 descriptors have a known element
size; all fifteen match a 64 KiB allocation span and one (maps_4_7 #6034) decodes at
0.00–0.33 levels (see below). The other 19 mode 1/32 records are the unknown-format ones in
the table below.
The layout is the AMD mip tail
The compact profile is the Gfx10 mip chain: standalone mips are padded to whole blocks and
stored smallest-first; a mip whose element count fits half a tile width and a tile height,
among the last 8 (4 KiB) or 12 (64 KiB) mips, goes into one shared tile at offset 0 at the
AMD entry offset (m = max_tail - 1 - k; entry = m > 6 ? 16 << m : m << 8).
On all 356,413 2D descriptors with a known element size — the 232,789 already-trusted compact
exports, the 14,011 layout-capable records the profile table rejects, and every non-compact
mode — the computed size equals next_allocation - base. There are 0 mismatches. The
remaining 702 descriptors are 678 arrays/volumes and 24 formats without an element-size
mapping.
non_tail is not the layout boundary
The descriptor's 3-bit non_tail field (b & 7) is where the reader stops, and its note calls
the remaining mips "packed tail". The bytes do not follow that split:
- 177,111 of the 232,789 compact exports have
non_tail < first_tail; 214,298 standalone mips lie beyond the limit, 204,108 of them in zlib/raw chunks. - 196,257 partial exports stop exactly at
non_tail; 158,272 of them stop before the computed tail boundary, and only 37,985 stop at it. - Of the 1,072,068 missing mips, 1,065,138 are in zlib/raw chunks. That decodable part splits into 193,019 standalone mips and 872,119 packed-tail mips; the other 6,930 missing mips (in 1,166 textures) touch BCPack.
UsableMipLimit = NonTailMipCount therefore drops decodable standalone mips, not only the
tile. The allocation spans and the decoded content both put the tail at the computed index.
The 14,030 profile-table records
| Textures | |
|---|---|
| same layout, new tuple (4 KiB) | 13,956 |
| same layout, modes 5/7/34/38 | 40 |
| same layout, 64 KiB (modes 1/32) | 15 |
| layout resolved | 14,011 |
| format without an element-size mapping | 19 |
| total | 14,030 |
- 11,570 have every mip in a zlib/raw chunk: all 35,727 mips decode (2.91 GiB decompressed).
- 469 more have a zlib/raw tail tile but a BCPack larger mip, so only their lower mips can be exported.
- The 19 blocked records are mode 1 (64 KiB) with DXGI formats 156, 199, 211 and 226; the format-to-element-size mapping is the only unknown, not the mip layout.
The five DXGI 11 (R16G16B16A16_UNORM) records are a separate one-line gap: DXGI 11 is 8
bytes per element, but the vendored element table has no entry. Their layout then matches,
but uncompressed tiling is not validated, so they are not exported here.
Sample validation
tools/ttpf_mips.py check detiles one chain, decodes BC1/BC3/BC4/BC5 and compares each mip
with a 2x2 box downsample of its parent at BC-block resolution (one block is 4x4 pixels). A
correct chain is 0–4 levels, as in the SixNG notes; the control is the first tail mip detiled
at origin (0,0).
| Pool # | Descriptor | Mips | non_tail / first_tail | Max error | Tail control |
|---|---|---|---|---|---|
interiors_0_3 #19 |
512×256 BC1 | 7 | 1 / 3 | 0.38 | 126.06 |
interiors_0_3 #10 |
512×512 BC1 | 8 | 3 / 3 | 0.46 | 57.94 |
graphics #43 |
64×512 BC1 | 10 | 1 / 3 | 1.08 | 132.31 |
interiors_2_3 #468 |
512×512 BC1 | 8 | 3 / 3 | 0.60 | 113.83 |
maps_0_7 #3217 |
128×128 BC1 | 6 | 0 / 1 | 0.79 | 114.71 |
peds_1_3 #527 |
512×512 BC1 | 8 | 3 / 3 | 3.87 | 83.83 |
maps_1_7 #1500 |
128×256 BC4 | 6 | 1 / 2 | 0.34 | 72.08 |
decorations_0_3 #818 |
128×128 BC5 | 6 | 1 / 2 | 0.02 | 85.48 |
interiors_1_3 #507 |
256×256 BC3 | 7 | 1 / 2 | 1.21 | 51.84 |
interiors_0_3 #19 is a partial export: the reader emits one mip, while all seven decode and
match. graphics #43 and interiors_2_3 #468 are tuples outside the table; maps_0_7 #3217
is mode 34 with non_tail = 0, which would leave zero standalone mips even if the mode gate
passed.
BC7 was checked on two samples with an external decoder (Pillow, not a dependency of the
tool): terrain_4_7 #23 (512×512, 3 mips, 0.35–0.49) and maps_4_7 #6034 (1024×1024, mode
32, 64 KiB, 0.00–0.33, control 4.44).
For interiors_0_3 #19 the tool reports the byte layout: mip 0 (512×256, 128×64 blocks) at
24,576, mip 1 (256×128, 64×32) at 8,192, mip 2 (128×64, 32×16) at 4,096, then the 4 KiB tile
at 0 with mip 3 (64×32 px, 16×8 blocks) at origin (16,0), mip 4 (32×16 px, 8×4) at (8,8),
mip 5 (16×8 px, 4×2) at (0,12) and mip 6 (8×4 px, 2×1) at (0,8). The mip byte sizes 65,536 /
16,384 / 4,096 / 1,024 / 256 / 64 / 16 are exactly the BC1 block counts, and the exported DDS
is 87,524 bytes (148 + 87,376).
What this unlocks
"Decompressed" is the block-linear BC payload size (blocks × block bytes), not the inflated
chunk size, which includes tile padding.
| Textures | New mips | Decompressed | |
|---|---|---|---|
| partial exports that become complete | 195,091 | 1,065,138 | 1.69 GiB |
| compact skips that become complete | 11,570 | 35,727 | 2.91 GiB |
| total | 206,661 | 1,100,865 | 4.59 GiB |
1,166 of the 196,257 partials still miss 6,930 mips that touch BCPack; those and the 33,507 fully blocked textures wait on the codec. Nothing here decodes BCPack.
What BCPack is
BCPack is the Xbox Series hardware decompression codec for BCn texture data. The public GDK enum exposes seven modes, one per BCn format (BC1–BC7); DirectStorage applies it after DEFLATE and before the optional swizzle. It is not a replacement for BCn: it is an entropy-coded preconditioner whose output is a standard BCn block stream. That is why a BCPack chunk has a BCn codec id, not a separate texture format, and why the container can mix zlib and BCPack chunks inside one texture.
What the container says
The RDS5 index is readable without game code:
| Field | Value |
|---|---|
| magic | RDS5 at 0x00 |
| virtual size | 56 bits at 0x08; top byte 0x16 |
| entry count | u32 at 0x04; chunks = count − 2, and the table's last entry is the sentinel |
| chunk table | 0x18, 8 bytes per entry, (count − 1) * 8 bytes |
| ETPF index | align(0x18 + (count − 1) * 8, 0x100); version 634 (0x27A) |
| texture records | a 16-byte ETPF header, then area bytes of records (at least 16 × textures) |
| asset keys | one u64 per record after the descriptor array; IDs are 32 bytes each |
Chunk entry (u64 value):
| Field | Bits | Meaning |
|---|---|---|
| physical offset | 0–25 | × 256; 256-byte aligned |
| codec | 26–29 | 0 raw, 1–7 BCPack BC1–BC7, 8 zlib |
| virtual offset | 30–51 | × 4096; 4 KiB aligned |
| padding | 52–63 | 12-bit byte count at the end of the physical range |
The parser reads 357,115 texture records and 1,026,833 chunks from the 57 pools with no exceptions. The chunk table's offsets are 256-byte aligned (physical) and 4 KiB aligned (virtual), and the virtual ranges cover every allocation the parser could lay out. The 12-bit padding on BCPack chunks is zero-filled (see the header section).
Codec ids are the BCPack mode
The on-disk codec ids are 0x04, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20; shifting right by 26
normalizes them to 1, 3, 4, 5, 6, 7, 8. Across 1,026,833 chunks there is not one
format/codec mismatch:
| codec | BCn mode | DXGI formats seen | Chunks | Packed MiB | Decoded MiB | Saving |
|---|---|---|---|---|---|---|
| 0 | raw | 83, 98, 99 | 5 | 0.1 | 0.1 | 0.0% |
| 1 | BC1 | 71, 72 | 102,725 | 10,637.9 | 14,630.9 | 27.3% |
| 2 | BC2 | — | 0 | — | — | — |
| 3 | BC3 | 77, 78 | 35 | 7.4 | 10.1 | 26.3% |
| 4 | BC4 | 80 | 77 | 1.4 | 1.5 | 6.2% |
| 5 | BC5 | 83 | 333 | 60.6 | 74.6 | 18.8% |
| 6 | BC6H | 95, 96 | 268 | 67.8 | 79.1 | 14.2% |
| 7 | BC7 | 98, 99 | 5,167 | 1,097.3 | 1,221.5 | 10.2% |
| 8 | zlib (RFC 1950) | all | 918,223 | 47,179.3 | 128,529.3 | 63.3% |
| total | 1,026,833 | 59,051.8 | 144,547.1 | 59.1% |
BCPack is 11.6 GiB of the 57.7 GiB chunk payload (20.1%), and BC1 is 10.4 GiB of that
(89.6%). The saving column is 1 − Σ packed / Σ decoded; it includes tile padding, so it is
not the codec's saving on block data alone.
This mapping is the strongest evidence that the codec field is the GDK's
DSTORAGE_BCPACK_MODE (1 = BC1 … 7 = BC7), not a generic compression id. The field is per
chunk, so a texture can mix zlib and BCPack mips; 15,201 partial exports do.
The descriptor mode is tiling, not codec
The ETPF descriptor's mode field (b >> 23) is the mip/tile family: mode 0 uses 64 KiB
blocks (SW_64KB_D), every other observed mode uses 4 KiB blocks (SW_4KB_S). It is
independent of the chunk codec. Formats 71/72 use 8-byte BC1 blocks, 74/75/77/78/83/84/95/96/
98/99 use 16-byte blocks, and 80/81 use 8-byte BC4 blocks. No BC2 (codec 2) texture exists in
this install.
The chunk header
A BCPack chunk is not a self-describing container. A 256-byte dump of the first chunk of each of the three entries below contains no magic, version, total length or format at offset 0. The only readable structure is the lane record area:
- The independent SixNG notes describe the first 48 bytes as eight lane records, column-interleaved: one byte per lane per round, six rounds. The byte-1 regularity below is consistent with that layout.
- The rest is entropy-coded lane data (rANS renormalization and prefetch in the SixNG description). Entropy on 300 sampled chunks per codec is 7.96–7.99 bits/byte. No general-purpose wrapper was found in the sampled chunks; zlib, gzip, bzip2 and LZMA reject the first bytes, and raw-deflate attempts on random data are not a valid stream.
- Padding is zero-filled: every padding run starts with zero bytes (checked
min(16, pad)bytes of all 108,229 padded BCPack chunks: 102,368 BC1, 35 BC3, 76 BC4, 332 BC5, 268 BC6H, 5,150 BC7). That is how the physical ranges reach the next 256-byte boundary.
Three skipped entries, with the fields the container actually exposes:
| Pool / index | Descriptor | Allocation | Chunks |
|---|---|---|---|
graphics/ttdb_graphics.ttpf #309 |
128×128 BC1_UNORM, 8 mips, mode 2 (4 KiB) | 12,288 B | 1 × codec 1: packed 7,648, pad 544 |
ui/ttdb_ui.ttpf #0 |
512×512 BC1_UNORM, 1 mip, mode 0 (64 KiB) | 131,072 B | 1 × codec 1: packed 87,933, pad 899 |
terrain/ttdb_terrain_0_7.ttpf #1537 |
512×1024 BC7_UNORM, 8 mips, mode 4 (4 KiB) | 700,416 B | 4 × codec 7; top chunk packed 499,734 of 524,288, pad 234 |
The first two bytes of those payloads are lane 0 and lane 1 modes: 0x1f 0xde,
0x35 0xde, and 0x30 0x30. The full-corpus counts are the useful part:
| Codec | Chunks | Byte 1 value | Count |
|---|---|---|---|
| 1 (BC1) | 102,725 | 0xde |
102,725 / 102,725 |
| 3 (BC3) | 35 | 0xdb |
35 / 35 |
| 4 (BC4) | 77 | 0xde |
77 / 77 |
| 5 (BC5) | 333 | 0xdb |
333 / 333 |
| 6 (BC6H) | 268 | 0x30–0x36 |
268 / 268 |
| 7 (BC7) | 5,167 | 0x30–0x33 |
4,978 / 5,167 |
The byte-1 value is constant within a codec (BC1/BC4 use 0xde, BC3/BC5 use 0xdb), and it
is the only fixed-offset value found. Byte 0 is often 0x30–0x37 on BC1, but the rest
includes 0x14–0x1f, 0x5f and 0xde, so it is not a magic. BC6H uses only 0x30–0x36;
BC7 has no constant byte 1 and its remaining 189 records use 0xdb, 0x1c–0x1e and
similar lane modes. The 256-byte dumps are not committed because they are game bytes; the
table above and the container descriptors are the readable facts.
Public sources and licences
| Source | Facts used | Licence / use |
|---|---|---|
| DSTORAGE_BCPACK_MODE | Modes 1–7 are BC1, BC2, BC3, BC4, BC5, BC6H, BC7; Xbox Series only | Microsoft Learn Terms of Use: informational, personal/non-commercial use; linked and paraphrased, no text or code copied |
| DirectStorage overview | BCPack is a custom entropy coder for BCn data; colour endpoints are separated from palette indices and coded with rANS; decompression order is DEFLATE, BCPack, swizzle | Same Microsoft Learn terms; linked and paraphrased |
SixNG, formats/06-bcpack.md |
Independent notes: 0% decoded, no public specification or decoder, lane/header observations, open unknowns | GPL-3.0; notes only, no code copied |
SixNG, formats/05-ttpf.md |
Independent codec-id table and pool structure | GPL-3.0; notes only |
| rpf9-explorer | The TtpfReader catalog checks and limitation strings measured here |
MIT |
GitHub repository search bcpack |
No BCPack decoder; the only GTA VI result is the GPL-3.0 notes above | Search on 2026-11-21 |
Microsoft's documentation gives the algorithm class and the mode enum, not the bitstream.
The public enum is documented for Xbox Series consoles; this note does not cover an Xbox One
variant. No public bitstream specification and no open-source BCPack decoder were found: the
SixNG notes are documentation, and the only open code found for this format is the container
parser (rpf9-explorer, MIT). The SixNG notes reach the same conclusion from the data: the
rANS coder and stream layout are partly mapped, there is no decoder, and BC1 is the only mode
studied beyond its headers.
Why there is no decoder in this change
A clean-room decoder needs a published bitstream description or a reference implementation under a compatible licence. Neither was found publicly. The public facts stop well short of a block decoder:
- Models. The rANS frequency tables for the endpoint planes and the adaptive models for the index lanes are not published. Without them the symbol stream cannot be decoded.
- Record layout. Varying plane and extension lanes have no understood byte-length field; the constant lanes do, but they are only the easy case.
- Lane semantics. What lane 0 codes, how the four index lanes map to 2-bit indices, and how extension lanes are ordered are unknown.
- Block order and timing. Whether blocks are linear or swizzled, and exactly when a lane reads versus decodes within a round, are not settled.
- Modes. Public notes only studied BC1; BC4, BC5 and BC7 streams are unstudied beyond their headers.
The payload is not a documented BC7 or BC6H variant. BCPack decompresses to standard BC1–BC7 blocks; the compressed stream is a separate entropy-coded representation. A decoder built from synthetic blocks would test our guesses, not the format.
The console-side decompressor is hardware; the GDK implementation is not public source and is not usable in a GPL-3.0 program. This change does not link it, copy it or work around it. No DRM, key or protection work was done; only already-plain chunk bytes were read.
What is missing, in one line: the rANS models, the varying/extension lane record layouts, lane-0/index-lane semantics, block order, and the BC4/5/6H/7 streams. The container and the algorithm class are known; the bitstream is not.
Next step
- Port the tile-mode split and the computed tail boundary. In
TtpfReader, selecttile = 65536when((mode >> 1) & 0xF) == 0and 4096 otherwise, replaceValidatedCompactProfilewith the allocation-span check, and setUsableMipLimitto the computedFirstTail(ormipswhen the tail tile is zlib/raw). On this install that completes 206,661 textures without touching BCPack. - Decode BC6H/BC7 in the validator.
tools/ttpf_mips.pydecodes BC1/3/4/5; the BC7 samples were checked with an external decoder. The layout is the same formula (16-byte elements), so this is validation breadth, not a new mapping. - Identify DXGI 156/199/211/226 (19 records) and validate uncompressed tiling (formats 11, 28, 49, 56). These are the remaining non-BCPack blockers besides arrays.
- Arrays/volumes: 678 descriptors. 567 use tile modes 9–12 and 111 are 2-slice; no validated slice layout exists yet.
- Do not fake a BCPack decoder. The current fallback (export the largest lower mip that
is zlib/raw) is used by 5,845 textures and should stay. If a public decoder or bitstream
spec appears under a compatible licence, add it behind
TtpfReader.DecodeChunk; the container already carries the mode (codec id) and decoded size, so no index work is needed. - If someone resumes the BCPack reverse engineering, use the hard check the SixNG notes propose: every lane must consume exactly its byte budget and finish at the rANS lower bound, with a fixed symbol count. Reference blocks are the missing input; none are public.
Reproduce
tools/ttpf_mips.py is the read-only measurement and decode tool:
python -I tools/ttpf_mips.py scan <game root> --json scan.json
python -I tools/ttpf_mips.py layout <pool.ttpf> <index>
python -I tools/ttpf_mips.py check <pool.ttpf> <index>
python -I tools/ttpf_mips.py export <pool.ttpf> <index> <out.dds>
scan reproduces the 357,115 / 98,603 / 210,292 / 48,220 split of this note and adds the
layout and recovery columns. check reports the per-mip downsample error. export writes a
full BC chain only when every source mip is zlib/raw. The tool writes no texture data and
tests/test_ttpf_mips.py runs on a synthetic RDS5 pool, so the test needs no game files.
rpf9dump ttpf writes one manifest.json per pool with a Limitation field for every
catalog record, and its summary line has the same ok / skip totals. The first split above
came from a read-only mirror of TtpfReader's catalog checks: it mmapped each pool and read
only the 24-byte RDS5 header, the chunk table, the ETPF records and the chunk ranges, and it
wrote no texture data. tools/ttpf_mips.py scan is that mirror, now committed with the
compact-layout work; it reproduces the split and adds the recovery columns.