Compare real DXR hits at guest AS addresses with identical low 40 bits #1307

Manually merged
github merged 1 commit from gh-pr/1307/head into gh-pr/1307/base 2026-11-26 22:56:46 +00:00
Owner

@⁠R0Y00 on GitHub · 2026-11-24 07:26 UTC · original
R0Y00:codex/dxr-guest-address-readback → main · +114 −7 · 5 files · 1 commits · merged 2026-11-24 07:42 UTC

Refs #874.

This source-built check registers two synthetic guest address ranges separated by 1 TiB with the existing title-to-GPU range table. Each range points to a separate live desktop buffer containing a BLAS at offset 512. Each BLAS contains a triangle at a different position and distance. A TLAS also starts 512 bytes inside its buffer. Its instances are built with distinct masks and IDs and use the resolved interior addresses.

Both the normal and the deliberately truncated cases perform real BLAS/TLAS builds and DispatchRays. Masking both instance references to 40 bits selects a different valid BLAS for the second instance. On both adapters the four rays returned:

Instance lookup Ray 0 Ray 1 Ray 2 Ray 3
Full address ID 7 at 1 miss miss ID 11 at 2
High bits dropped ID 7 at 1 miss ID 11 at 1 miss

Every payload word is checked, including primitive index and the distance bits. This is a test of host range translation consumed by DXR. Encodings used by external builders remain an open question.

At 6e029d1a, Windows 11 build 26200.9974, MSVC x64 Release, debug layer enabled. RTX 4060 Laptop (32.0.16.1656) and Microsoft WARP (10.0.26100.9818) both passed. Eight checks passed with zero skips, zero D3D12 warnings and zero errors.

cmake --build --preset release --target offscreen_check
ctest --preset release --no-tests=error --output-on-failure -R '^dxr_(address_ranges|pipeline|query|update_pipeline)_(hardware|warp)$'
**@⁠R0Y00** on GitHub · 2026-11-24 07:26 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1307) `R0Y00:codex/dxr-guest-address-readback` → `main` · +114 −7 · 5 files · 1 commits · merged 2026-11-24 07:42 UTC Refs #874. This source-built check registers two synthetic guest address ranges separated by 1 TiB with the existing title-to-GPU range table. Each range points to a separate live desktop buffer containing a BLAS at offset 512. Each BLAS contains a triangle at a different position and distance. A TLAS also starts 512 bytes inside its buffer. Its instances are built with distinct masks and IDs and use the resolved interior addresses. Both the normal and the deliberately truncated cases perform real BLAS/TLAS builds and DispatchRays. Masking both instance references to 40 bits selects a different *valid* BLAS for the second instance. On both adapters the four rays returned: | Instance lookup | Ray 0 | Ray 1 | Ray 2 | Ray 3 | | --- | --- | --- | --- | --- | | Full address | ID 7 at 1 | miss | miss | ID 11 at 2 | | High bits dropped | ID 7 at 1 | miss | ID 11 at 1 | miss | Every payload word is checked, including primitive index and the distance bits. This is a test of host range translation consumed by DXR. Encodings used by external builders remain an open question. At 6e029d1a, Windows 11 build 26200.9974, MSVC x64 Release, debug layer enabled. RTX 4060 Laptop (32.0.16.1656) and Microsoft WARP (10.0.26100.9818) both passed. Eight checks passed with zero skips, zero D3D12 warnings and zero errors. ```powershell cmake --build --preset release --target offscreen_check ctest --preset release --no-tests=error --output-on-failure -R '^dxr_(address_ranges|pipeline|query|update_pipeline)_(hardware|warp)$' ```
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:56:45 +00:00
github manually merged commit 6e029d1af7 into gh-pr/1307/base 2026-11-26 22:56:46 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 07:40 UTC · original · reviewed

Reviewed at commit 6e029d1af78d4cd97afcd71b3a49421794167489.

Code Review

  • tests/dxr_check.cpp: AddressScene registers two live AS buffers at 0x2300000000 and 0x2300000000 + (1ull << 40) in era_title_va::Table, verifying both interior 512-byte AS offsets (2 * D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT) and full 64-bit guest-to-host range translation.
  • Updating SetComputeRootShaderResourceView(0, top.DestAccelerationStructureData) ensures the TLAS SRV respects the interior offset when addressScene is active, and both otherBlas / otherVertices remain live until after readback.
  • The negative/truncation control (scene.truncate = true, masking to 40 bits before ranges.translate) cleanly proves that collapsing the high bits misroutes instance 11 onto the first BLAS (hit11@1 and a miss).

Verification

  • Linux (6e029d1a):
    • git diff --check origin/main...HEAD: pass
    • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (16 Markdown files, 289 links)
    • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (1086 files)
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP, --target offscreen_check):
    • Debug (--preset dev): ctest --preset dev -R '^dxr_(address_ranges|pipeline|query)_warp$' --parallel 4 --no-tests=error --output-on-failure — 3/3 passed (dxr_address_ranges_warp, dxr_pipeline_warp, dxr_query_warp)
    • Release /O2 (--preset release): ctest --preset release -R '^dxr_(address_ranges|pipeline|query)_warp$' --parallel 4 --no-tests=error --output-on-failure — 3/3 passed (dxr_address_ranges_warp, dxr_pipeline_warp, dxr_query_warp)
**@⁠tedin7** on GitHub · 2026-11-24 07:40 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1307#pullrequestreview-6035384332) · **reviewed** Reviewed at commit `6e029d1af78d4cd97afcd71b3a49421794167489`. ### Code Review - `tests/dxr_check.cpp`: `AddressScene` registers two live AS buffers at `0x2300000000` and `0x2300000000 + (1ull << 40)` in `era_title_va::Table`, verifying both interior 512-byte AS offsets (`2 * D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT`) and full 64-bit guest-to-host range translation. - Updating `SetComputeRootShaderResourceView(0, top.DestAccelerationStructureData)` ensures the TLAS SRV respects the interior offset when `addressScene` is active, and both `otherBlas` / `otherVertices` remain live until after readback. - The negative/truncation control (`scene.truncate = true`, masking to 40 bits before `ranges.translate`) cleanly proves that collapsing the high bits misroutes instance 11 onto the first BLAS (`hit11@1` and a miss). ### Verification - **Linux** (`6e029d1a`): - `git diff --check origin/main...HEAD`: pass - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: pass (16 Markdown files, 289 links) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: pass (1086 files) - **Windows Server 2025** (Build 26100, MSVC 14.44.35207 + D3D12 WARP, `--target offscreen_check`): - **Debug (`--preset dev`)**: `ctest --preset dev -R '^dxr_(address_ranges|pipeline|query)_warp$' --parallel 4 --no-tests=error --output-on-failure` — **3/3 passed** (`dxr_address_ranges_warp`, `dxr_pipeline_warp`, `dxr_query_warp`) - **Release `/O2` (`--preset release`)**: `ctest --preset release -R '^dxr_(address_ranges|pipeline|query)_warp$' --parallel 4 --no-tests=error --output-on-failure` — **3/3 passed** (`dxr_address_ranges_warp`, `dxr_pipeline_warp`, `dxr_query_warp`)
This discussion has been locked. Commenting is limited to contributors.
No description provided.