xcrdapi: decode BCPack BC1, BC3, BC4, BC5 and BC7 in DirectStorage requests #345
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/345"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-28T00:21:40Z.
What
This PR decodes BCPack, the console's DirectStorage texture codec, in
runtime/xcrdapi.Before it, a request with BcpackMode set (options bits 1–4) failed with
E_NOTIMPLand nothing was logged. The texture's memory kept whatever it held before.The title uses BCPack for a lot of its texture data. Reading only the chunk tables of its 46 texture pools (
data/ttdb/**.ttpf) gives:I have not yet measured how many of these chunks reach DirectStorage as BCPack requests in a game run. The first commit's log is there to show it.
Commits, for separate review:
TUXBOX_XCRD_LOG=1counts requests per option word, with their bytes and failures. The fields are decoded as documented inDSTORAGE_REQUEST_OPTIONS.tuxbox-xcrdapi-codec. A platform-independent crate, tested in the code checks on Linux. It models one lane of Microsoft's rANS reference decoder.IntermediateSize, in the documented stage order.Not covered:
Provenance
mdu_minirans.v@2f6827dgen_models.py; notice indocs/licenses/silicon-rans/IntermediateSizedata/, fitted on retail databcpack-tables.bin, through bcpack-rs c55c5fa and b1c3099 (the pairs observed from VIctory's decoder output)No VIctory or XCL code is used.
For the maintainer to decide: the commit 4 tables
What VIctory says. VIctory's
docs/asset-policy.md(commit 2849477, 23 Nov) describesbcpack-tables.binas follows:data/bc4.jsonsays: "reference decoder tables (GPL project; values are constants of the format…)".What the public record shows.
gameos.xvdor its DLLs. The executable may be encrypted, so this does not rule out that the tables were extracted from Microsoft software. If they were, that would be a different question from the GPL.The case for using them. The values are fixed constants of a hardware format: what the decoder hardware does to every stream. They are not expression in VIctory's code, and VIctory itself disclaims them. bcpack-rs measured several independently from retail data and got the same values:
Without them: commits 1–3 stand alone. BC1 is then approximate, and the other formats stay refused.
Accuracy
There is no hardware ground truth here. The checks below are self-consistency and agreement between independent decoders.
Unit tests round-trip random blocks of every format through our own encoder. Retail chunks were sampled from the title's pools, decoded locally, and none of their bytes are committed:
Checks
python tuxbox.py check --no-gpu: all 7 passed: shader compiler build, Python, shader compiler, DXBC, XG layout, storage codec, and the D3D12 Windows typecheck. Run on the branch rebased ontoe63a5bf8.cargo test -p tuxbox-xcrdapi-codec, 18 passed. Clippy is clean.xcrdapi-read.exeunder GE-Proton 11-14, CPU only):raw=16 zlib=16 guards=2 errors=2 cancellation=1 bc1=4 bc7=2 autosubmit=64 PASS.BCPack BC1: 0x80004001.BCPack BC7: 0x80004001.python tuxbox.py verify --only xcrdapipassed on an AMD Raphael iGPU (1002:13c0, RADV) and an RTX 5090 (10de:2b85, 620.70.10), GE-Proton11-14. xcrdapi is a CPU-only provider, so no other suite is touched.TUXBOX_XCRD_LOG=1, to confirm the title sends BCPack requests and in which formats.🤖 Generated with Claude Code