shader: map a bounded SPIR-V address window to D3D12 storage buffers #547

Merged
R0Y00 merged 1 commit from upstream-pr/553 into main 2026-11-22 11:41:32 +00:00
R0Y00 commented 2026-11-22 11:32:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T11:32:47Z.


Refs #218. The first shared failure in a local five-stage SPIR-V to HLSL survey was physical buffer addressing. This change introduces one optional, bounded alternative for a named DWORD-pointer layout. It validates the physical input and logical output with SPIRV-Tools. The runtime provides descriptor-backed packed user words and a raw address window. Nonrepresentable and misaligned offsets select a descriptor out-of-bounds address; overflowing 64-bit index addition cannot alias the start of the buffer.

The public regression builds its own SPIR-V input. It subtracts two words and writes through a third address. Swapping operands, relocating the destination, high words, unaligned accesses, full-width addition overflow and writing past the real view distinguish mapping and bounds errors. Each run compares every word, including the guards.

Tested over main 0a9f4b4 on Windows 11 build 26200.9974 with RTX 4060 Laptop driver 32.0.16.1656 and WARP 10.0.26100.9818, MSVC 19.51, Windows SDK 10.0.26100.0, SPIRV-Cross 57e4efc, and D3D12 debug enabled.

  • python3 -B tests/spirv_window/check.py passed under WSL. Original and transformed modules validate; invalid input and rejection controls pass.
  • cmake --build --preset dev --target offscreen_check passed.
  • After the documented SPIRV-Cross and DXC steps, offscreen_check.exe hardware --spirv-address-window public-window.dxil and the corresponding warp invocation each passed all eight full-buffer comparisons, zero debug errors or warnings and zero skips.
  • ctest --preset dev --no-tests=error -R 'docs_links|^offscreen_warp$' --output-on-failure passed 2/2. The generated fixture used WSL tools locally. Optional native-tool CTests register on Windows when the three SPIR-V executables are available.

Only source and test data created from source are in the patch. The offline corpus prototype additionally handles typed resource arrays and arithmetic and wave operations; its package counts do not constitute coverage of this single adapter. The default pixel translator, CPU AOT, and the native/mapped comparison keep their existing contracts.

AI-assisted contribution.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6541870280 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/553). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T11:32:47Z. --- Refs #218. The first shared failure in a local five-stage SPIR-V to HLSL survey was physical buffer addressing. This change introduces one optional, bounded alternative for a named DWORD-pointer layout. It validates the physical input and logical output with SPIRV-Tools. The runtime provides descriptor-backed packed user words and a raw address window. Nonrepresentable and misaligned offsets select a descriptor out-of-bounds address; overflowing 64-bit index addition cannot alias the start of the buffer. The public regression builds its own SPIR-V input. It subtracts two words and writes through a third address. Swapping operands, relocating the destination, high words, unaligned accesses, full-width addition overflow and writing past the real view distinguish mapping and bounds errors. Each run compares every word, including the guards. Tested over main `0a9f4b4` on Windows 11 build 26200.9974 with RTX 4060 Laptop driver 32.0.16.1656 and WARP 10.0.26100.9818, MSVC 19.51, Windows SDK 10.0.26100.0, SPIRV-Cross `57e4efc`, and D3D12 debug enabled. - `python3 -B tests/spirv_window/check.py` passed under WSL. Original and transformed modules validate; invalid input and rejection controls pass. - `cmake --build --preset dev --target offscreen_check` passed. - After the documented SPIRV-Cross and DXC steps, `offscreen_check.exe hardware --spirv-address-window public-window.dxil` and the corresponding `warp` invocation each passed all eight full-buffer comparisons, zero debug errors or warnings and zero skips. - `ctest --preset dev --no-tests=error -R 'docs_links|^offscreen_warp$' --output-on-failure` passed 2/2. The generated fixture used WSL tools locally. Optional native-tool CTests register on Windows when the three SPIR-V executables are available. Only source and test data created from source are in the patch. The offline corpus prototype additionally handles typed resource arrays and arithmetic and wave operations; its package counts do not constitute coverage of this single adapter. The default pixel translator, CPU AOT, and the native/mapped comparison keep their existing contracts. AI-assisted contribution.
upstream-sync closed this pull request 2026-11-24 06:43:39 +00:00
rwZephyr commented 2026-11-24 06:48:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T18:57:39Z.


Independent AMD verification on upstream main at edc2e54e7e75fcd7c0f13e98b47ba119d9a08268. AI-assisted report, tests run locally from unmodified Xbox2Windows source.

Windows 11 25H2 x64 build 26200.9974, MSVC 19.44.35230, Windows SDK 10.0.26100, DXC 1.8.2502.8, Python 3.12.10. The renderer selected the discrete RX 9070 XT (1002:7550, driver 32.0.32029.2010) and WARP (1414:008c, 10.0.26100.9818). Both reported debug_layer=unavailable.

I built SPIRV-Tools v2025.5 with its pinned headers and SPIRV-Cross 57e4efc from Khronos source archives. With those tools on PATH, $intakePython pointing to the local Python environment, and the debug CRT DLLs staged beside the renderer:

cmake --preset dev "-DINTAKE_PYTHON=$intakePython"
cmake --build --preset dev --target offscreen_check
$env:XBOX2WINDOWS_ADAPTER = 'RX 9070 XT'
ctest --preset dev --no-tests=error -R '^spirv_(address_window|ballot_extract)_(hardware|warp)$' -V

Both spirv_address_window tests passed. Each adapter matched all 16 words for each of the eight cases, including the guard words, the overflowing index addition, and the beyond-descriptor write. The separate & $intakePython -B tests/spirv_window/check.py run validated the physical and logical SPIR-V and passed the rejection cases. No unexpected mismatches or capability skips.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7083999391 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/553#issuecomment-7083999391). Originally posted by [rwZephyr](https://github.com/rwZephyr) on 2026-11-22T18:57:39Z. --- Independent AMD verification on upstream `main` at `edc2e54e7e75fcd7c0f13e98b47ba119d9a08268`. AI-assisted report, tests run locally from unmodified Xbox2Windows source. Windows 11 25H2 x64 build `26200.9974`, MSVC `19.44.35230`, Windows SDK `10.0.26100`, DXC `1.8.2502.8`, Python `3.12.10`. The renderer selected the discrete RX 9070 XT (`1002:7550`, driver `32.0.32029.2010`) and WARP (`1414:008c`, `10.0.26100.9818`). Both reported `debug_layer=unavailable`. I built [SPIRV-Tools v2025.5](https://github.com/KhronosGroup/SPIRV-Tools/releases/tag/v2025.5) with its pinned headers and [SPIRV-Cross `57e4efc`](https://github.com/KhronosGroup/SPIRV-Cross/tree/57e4efcc84112abcd426dc5ec248b5339bee04f2) from Khronos source archives. With those tools on `PATH`, `$intakePython` pointing to the local Python environment, and the debug CRT DLLs staged beside the renderer: ```powershell cmake --preset dev "-DINTAKE_PYTHON=$intakePython" cmake --build --preset dev --target offscreen_check $env:XBOX2WINDOWS_ADAPTER = 'RX 9070 XT' ctest --preset dev --no-tests=error -R '^spirv_(address_window|ballot_extract)_(hardware|warp)$' -V ``` Both `spirv_address_window` tests passed. Each adapter matched all 16 words for each of the eight cases, including the guard words, the overflowing index addition, and the beyond-descriptor write. The separate `& $intakePython -B tests/spirv_window/check.py` run validated the physical and logical SPIR-V and passed the rejection cases. No unexpected mismatches or capability skips.
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!547
No description provided.