Sample address-only 4 KiB tiled BC3/BC7 views in translated draws #1265

Merged
R0Y00 merged 5 commits from upstream-pr/1272 into main 2026-11-24 06:51:10 +00:00
R0Y00 commented 2026-11-24 06:24:24 +00:00 (Migrated from github.com)

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


Refs #1146 and #1150. Stacked on #1263. After #1263 lands, retarget this PR to main for integration.

For a read-only, single-sample, single-layer, single-mip BC3_UNORM or BC7_UNORM texture with layout 0x105 and complete 64×64 texel tiles, slot 70 can publish an SRV from guest memory without a placed resource. Translated draws create the desktop texture on first use and copy the compressed blocks into D3D12 footprint rows. The XG layout probe and the uploader share the block addressing formula. The guest address and allocation must remain valid while sampled. Direct submission through a persistent desktop heap is outside the translated-draw profile. No package inputs or recorded textures are included.

Each source-built test samples four complete 128×128 images for each format. Two addresses contain different tile arrangements. Address zero retains the second view, and republishing the first address restores it. The test compares all 65,536 RGBA pixels per format on each adapter. Exchanging neighboring tiles changes 16,384/16,384 pixels for BC3 and 15,360/16,384 for BC7. On #1263 alone the first BC3 pixel was 00000000 instead of ff000070.

Windows 11 build 26200.9974, RTX 4060 Laptop 32.0.16.1656 and WARP 10.0.26100.9818, debug layer off. Six tests passed, zero skips, 9.41 s on candidate 06673a11.

cmake --build --preset release --target startup_stream_consumer startup_stub_consumer d3d12_xs_shim
ctest --preset release --no-tests=error --output-on-failure -R '^(startup_address_(bc_view|srv)_(hardware|warp)|startup_xg_bc7_layout|bc7_tile_swizzle)$'
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6575993308 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1272). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T06:24:24Z. --- Refs #1146 and #1150. Stacked on #1263. After #1263 lands, retarget this PR to main for integration. For a read-only, single-sample, single-layer, single-mip BC3_UNORM or BC7_UNORM texture with layout 0x105 and complete 64×64 texel tiles, slot 70 can publish an SRV from guest memory without a placed resource. Translated draws create the desktop texture on first use and copy the compressed blocks into D3D12 footprint rows. The XG layout probe and the uploader share the block addressing formula. The guest address and allocation must remain valid while sampled. Direct submission through a persistent desktop heap is outside the translated-draw profile. No package inputs or recorded textures are included. Each source-built test samples four complete 128×128 images for each format. Two addresses contain different tile arrangements. Address zero retains the second view, and republishing the first address restores it. The test compares all 65,536 RGBA pixels per format on each adapter. Exchanging neighboring tiles changes 16,384/16,384 pixels for BC3 and 15,360/16,384 for BC7. On #1263 alone the first BC3 pixel was 00000000 instead of ff000070. Windows 11 build 26200.9974, RTX 4060 Laptop 32.0.16.1656 and WARP 10.0.26100.9818, debug layer off. Six tests passed, zero skips, 9.41 s on candidate 06673a11. ```powershell cmake --build --preset release --target startup_stream_consumer startup_stub_consumer d3d12_xs_shim ctest --preset release --no-tests=error --output-on-failure -R '^(startup_address_(bc_view|srv)_(hardware|warp)|startup_xg_bc7_layout|bc7_tile_swizzle)$' ```
tedin7 commented 2026-11-24 06:29:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:29:00Z.

Review: COMMENTED


Dual-platform review at commit 06673a11b931ff024909881defd163f9dbfe949b:

Findings

  • Non-UTF-8 bytes in docs/experiments.md (breaks docs_links_check.py): lines 8283 (16\xa1\xc116) and 8295 (128\xa1\xc1128) contain invalid UTF-8 byte sequences (0xa1 0xc1) instead of × (\xc3\x97), causing tests/docs_links_check.py to fail with UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1.

Verification

  • Linux:
    • git diff --check origin/main...HEAD: passed
    • python -B tests/bidi_controls_check.py: passed (1060 files)
    • python -B tests/docs_links_check.py: failed (UnicodeDecodeError in docs/experiments.md)
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): cmake --build --preset dev --target startup_stream_consumer startup_stub_consumer d3d12_xs_shim -- -j 6 + ctest --preset dev -R '^(startup_address_(bc_view|srv)_warp|startup_xg_bc7_layout|bc7_tile_swizzle)$' --parallel 4 --no-tests=error --output-on-failure -> 4/4 passed (3.57s: startup_xg_bc7_layout, bc7_tile_swizzle, startup_address_srv_warp, startup_address_bc_view_warp)
    • Release /O2 (--preset release): cmake --build --preset release --target startup_stream_consumer startup_stub_consumer d3d12_xs_shim -- -j 6 + ctest --preset release -R '^(startup_address_(bc_view|srv)_warp|startup_xg_bc7_layout|bc7_tile_swizzle)$' --parallel 4 --no-tests=error --output-on-failure -> 4/4 passed (3.58s)

Code Notes

  • Extracting Bc16Surface into src/startup_stubs/bc16_surface.h cleanly shares the 4 KiB standard non-XOR block addressing between xg_xs.cpp and the draw/memory-SRV path.
  • upload_texture calls copy_4k_s_to_rows assuming single-mip, single-slice (plan.count == 1, slices == 1), which is enforced by supports_memory_srv.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034674675 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1272#pullrequestreview-6034674675). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T06:29:00Z. **Review:** COMMENTED --- Dual-platform review at commit `06673a11b931ff024909881defd163f9dbfe949b`: ### Findings - **Non-UTF-8 bytes in `docs/experiments.md` (breaks `docs_links_check.py`)**: lines 8283 (`16\xa1\xc116`) and 8295 (`128\xa1\xc1128`) contain invalid UTF-8 byte sequences (`0xa1 0xc1`) instead of `×` (`\xc3\x97`), causing `tests/docs_links_check.py` to fail with `UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1`. ### Verification - **Linux**: - `git diff --check origin/main...HEAD`: passed - `python -B tests/bidi_controls_check.py`: passed (1060 files) - `python -B tests/docs_links_check.py`: **failed** (`UnicodeDecodeError` in `docs/experiments.md`) - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: `cmake --build --preset dev --target startup_stream_consumer startup_stub_consumer d3d12_xs_shim -- -j 6` + `ctest --preset dev -R '^(startup_address_(bc_view|srv)_warp|startup_xg_bc7_layout|bc7_tile_swizzle)$' --parallel 4 --no-tests=error --output-on-failure` -> **4/4 passed** (`3.57s`: `startup_xg_bc7_layout`, `bc7_tile_swizzle`, `startup_address_srv_warp`, `startup_address_bc_view_warp`) - **Release `/O2` (`--preset release`)**: `cmake --build --preset release --target startup_stream_consumer startup_stub_consumer d3d12_xs_shim -- -j 6` + `ctest --preset release -R '^(startup_address_(bc_view|srv)_warp|startup_xg_bc7_layout|bc7_tile_swizzle)$' --parallel 4 --no-tests=error --output-on-failure` -> **4/4 passed** (`3.58s`) ### Code Notes - Extracting `Bc16Surface` into `src/startup_stubs/bc16_surface.h` cleanly shares the 4 KiB standard non-XOR block addressing between `xg_xs.cpp` and the draw/memory-SRV path. - `upload_texture` calls `copy_4k_s_to_rows` assuming single-mip, single-slice (`plan.count == 1`, `slices == 1`), which is enforced by `supports_memory_srv`.
R0Y00 commented 2026-11-24 06:50:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T06:42:05Z.


#1263 has landed. This PR now targets main. The placed-BC7 and address-only BC3/BC7 paths share the same 4 KiB block addressing and upload helper, with their separate eligibility checks intact. The combined Release run passed 12 tests, including R8/SRV and BC3/BC7 pixel readbacks on RTX 4060 Laptop and WARP. The sole skip was WARP's logical-heap fallback test, since WARP accepts the requested heap directly.

ctest --preset release --no-tests=error --output-on-failure -R '^(startup_(address_(bc_view|srv)|logical_view|stream_(draw|request)|xg_bc7_(draw|layout))|bc7_tile_swizzle)'

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7124202615 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1272#issuecomment-7124202615). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T06:42:05Z. --- #1263 has landed. This PR now targets main. The placed-BC7 and address-only BC3/BC7 paths share the same 4 KiB block addressing and upload helper, with their separate eligibility checks intact. The combined Release run passed 12 tests, including R8/SRV and BC3/BC7 pixel readbacks on RTX 4060 Laptop and WARP. The sole skip was WARP's logical-heap fallback test, since WARP accepts the requested heap directly. `ctest --preset release --no-tests=error --output-on-failure -R '^(startup_(address_(bc_view|srv)|logical_view|stream_(draw|request)|xg_bc7_(draw|layout))|bc7_tile_swizzle)'`
upstream-sync closed this pull request 2026-11-24 07:00:39 +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!1265
No description provided.