D3D12.X: skip direct draws and unmatched ExecuteIndirect on two-pass MS/GS PSOs #2028

Manually merged
github merged 1 commit from gh-pr/2028/head into gh-pr/2028/base 2026-11-26 05:15:40 +00:00
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:15 UTC · original
raylitebull:fix/bind-twopass-close-invalidarg-v2 → main · +144 −1 · 2 files · 1 commits · merged 2026-11-25 10:49 UTC

Prevents bind.rs from falling through to raw PC DrawInstanced, DrawIndexedInstanced, and non-DispatchMesh ExecuteIndirect calls against finished two-pass MS/GS mesh-shader pipelines, eliminating ID3D12GraphicsCommandList::Close() E_INVALIDARG (0x80070057) failures.

Part of #1833.

What is in it

  • crates/xcl/src/hle/d3d12x/bind.rs (+128 / -1): guard graphics_bound and the execute_indirect non-DispatchMesh fallthrough on two_pass_of(...) so finished two-pass pipelines registered in TWO_PASS are never bound with the title's graphics root signature for incompatible direct/indirect draw calls, plus CPU regression unit tests (hle::d3d12x::bind::).
  • crates/xcl/src/hle/d3d12x/real.rs (+17): add #[cfg(test)] helper register_two_pass_for_test for the unit tests.

Tested

  • Toolchain: Windows 11 x64, rustc 1.99.1 (58cf8f9c3 2026-10-13), base 279d3ea (a7b478b).
  • cargo check --workspace --tests: passed (0 new warnings).
  • cargo test -p xcl --lib hle::d3d12x::bind::: 7 passed, 0 failed.
  • Exact-head 60 s scripts/smoke.ps1 regression pair on NVIDIA GeForce RTX 3060 (@Anon64): passed (0 device removals, 0 crashes).

Regression run
60 s scripts/smoke.ps1 pair on exact head a7b478b vs main (NVIDIA GeForce RTX 3060 12 GB, driver 581.80, Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s on a retail title), contributed by @Anon64:

main:

xcl-smoke v1
commit: 0be6ce8cc20a9de06e6f0f443113af42a6c21248
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1584 (PresentX 1585)
presents per 2 s (last 3): 53 53 46
device removals: 0
crashes: 0
peak commit: 20052 MB

this PR:

xcl-smoke v1
commit: a7b478ba50c2afabb6421ada995af029cd9bef5a
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1504 (PresentX 1504)
presents per 2 s (last 3): 44 10 3
device removals: 0
crashes: 0
peak commit: 24046 MB

Not tested

  • 60 s scripts/smoke.ps1 pair on a7b478b, full cargo test --workspace suite, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton.

AI use

  • Antigravity assisted with implementation and unit tests; the author reviewed the diff and test output.
**@⁠raylitebull** on GitHub · 2026-11-25 01:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/2028) `raylitebull:fix/bind-twopass-close-invalidarg-v2` → `main` · +144 −1 · 2 files · 1 commits · merged 2026-11-25 10:49 UTC Prevents `bind.rs` from falling through to raw PC `DrawInstanced`, `DrawIndexedInstanced`, and non-`DispatchMesh` `ExecuteIndirect` calls against finished two-pass MS/GS mesh-shader pipelines, eliminating `ID3D12GraphicsCommandList::Close()` `E_INVALIDARG` (`0x80070057`) failures. Part of #1833. **What is in it** - `crates/xcl/src/hle/d3d12x/bind.rs` (`+128 / -1`): guard `graphics_bound` and the `execute_indirect` non-`DispatchMesh` fallthrough on `two_pass_of(...)` so finished two-pass pipelines registered in `TWO_PASS` are never bound with the title's graphics root signature for incompatible direct/indirect draw calls, plus CPU regression unit tests (`hle::d3d12x::bind::`). - `crates/xcl/src/hle/d3d12x/real.rs` (`+17`): add `#[cfg(test)]` helper `register_two_pass_for_test` for the unit tests. **Tested** - Toolchain: Windows 11 x64, `rustc 1.99.1 (58cf8f9c3 2026-10-13)`, base `279d3ea` (`a7b478b`). - `cargo check --workspace --tests`: passed (`0` new warnings). - `cargo test -p xcl --lib hle::d3d12x::bind::`: 7 passed, 0 failed. - Exact-head 60 s `scripts/smoke.ps1` regression pair on NVIDIA GeForce RTX 3060 (`@Anon64`): passed (0 device removals, 0 crashes). **Regression run** 60 s `scripts/smoke.ps1` pair on exact head `a7b478b` vs `main` (NVIDIA GeForce RTX 3060 12 GB, driver 581.80, Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s on a retail title), contributed by `@Anon64`: main: ``` xcl-smoke v1 commit: 0be6ce8cc20a9de06e6f0f443113af42a6c21248 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1584 (PresentX 1585) presents per 2 s (last 3): 53 53 46 device removals: 0 crashes: 0 peak commit: 20052 MB ``` this PR: ``` xcl-smoke v1 commit: a7b478ba50c2afabb6421ada995af029cd9bef5a gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1504 (PresentX 1504) presents per 2 s (last 3): 44 10 3 device removals: 0 crashes: 0 peak commit: 24046 MB ``` **Not tested** - 60 s `scripts/smoke.ps1` pair on `a7b478b`, full `cargo test --workspace` suite, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton. **AI use** - Antigravity assisted with implementation and unit tests; the author reviewed the diff and test output.
Finished two-pass MS and GS pipelines are PC mesh shader (MS+PS) pipelines registered in TWO_PASS rather than TRANSLATED_GRAPHICS. Previously, once async compilation completed, graphics_bound and the non-DispatchMesh fallthrough in execute_indirect treated them as untranslated PC pipelines, bound the title's graphics root signature, and issued DrawInstanced/DrawIndexedInstanced/ExecuteIndirect against the bound mesh PSO, causing D3D12 Close() to fail with E_INVALIDARG (0x80070057). Guard both paths on two_pass_of(...) so finished two-pass pipelines never fall through to incompatible direct/indirect draw calls, and add a CPU regression test.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:15:36 +00:00
github manually merged commit a7b478ba50 into gh-pr/2028/base 2026-11-26 05:15:40 +00:00
Author
Owner

@⁠Anon64 on GitHub · 2026-11-25 02:28 UTC · original

Regression run for this PR: head a7b478b, based on main 0be6ce8. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s, back to back with the main run.

main 0be6ce8:

xcl-smoke v1
commit: 0be6ce8cc20a9de06e6f0f443113af42a6c21248
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1584 (PresentX 1585)
presents per 2 s (last 3): 53 53 46
device removals: 0
crashes: 0
peak commit: 20052 MB

this PR:

xcl-smoke v1
commit: a7b478ba50c2afabb6421ada995af029cd9bef5a
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1504 (PresentX 1504)
presents per 2 s (last 3): 44 10 3
device removals: 0
crashes: 0
peak commit: 24046 MB

No device removals or crashes; 94 % of main's frames, 119 % of its peak commit.

Not tested: the whole suite; world loading; whether the title reaches the changed code in these 60 s.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-25 02:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/2028#issuecomment-7150773016) Regression run for this PR: head `a7b478b`, based on `main` `0be6ce8`. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s, back to back with the `main` run. main `0be6ce8`: ``` xcl-smoke v1 commit: 0be6ce8cc20a9de06e6f0f443113af42a6c21248 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1584 (PresentX 1585) presents per 2 s (last 3): 53 53 46 device removals: 0 crashes: 0 peak commit: 20052 MB ``` this PR: ``` xcl-smoke v1 commit: a7b478ba50c2afabb6421ada995af029cd9bef5a gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1504 (PresentX 1504) presents per 2 s (last 3): 44 10 3 device removals: 0 crashes: 0 peak commit: 24046 MB ``` No device removals or crashes; 94 % of main's frames, 119 % of its peak commit. **Not tested:** the whole suite; world loading; whether the title reaches the changed code in these 60 s. Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-25 02:33 UTC · original

A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with main (1398 here, 1357 and 1365 on the two main runs). Neither of the PR's new warnings appears in the log, so the two-pass MS/GS path is not reached in this 60 s run; this is a regression run only.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. a7b478b as it is (based on 0be6ce8) and main cbc296a, no uncommitted changes. Retail title 1.0.2.1, scripts/linux/smoke.sh (#257) for 60 s, no input. Runs in order: main, this PR (with other PRs in between), main.

Regression run

main (first run):

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1357 (PresentX 1357)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: a7b478ba50c2afabb6421ada995af029cd9bef5a
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1398 (PresentX 1398)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The second main run: 1365 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head, a scene that uses the two-pass MS/GS pipelines, native Windows.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
**@⁠JoaoPauluu** on GitHub · 2026-11-25 02:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/2028#issuecomment-7150875359) A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with `main` (1398 here, 1357 and 1365 on the two `main` runs). Neither of the PR's new warnings appears in the log, so the two-pass MS/GS path is not reached in this 60 s run; this is a regression run only. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `a7b478b` as it is (based on `0be6ce8`) and `main` `cbc296a`, no uncommitted changes. Retail title 1.0.2.1, `scripts/linux/smoke.sh` (#257) for 60 s, no input. Runs in order: main, this PR (with other PRs in between), main. **Regression run** main (first run): ``` xcl-smoke v1 commit: cbc296ab65a2661a61e3e2da109134bcd5319f60 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1357 (PresentX 1357) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` this PR: ``` xcl-smoke v1 commit: a7b478ba50c2afabb6421ada995af029cd9bef5a gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1398 (PresentX 1398) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` The second `main` run: 1365 frames, `exit: 0x0`, no device removal, no crash. Under Wine, `peak commit` reads 0 MB, so these blocks do not check memory. **Not tested** - the test suite on this head, a scene that uses the two-pass MS/GS pipelines, native Windows. **AI use** - Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 02:42 UTC · original

Empirical verification — PR #2028 (a7b478ba50c2afabb6421ada995af029cd9bef5a)

Tested clean detached PR head a7b478ba50c2afabb6421ada995af029cd9bef5a on STOR-WINLAB.

Environment

  • Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver 32.0.101.9175, wave range 8–32, DoublePrecisionFloatShaderOps=0, d3d12SDKLayers.dll absent).
  • rustc 1.100.0 (0ef1bc386 2026-11-09) (CARGO_INCREMENTAL=0, debug info 0). Standalone DXC/DXIL 1.9.2609.5 was on PATH; the test title logged Windows SDK DXC 1.9.2602.17 (21d28f72).

Tested

  • cargo build --workspace and cargo test --workspace --no-run exited 0 outside the GPU lock.
  • cargo test -p xcl --lib two_pass_pso_skips_direct_draw_and_unmatched_execute_indirect -- --nocapture: 1 passed, 0 failed, 0 ignored, 0 skipped (also passed in workspace suite; verified both direct-draw guard and unmatched ExecuteIndirect skip without binding graphics root signature or calling fake native ExecuteIndirect).
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (under Invoke-ArcTest.ps1, exited 101): 1,054 passed, 27 failed, 46 ignored across 20 test binaries, with 23 SKIPPED lines across 13 tests (excluded from coverage; libtest pass counts include early returns).
    • Failures (27): 26 in xcl --lib shader/DXIL tests (22 CreateComputePipelineState 0x80070057, 4 shader output assertions: gpu_nonfused_mad_and_mac_prevent_fma_contraction, gpu_ps_image_sample_offset_implicit_lod_between_mips, gpu_valu_16_and_64_bit, gpu_wave64_ps_whole_wave_reductions) plus e2e::test_title_runs_and_game_folder_is_untouched (RSSetDepthBiasX #94 blue vs green). Unrelated to two-pass MS/GS guards (no same-run main baseline).
    • Skips (23 visible lines): 18 wave64 unavailable, 3 refused wave32 per-lane lowerings, 1 driver-cache disable unavailable, 1 heap-window fallback unavailable; missing debug-layer early return captured separately (0x887A002D).

Not tested

  • Retail Xbox title runs, real-title two-pass MS/GS command lists, scripts/smoke.ps1, matched main baseline, and D3D12 debug-layer validation.

AI use

  • T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr2028-suite.log and published this report.
**@⁠JJAutoCompare** on GitHub · 2026-11-25 02:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/2028#issuecomment-7151074153) ### Empirical verification — PR #2028 (`a7b478ba50c2afabb6421ada995af029cd9bef5a`) Tested clean detached PR head `a7b478ba50c2afabb6421ada995af029cd9bef5a` on STOR-WINLAB. **Environment** - Windows 11 Enterprise Evaluation build `26200.9974`, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver `32.0.101.9175`, wave range 8–32, `DoublePrecisionFloatShaderOps=0`, `d3d12SDKLayers.dll` absent). - `rustc 1.100.0 (0ef1bc386 2026-11-09)` (`CARGO_INCREMENTAL=0`, debug info 0). Standalone DXC/DXIL `1.9.2609.5` was on `PATH`; the test title logged Windows SDK DXC `1.9.2602.17` (`21d28f72`). **Tested** - `cargo build --workspace` and `cargo test --workspace --no-run` exited 0 outside the GPU lock. - `cargo test -p xcl --lib two_pass_pso_skips_direct_draw_and_unmatched_execute_indirect -- --nocapture`: **1 passed, 0 failed, 0 ignored, 0 skipped** (also passed in workspace suite; verified both direct-draw guard and unmatched `ExecuteIndirect` skip without binding graphics root signature or calling fake native `ExecuteIndirect`). - `cargo test --workspace --no-fail-fast -- --test-threads=4` (under `Invoke-ArcTest.ps1`, exited 101): **1,054 passed, 27 failed, 46 ignored** across 20 test binaries, with **23 `SKIPPED` lines across 13 tests** (excluded from coverage; libtest pass counts include early returns). - **Failures (27):** 26 in `xcl --lib` shader/DXIL tests (22 `CreateComputePipelineState` `0x80070057`, 4 shader output assertions: `gpu_nonfused_mad_and_mac_prevent_fma_contraction`, `gpu_ps_image_sample_offset_implicit_lod_between_mips`, `gpu_valu_16_and_64_bit`, `gpu_wave64_ps_whole_wave_reductions`) plus `e2e::test_title_runs_and_game_folder_is_untouched` (`RSSetDepthBiasX` #94 blue vs green). Unrelated to two-pass MS/GS guards (no same-run `main` baseline). - **Skips (23 visible lines):** 18 wave64 unavailable, 3 refused wave32 per-lane lowerings, 1 driver-cache disable unavailable, 1 heap-window fallback unavailable; missing debug-layer early return captured separately (`0x887A002D`). **Not tested** - Retail Xbox title runs, real-title two-pass MS/GS command lists, `scripts/smoke.ps1`, matched `main` baseline, and D3D12 debug-layer validation. **AI use** - T3 Code / Codex (`gpt-6.2-sol`, `reasoningEffort: high`) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, `gemini-4-neon`) verified counts against `pr2028-suite.log` and published this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 04:12 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 04:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/2028#issuecomment-7152626195) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 10:38 UTC · original

Thanks @⁠Anon64 for running and sharing the exact-head 60 s scripts/smoke.ps1 pair on a7b478b (0 device removals, 0 crashes) — added to the PR description!

**@⁠raylitebull** on GitHub · 2026-11-25 10:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/2028#issuecomment-7159967793) Thanks @⁠Anon64 for running and sharing the exact-head 60 s `scripts/smoke.ps1` pair on `a7b478b` (0 device removals, 0 crashes) — added to the PR description!
This discussion has been locked. Commenting is limited to contributors.
No description provided.