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

Merged
R0Y00 merged 1 commit from upstream-pr/1331 into main 2026-11-24 08:32:57 +00:00
R0Y00 commented 2026-11-24 08:18:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T08:18:32Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6577570810 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1331). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T08:18:32Z. --- 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.
tedin7 commented 2026-11-24 08:27:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:27:16Z.

Review: COMMENTED


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6035904274 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1331#pullrequestreview-6035904274). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T08:27:16Z. **Review:** COMMENTED --- 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.
upstream-sync closed this pull request 2026-11-24 09:04:33 +00:00
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
R0Y00/Xbox2Windows!1324
No description provided.