xcrdapi: add BC6H codec, zlib continuation cache, overlapped reads, and GDKX ABI chains #508

Merged
glovepost merged 1 commit from upstream-pr/508 into main 2026-11-29 18:28:36 +00:00
glovepost commented 2026-11-29 17:31:22 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-29T17:31:22Z.


Summary

Extends the console storage provider (xcrdapi) with BC6H decoding, zlib continuation slices, overlapped file reads, and the request and interface layouts of the GDKX storage API.

  • BC6H. runtime/xcrdapi/codec decodes BCPack BC6H streams (bc6h.rs, with its tables in tables/bc6h.rs), alongside the existing BC1, BC3, BC4, BC5 and BC7. docs/REFERENCES.md lists the new attribution, and the decode path in decode.rs accepts BC6H and still refuses BC2.
  • zlib continuation. A zlib chunk that the title reads in several slices is inflated once and the rest of its slices are served from a bounded cache (ZLIB_CACHE), so a continuation slice no longer issues a disk read. A read that starts partway into a chunk scans backward to the covering chunk, and the cache is purged with the file.
  • Overlapped reads. Files are opened with a second overlapped handle and shared for read, write and delete. Reads on it complete through GetOverlappedResult with a per-worker event, and a persistent ReadPool runs a batch of queued reads together. A file with no overlapped handle falls back to the synchronous path.
  • ABI. Request gains the name pointer, so its size is 72 bytes, with the layout asserted at compile time. IFactory1/IFactory2 and IQueue1/IQueue2 are split into the interface chains the SDK defines, and CreateQueue accepts any interface in the queue chain.
  • Rebased onto #486. The check that fails a read whose destination is not committed now also covers the continuation fast path, because both write through write_decoded_output.

#501 also edits Read::execute in runtime/xcrdapi/src/queue.rs, so whichever of the two lands second needs a rebase.

Prepared with AI assistance; all changes were reviewed and verified on host checks, the Windows unit tests and both NVIDIA and AMD GPUs.

Tested

Run the checks relevant to this change.

  • The checks relevant to this change passed
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below
  • Where the table calls for AMD and NVIDIA, they passed on both. Otherwise, say which vendor still needs to run them:

xcrdapi is a storage provider, not a graphics or compute path, so no Lanes scenario applies. It is covered by the tuxbox-xcrdapi-codec host tests (including the new BC6H round trips), the tuxbox-xcrdapi unit tests that run under Wine (the ABI and interface chains, the overlapped pool and the zlib cache), and the xcrdapi verify suite.

GPU, driver and backend:

  • NVIDIA GeForce RTX 2070 SUPER (10de:1e84), driver 620.73.04, GE-Proton11-14
  • AMD Ryzen 7 9800X3D iGPU (1002:13c0), RADV / Mesa 26.3.1, GE-Proton11-14

Commands run and their results:

python3 tuxbox.py check --no-gpu
  -> 7/7 passed (Python 656 tests OK; storage codec 22; DXBC 98; XG layout 17 passed, 1 ignored)

CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUNNER=wine cargo xwin test --locked --target x86_64-pc-windows-msvc -p tuxbox-xcrdapi --lib
  -> 13/13 passed

python3 tuxbox.py verify --backend proton --proton <proton> --prefix <prefix> --adapter 10de:1e84 \
  --only xcrdapi --only xmem --only lanes-selftest --output <output>
  -> 40/40 passed

TUXBOX_CHECK_JOBS=4 python3 tuxbox.py verify --backend proton --proton <proton> --prefix <prefix> --adapter 1002:13c0 \
  --only xcrdapi --only xmem --only lanes-selftest --output <output>
  -> 40/40 passed

Checks

CI runs the Python unit tests, the shader compiler, DXBC, and XG layout tests, and a Windows typecheck of tuxbox-d3d12.

<!-- greyfinch-sync:brcly/TuxBox:issue:5553260387 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/508). Originally posted by [glovepost](https://github.com/glovepost) on 2026-11-29T17:31:22Z. --- ## Summary Extends the console storage provider (`xcrdapi`) with BC6H decoding, zlib continuation slices, overlapped file reads, and the request and interface layouts of the GDKX storage API. - **BC6H.** `runtime/xcrdapi/codec` decodes BCPack BC6H streams (`bc6h.rs`, with its tables in `tables/bc6h.rs`), alongside the existing BC1, BC3, BC4, BC5 and BC7. `docs/REFERENCES.md` lists the new attribution, and the decode path in `decode.rs` accepts BC6H and still refuses BC2. - **zlib continuation.** A zlib chunk that the title reads in several slices is inflated once and the rest of its slices are served from a bounded cache (`ZLIB_CACHE`), so a continuation slice no longer issues a disk read. A read that starts partway into a chunk scans backward to the covering chunk, and the cache is purged with the file. - **Overlapped reads.** Files are opened with a second overlapped handle and shared for read, write and delete. Reads on it complete through `GetOverlappedResult` with a per-worker event, and a persistent `ReadPool` runs a batch of queued reads together. A file with no overlapped handle falls back to the synchronous path. - **ABI.** `Request` gains the `name` pointer, so its size is 72 bytes, with the layout asserted at compile time. `IFactory1`/`IFactory2` and `IQueue1`/`IQueue2` are split into the interface chains the SDK defines, and `CreateQueue` accepts any interface in the queue chain. - **Rebased onto #486.** The check that fails a read whose destination is not committed now also covers the continuation fast path, because both write through `write_decoded_output`. #501 also edits `Read::execute` in `runtime/xcrdapi/src/queue.rs`, so whichever of the two lands second needs a rebase. Prepared with AI assistance; all changes were reviewed and verified on host checks, the Windows unit tests and both NVIDIA and AMD GPUs. ## Tested Run the [checks relevant to this change](../CONTRIBUTING.md#test-what-your-change-touches). - [x] The checks relevant to this change passed - [x] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below - [x] Where the table calls for AMD and NVIDIA, they passed on both. Otherwise, say which vendor still needs to run them: `xcrdapi` is a storage provider, not a graphics or compute path, so no Lanes scenario applies. It is covered by the `tuxbox-xcrdapi-codec` host tests (including the new BC6H round trips), the `tuxbox-xcrdapi` unit tests that run under Wine (the ABI and interface chains, the overlapped pool and the zlib cache), and the `xcrdapi` verify suite. GPU, driver and backend: - NVIDIA GeForce RTX 2070 SUPER (`10de:1e84`), driver `620.73.04`, GE-Proton11-14 - AMD Ryzen 7 9800X3D iGPU (`1002:13c0`), RADV / Mesa `26.3.1`, GE-Proton11-14 Commands run and their results: ```text python3 tuxbox.py check --no-gpu -> 7/7 passed (Python 656 tests OK; storage codec 22; DXBC 98; XG layout 17 passed, 1 ignored) CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUNNER=wine cargo xwin test --locked --target x86_64-pc-windows-msvc -p tuxbox-xcrdapi --lib -> 13/13 passed python3 tuxbox.py verify --backend proton --proton <proton> --prefix <prefix> --adapter 10de:1e84 \ --only xcrdapi --only xmem --only lanes-selftest --output <output> -> 40/40 passed TUXBOX_CHECK_JOBS=4 python3 tuxbox.py verify --backend proton --proton <proton> --prefix <prefix> --adapter 1002:13c0 \ --only xcrdapi --only xmem --only lanes-selftest --output <output> -> 40/40 passed ``` ## Checks CI runs the Python unit tests, the shader compiler, DXBC, and XG layout tests, and a Windows typecheck of `tuxbox-d3d12`.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!508
No description provided.