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

Manually merged
github merged 1 commit from gh-pr/1891/head into gh-pr/1891/base 2026-11-26 23:40:35 +00:00
Owner

@⁠avt0m4t48 on GitHub · 2026-11-24 20:18 UTC · original
avt0m4t48:fix/startup-indirect-indexed → main · +630 −44 · 5 files · 1 commits · merged 2026-11-24 20:36 UTC

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.

**@⁠avt0m4t48** on GitHub · 2026-11-24 20:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1891) `avt0m4t48:fix/startup-indirect-indexed` → `main` · +630 −44 · 5 files · 1 commits · merged 2026-11-24 20:36 UTC 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:40:33 +00:00
github manually merged commit 99266a5800 into gh-pr/1891/base 2026-11-26 23:40:35 +00:00
Author
Owner

@⁠ChazY11 on GitHub · 2026-11-24 20:34 UTC · original

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.
**@⁠ChazY11** on GitHub · 2026-11-24 20:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1891#issuecomment-7143750286) ## 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.