cpu: draw BC7 pages requested by a recompiled archive reader #1331

Manually merged
github merged 1 commit from gh-pr/1331/head into gh-pr/1331/base 2026-11-26 22:58:47 +00:00
Owner

@⁠R0Y00 on GitHub · 2026-11-24 08:18 UTC · original
R0Y00:codex/archive-directory-gpu → main · +288 −7 · 7 files · 1 commits · merged 2026-11-24 08:32 UTC

Refs #1198 and #870. Follows #1323 and the archive texture comparison in #830.

Move the two source range calculations into a Zig 0.13 executable compiled with the repository's existing archive-reader build. Its internal function reads adjacent RDS5 boundary words and computes the absolute file offset and compressed size, accounting for the stored padding. The EXE invokes this function twice. The native and mapped PE and the statically translated EXE all call the same Windows provider DLL. The provider submits both requests to a single XCRDAPI file queue, reads both statuses, uploads the decoded pages as one BC7 texture, then draws and reads back the image using the existing QuadFrames renderer.

The two synthetic files contain 1 and 16,384 ETPF records. First and second pages have different compressed lengths. Adding 896 KiB to just the first offset selects a valid equal-length alternate stream. All three runners see the changed top half of the output with the bottom half intact (8,192/16,384 pixels). Selecting EOF instead returns exit 6, preserves the first 4 KiB destination and still decodes the second; no frame is emitted. Each successful draw requires the same adapter description, full RGBA readback, fence 1, exit 0 and zero remaining device references.

Windows 11 26200.9974 x64, Release b4227960, NVIDIA RTX 4060 Laptop GPU 32.0.16.1656 and WARP 10.0.26100.9818. Across both adapters: 36 executions and 24 checked frames, zero skips. Two new CTests and three existing storage/reader regressions passed, 5/5. Markdown link check passed, 293 links.

cmake --build --preset release --target archive_directory_lifted pe_map archive_reader_lifted archive_texture_lifted startup_stub_consumer startup_stub_xcrdapi
ctest --preset release --no-tests=error --output-on-failure -R '^(cpu_archive_directory_gpu_(warp|hardware)|cpu_native_archive_reader|cpu_archive_texture_publication|startup_storage_directory_batch)$'

All archives and images are generated by the fixture. The offset control is supplied explicitly to the caller. The source of an unexpected offset in another caller remains open.

**@⁠R0Y00** on GitHub · 2026-11-24 08:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1331) `R0Y00:codex/archive-directory-gpu` → `main` · +288 −7 · 7 files · 1 commits · merged 2026-11-24 08:32 UTC Refs #1198 and #870. Follows #1323 and the archive texture comparison in #830. Move the two source range calculations into a Zig 0.13 executable compiled with the repository's existing archive-reader build. Its internal function reads adjacent RDS5 boundary words and computes the absolute file offset and compressed size, accounting for the stored padding. The EXE invokes this function twice. The native and mapped PE and the statically translated EXE all call the same Windows provider DLL. The provider submits both requests to a single XCRDAPI file queue, reads both statuses, uploads the decoded pages as one BC7 texture, then draws and reads back the image using the existing QuadFrames renderer. The two synthetic files contain 1 and 16,384 ETPF records. First and second pages have different compressed lengths. Adding 896 KiB to just the first offset selects a valid equal-length alternate stream. All three runners see the changed top half of the output with the bottom half intact (8,192/16,384 pixels). Selecting EOF instead returns exit 6, preserves the first 4 KiB destination and still decodes the second; no frame is emitted. Each successful draw requires the same adapter description, full RGBA readback, fence 1, exit 0 and zero remaining device references. Windows 11 26200.9974 x64, Release b4227960, NVIDIA RTX 4060 Laptop GPU 32.0.16.1656 and WARP 10.0.26100.9818. Across both adapters: 36 executions and 24 checked frames, zero skips. Two new CTests and three existing storage/reader regressions passed, 5/5. Markdown link check passed, 293 links. ```powershell cmake --build --preset release --target archive_directory_lifted pe_map archive_reader_lifted archive_texture_lifted startup_stub_consumer startup_stub_xcrdapi ctest --preset release --no-tests=error --output-on-failure -R '^(cpu_archive_directory_gpu_(warp|hardware)|cpu_native_archive_reader|cpu_archive_texture_publication|startup_storage_directory_batch)$' ``` All archives and images are generated by the fixture. The offset control is supplied explicitly to the caller. The source of an unexpected offset in another caller remains open.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:58:45 +00:00
github manually merged commit b4227960aa into gh-pr/1331/base 2026-11-26 22:58:47 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 08:27 UTC · original · reviewed

Reviewed PR #1331 at commit b4227960aa93c1b0de9f6af13d3056f871bb846c.

Verification

  • Linux:
    • tests/docs_links_check.py: passed (16 Markdown files, 293 links).
    • tests/bidi_controls_check.py: passed (1102 tracked files).
    • tests/cpu/archive_directory_gpu_check.py: Windows-only (startup_xg_bc7_layout_check.py uses ctypes.WINFUNCTYPE).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): archive_directory_gpu, archive_directory_lifted, pe_map, startup_stub_consumer built cleanly; ctest -R '^(cpu_archive_directory_gpu_warp|startup_storage_directory_batch)$' 2/2 passed (startup_storage_directory_batch 0.15s, cpu_archive_directory_gpu_warp 3.60s).
    • Release /O2 (--preset release): built cleanly; 2/2 passed (startup_storage_directory_batch 0.14s, cpu_archive_directory_gpu_warp 3.61s).

Code Findings

  • Minor (non-blocking): tests/cpu/archive/directory_gpu.cpp (directory_input) reads the binary uint64_t first_bias via std::fread(&inputs.first_bias, sizeof(Word), 1, stdin) without setting stdin to binary mode (_setmode(_fileno(stdin), _O_BINARY)). Under MSVC's default text mode, any future bias containing 0x1a or 0x0d 0x0a would be truncated or translated (the current test biases 0, 0xe0000, and the aligned EOF offset are unaffected).
  • Otherwise clean: RAII CloseBatch releases COM objects and closes the trace file on all paths, native/pe_map/AOT runners match ranges, statuses, 0xa5 destination preservation on EOF, fence 1, release refcount 0, and rendered BC7 pixels.
**@⁠tedin7** on GitHub · 2026-11-24 08:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1331#pullrequestreview-6035904274) · **reviewed** Reviewed PR #1331 at commit `b4227960aa93c1b0de9f6af13d3056f871bb846c`. ### Verification - **Linux**: - `tests/docs_links_check.py`: passed (16 Markdown files, 293 links). - `tests/bidi_controls_check.py`: passed (1102 tracked files). - `tests/cpu/archive_directory_gpu_check.py`: Windows-only (`startup_xg_bc7_layout_check.py` uses `ctypes.WINFUNCTYPE`). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: `archive_directory_gpu`, `archive_directory_lifted`, `pe_map`, `startup_stub_consumer` built cleanly; `ctest -R '^(cpu_archive_directory_gpu_warp|startup_storage_directory_batch)$'` **2/2 passed** (`startup_storage_directory_batch` 0.15s, `cpu_archive_directory_gpu_warp` 3.60s). - **Release `/O2` (`--preset release`)**: built cleanly; **2/2 passed** (`startup_storage_directory_batch` 0.14s, `cpu_archive_directory_gpu_warp` 3.61s). ### Code Findings - **Minor (non-blocking)**: `tests/cpu/archive/directory_gpu.cpp` (`directory_input`) reads the binary `uint64_t` `first_bias` via `std::fread(&inputs.first_bias, sizeof(Word), 1, stdin)` without setting `stdin` to binary mode (`_setmode(_fileno(stdin), _O_BINARY)`). Under MSVC's default text mode, any future bias containing `0x1a` or `0x0d 0x0a` would be truncated or translated (the current test biases `0`, `0xe0000`, and the aligned EOF offset are unaffected). - Otherwise clean: RAII `CloseBatch` releases COM objects and closes the trace file on all paths, `native`/`pe_map`/`AOT` runners match ranges, statuses, `0xa5` destination preservation on EOF, fence `1`, release refcount `0`, and rendered BC7 pixels.
This discussion has been locked. Commenting is limited to contributors.
No description provided.