runtime: forward one GPU-written indirect indexed draw #1884

Merged
avt0m4t48 merged 1 commit from upstream-pr/1891 into main 2026-11-24 20:36:47 +00:00
avt0m4t48 commented 2026-11-24 20:18:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by avt0m4t48 on 2026-11-24T20:18:17Z.


Refs #1759. Follows the Dispatch-only slice in #1867.

Forward one rootless desktop DrawIndexed record on guest command-list slot 61. In this slice the graphics pipeline uses reflected desktop SM5 vertex and pixel shader bytecode, no root parameters or vertex input layout, one single-sample color target, and a placed index view. Slot 61 checks the inherited state, translates the index view to the desktop backing address, and transitions the argument and index buffers for GPU reads. The direct draw paths keep their existing shader-cache behavior. Producers operating on the native list restore COMMON before entering the guest path.

The source-built compute writer selects left or right by changing StartIndexLocation. The left case uses a 16-bit index buffer and the right uses 32-bit indices. The fenced readback checks the exact color of all eight pixels and both argument guards. Omitted-writer, invalid-index and short-argument controls preserve the clear color.

Validation on Windows WARP with the debug layer enabled:

  • cmake --build --preset release --target startup_indirect_draw_indexed startup_indirect_dispatch
  • ctest --preset release --no-tests=error -R '^startup_indirect_(draw_indexed|dispatch)_warp$' -V passed 2/2.
  • Restoring the upstream runtime or zeroing the native index-buffer offset made the first pixel fail as expected with 0xff000000 instead of 0xff0000ff. Windows verification
  • Windows-target Clang syntax and portable repository lint checks ran from Linux.

To test on a physical adapter, run ctest --preset release --no-tests=error -R '^startup_indirect_draw_indexed_hardware$' -V on the built target. A physical GPU run and translation of guest graphics pipelines with resource bindings remain open.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6590600652 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1891). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-24T20:18:17Z. --- Refs #1759. Follows the Dispatch-only slice in #1867. Forward one rootless desktop DrawIndexed record on guest command-list slot 61. In this slice the graphics pipeline uses reflected desktop SM5 vertex and pixel shader bytecode, no root parameters or vertex input layout, one single-sample color target, and a placed index view. Slot 61 checks the inherited state, translates the index view to the desktop backing address, and transitions the argument and index buffers for GPU reads. The direct draw paths keep their existing shader-cache behavior. Producers operating on the native list restore COMMON before entering the guest path. The source-built compute writer selects left or right by changing StartIndexLocation. The left case uses a 16-bit index buffer and the right uses 32-bit indices. The fenced readback checks the exact color of all eight pixels and both argument guards. Omitted-writer, invalid-index and short-argument controls preserve the clear color. Validation on Windows WARP with the debug layer enabled: - `cmake --build --preset release --target startup_indirect_draw_indexed startup_indirect_dispatch` - `ctest --preset release --no-tests=error -R '^startup_indirect_(draw_indexed|dispatch)_warp$' -V` passed 2/2. - Restoring the upstream runtime or zeroing the native index-buffer offset made the first pixel fail as expected with `0xff000000` instead of `0xff0000ff`. [Windows verification](https://github.com/avt0m4t48/Xbox2Windows/actions/runs/45478647954) - Windows-target Clang syntax and portable repository lint checks ran from Linux. To test on a physical adapter, run `ctest --preset release --no-tests=error -R '^startup_indirect_draw_indexed_hardware$' -V` on the built target. A physical GPU run and translation of guest graphics pipelines with resource bindings remain open.
upstream-sync closed this pull request 2026-11-24 21:01:09 +00:00
ChazY11 commented 2026-11-24 21:01:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T20:34:19Z.


Built it here and ran both WARP tests

At the PR head, Windows 11 build 26300.9974, WARP 10.0.26100.9818:

cmake --preset dev
cmake --build --preset dev --target startup_indirect_draw_indexed startup_indirect_dispatch
ctest --preset dev -R '^startup_indirect_(draw_indexed|dispatch)_warp$'
1/2 Test #122: startup_indirect_dispatch_warp .......   Passed 0.45 sec
2/2 Test #124: startup_indirect_draw_indexed_warp ...   Passed 0.16 sec
100% tests passed, 0 tests failed out of 2

So the new slice runs here independently of the author's machine, and the Dispatch slice it builds on still passes.

Two mutations to the production side

Each rebuilt into d3d12_xs.dll (timestamp checked) and reverted:

mutation result
the D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED signature check short-circuited to false caught
desktop_indexed_shader: the BytecodeLength > (1u << 20) bound dropped not caught

The first is the load-bearing one: without the signature check the record is not recognised as this slice's shape and the
fixture notices. The second is a guard this fixture does not reach — it never feeds an oversized bytecode blob, so dropping
the upper bound keeps the test green. That is not a defect, just a note on what the fixture covers: the size bound and the
readable(...) check on the shader blob are defensive, and if you want them pinned they need their own cases (a blob just
over 1 MiB, and one with an unreadable page).

The preset change

CMakePresets.json grows the new target in the release build list and extends the pr test filter to
startup_indirect_(dispatch|draw_indexed)_warp. That is the right place for it — the PR lane now runs both slices — but it
does mean every PR's smoke test grows by one GPU test. At ~0.2 s on WARP that is fine; worth knowing it happened.

Verdict

Reviewed. The slice runs, its central recognition check is pinned by a mutation, and the negative controls in the description
(restore upstream runtime, zero the index-buffer offset) match the two things that could silently pass. No objections.

Notes

  • AI-assisted review.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7143750286 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1891#issuecomment-7143750286). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T20:34:19Z. --- ## Built it here and ran both WARP tests At the PR head, Windows 11 build 26300.9974, WARP 10.0.26100.9818: ```powershell cmake --preset dev cmake --build --preset dev --target startup_indirect_draw_indexed startup_indirect_dispatch ctest --preset dev -R '^startup_indirect_(draw_indexed|dispatch)_warp$' 1/2 Test #122: startup_indirect_dispatch_warp ....... Passed 0.45 sec 2/2 Test #124: startup_indirect_draw_indexed_warp ... Passed 0.16 sec 100% tests passed, 0 tests failed out of 2 ``` So the new slice runs here independently of the author's machine, and the `Dispatch` slice it builds on still passes. ## Two mutations to the production side Each rebuilt into `d3d12_xs.dll` (timestamp checked) and reverted: | mutation | result | |---|---| | the `D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED` signature check short-circuited to `false` | **caught** | | `desktop_indexed_shader`: the `BytecodeLength > (1u << 20)` bound dropped | not caught | The first is the load-bearing one: without the signature check the record is not recognised as this slice's shape and the fixture notices. The second is a guard this fixture does not reach — it never feeds an oversized bytecode blob, so dropping the upper bound keeps the test green. That is not a defect, just a note on what the fixture covers: the size bound and the `readable(...)` check on the shader blob are defensive, and if you want them pinned they need their own cases (a blob just over 1 MiB, and one with an unreadable page). ## The preset change `CMakePresets.json` grows the new target in the `release` build list and extends the `pr` test filter to `startup_indirect_(dispatch|draw_indexed)_warp`. That is the right place for it — the PR lane now runs both slices — but it does mean **every** PR's smoke test grows by one GPU test. At ~0.2 s on WARP that is fine; worth knowing it happened. ## Verdict Reviewed. The slice runs, its central recognition check is pinned by a mutation, and the negative controls in the description (restore upstream runtime, zero the index-buffer offset) match the two things that could silently pass. No objections. ## Notes - AI-assisted review.
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!1884
No description provided.