cpu: draw a selected page from a sixteen-page zlib record #1346

Merged
R0Y00 merged 2 commits from upstream-pr/1353 into main 2026-11-24 09:16:33 +00:00
R0Y00 commented 2026-11-24 08:59:24 +00:00 (Migrated from github.com)

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


Refs #1198. Depends on #1345. Please merge #1345 into main first, then retarget this PR to main.

The compiler-built EXE can select one requested 4 KiB page inside a 16-page RFC 1950 record. The guest supplies the full compressed source range, the declared decoded capacity in bytes, and the byte offset inside that destination. The Windows queue inflates the complete 64 KiB record. Once both statuses complete, the existing provider extracts the requested pages, uploads the BC7 texture and draws. The fixture supports standalone one-page and sixteen-page intervals.

A two-record source-built file has sixteen differently colored pages in the first stream and a seventeenth color in the second. The independent readback checks exact guest arguments, both queue statuses, every expanded destination byte and both guards, the selected pages, storage object releases, full RGBA output, fence and device references. Cases select page 0, 7 or 15 followed by the second record, then reverse record order to put the 16-page output second. An out-of-range second request leaves the queue unopened. Truncating either compressed checksum fails only that request, keeps the entire destination unchanged, finishes the other request and exits 6 without a draw.

Local Windows 11 build 26200.9974, Release 5f994492. RTX 4060 Laptop GPU driver 32.0.16.1656 and WARP 10.0.26100.9818, debug layer off. Across native PE, mapped PE and AOT: 42 new executions including 24 full frames, 12 checksum truncations and six pre-enqueue rejections. No skips. Both brand-new CTests, both existing directory CPU/GPU comparisons and the queue-directory regression passed (5/5). Markdown link check passed (300 links).

cmake --build --preset release --target archive_directory_lifted pe_map startup_stub_consumer startup_stub_xcrdapi
ctest --preset release --no-tests=error --output-on-failure -R '^(cpu_archive_(sixteen_page|directory)_gpu_(warp|hardware)|startup_storage_directory_batch)$'
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6578206771 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1353). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T08:59:24Z. --- Refs #1198. Depends on #1345. Please merge #1345 into main first, then retarget this PR to main. The compiler-built EXE can select one requested 4 KiB page inside a 16-page RFC 1950 record. The guest supplies the full compressed source range, the declared decoded capacity in bytes, and the byte offset inside that destination. The Windows queue inflates the complete 64 KiB record. Once both statuses complete, the existing provider extracts the requested pages, uploads the BC7 texture and draws. The fixture supports standalone one-page and sixteen-page intervals. A two-record source-built file has sixteen differently colored pages in the first stream and a seventeenth color in the second. The independent readback checks exact guest arguments, both queue statuses, every expanded destination byte and both guards, the selected pages, storage object releases, full RGBA output, fence and device references. Cases select page 0, 7 or 15 followed by the second record, then reverse record order to put the 16-page output second. An out-of-range second request leaves the queue unopened. Truncating either compressed checksum fails only that request, keeps the entire destination unchanged, finishes the other request and exits 6 without a draw. Local Windows 11 build 26200.9974, Release 5f994492. RTX 4060 Laptop GPU driver 32.0.16.1656 and WARP 10.0.26100.9818, debug layer off. Across native PE, mapped PE and AOT: 42 new executions including 24 full frames, 12 checksum truncations and six pre-enqueue rejections. No skips. Both brand-new CTests, both existing directory CPU/GPU comparisons and the queue-directory regression passed (5/5). Markdown link check passed (300 links). ```powershell cmake --build --preset release --target archive_directory_lifted pe_map startup_stub_consumer startup_stub_xcrdapi ctest --preset release --no-tests=error --output-on-failure -R '^(cpu_archive_(sixteen_page|directory)_gpu_(warp|hardware)|startup_storage_directory_batch)$' ```
tedin7 commented 2026-11-24 09:04:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T09:04:56Z.

Review: COMMENTED


Technical peer-review at commit 5f9944929cdedd216d979a4d8eb799ca76de7f43:

Verification

  • Linux:
    • git diff --check origin/main...HEAD: clean.
    • tests/docs_links_check.py: passed (16 Markdown files, 300 links).
    • tests/bidi_controls_check.py: passed (1114 tracked files).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): cmake --build --preset dev --target startup_stub_consumer archive_directory_gpu archive_directory_lifted pe_map succeeded (24.61s); ctest --preset dev -R '^(startup_storage_directory_batch|cpu_archive_directory_gpu_warp|cpu_archive_sixteen_page_gpu_warp)$' 3/3 passed (10.03s).
    • Release /O2 (--preset release): build succeeded (36.72s); same CTest selection 3/3 passed (9.85s).

Code & Test Notes

  • tests/cpu/archive/directory_reader.zig: validate() checks the RDS5 header, entry count bounds against both the readable prefix and metadata offset, strictly monotonic physical/logical boundaries, terminal physical <= file_size, and logical << 12 against the header size. locate() binary-searches the directory, restricts intervals to 1 or 16 pages with codec == 8, and guards span - padding against underflow/overflow.
  • tests/cpu/archive/directory_gpu.cpp & tests/cpu/archive_directory_multipage_check.py: verify 32-byte 0xa5 destination guards, full 16-page decompressed buffers, selected 4 KiB page extraction, file identity, queue statuses, storage refcount releases (0 0 0), out-of-range pre-queue rejection (exit 3), and truncated-stream negative controls (exit 6).
  • Minor nit: CMakeLists.txt line 3974 uses ${CMAKE_SOURCE_DIR} while the adjacent cpu_archive_directory_gpu_${adapter} test on line 3971 uses ${CMAKE_CURRENT_SOURCE_DIR}.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6036369715 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1353#pullrequestreview-6036369715). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T09:04:56Z. **Review:** COMMENTED --- Technical peer-review at commit `5f9944929cdedd216d979a4d8eb799ca76de7f43`: ### Verification - **Linux**: - `git diff --check origin/main...HEAD`: clean. - `tests/docs_links_check.py`: passed (16 Markdown files, 300 links). - `tests/bidi_controls_check.py`: passed (1114 tracked files). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: `cmake --build --preset dev --target startup_stub_consumer archive_directory_gpu archive_directory_lifted pe_map` succeeded (`24.61s`); `ctest --preset dev -R '^(startup_storage_directory_batch|cpu_archive_directory_gpu_warp|cpu_archive_sixteen_page_gpu_warp)$'` **3/3 passed** (`10.03s`). - **Release `/O2` (`--preset release`)**: build succeeded (`36.72s`); same CTest selection **3/3 passed** (`9.85s`). ### Code & Test Notes - `tests/cpu/archive/directory_reader.zig`: `validate()` checks the `RDS5` header, entry count bounds against both the readable prefix and metadata offset, strictly monotonic physical/logical boundaries, terminal `physical <= file_size`, and `logical << 12` against the header size. `locate()` binary-searches the directory, restricts intervals to 1 or 16 pages with `codec == 8`, and guards `span - padding` against underflow/overflow. - `tests/cpu/archive/directory_gpu.cpp` & `tests/cpu/archive_directory_multipage_check.py`: verify 32-byte `0xa5` destination guards, full 16-page decompressed buffers, selected 4 KiB page extraction, file identity, queue statuses, storage refcount releases (`0 0 0`), out-of-range pre-queue rejection (exit 3), and truncated-stream negative controls (exit 6). - Minor nit: `CMakeLists.txt` line 3974 uses `${CMAKE_SOURCE_DIR}` while the adjacent `cpu_archive_directory_gpu_${adapter}` test on line 3971 uses `${CMAKE_CURRENT_SOURCE_DIR}`.
upstream-sync closed this pull request 2026-11-24 10:02:27 +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!1346
No description provided.