Skip to content

D3D-482: Draw, Dispatch and ExecuteIndirect(DISPATCH) recorded with no PSO are no-ops, as on the host D3D12 runtime - #7007

Closed
lines9686-rgb wants to merge 2 commits into
ItsNotRexed:mainfrom
lines9686-rgb:d3d12-null-pso-noop
Closed

lines9686-rgb wants to merge 2 commits into
ItsNotRexed:mainfrom
lines9686-rgb:d3d12-null-pso-noop

Conversation

@lines9686-rgb

Copy link
Copy Markdown
Contributor

Claim: #6750 (comment)

What native D3D12 does

Measured with a standalone probe (no Leonida code) on an RTX 3060 Ti (NVIDIA 610.88) and on WARP:

Recorded with no PSO NVIDIA WARP
DrawInstanced(3) / DrawIndexedInstanced(3), nothing set Close S_OK, executed, device alive Close S_OK, device removed on execution
DrawInstanced(3), root signature + topology Close S_OK, executed, alive Close S_OK
Dispatch(1,1,1), with or without a root signature Close S_OK, executed, alive Close S_OK
ExecuteIndirect(DISPATCH, 1), with or without a root signature Close S_OK, executed, alive Close S_OK

With the debug layer on, the runtime says "The runtime will use a default no-op pipeline state". So Close must succeed and the work does nothing. WARP removing the device is a WARP quirk, so the tests compare only Close with WARP.

Change

  • record_draw / record_dispatch: no PSO means return (no-op). With a PSO, a missing root signature or topology still fails Close, as before. This is pmilewsskiedu-gif's commit from fix/d3d12-null-pso-noop-20261122, cherry-picked with authorship kept and rebased onto current main.
  • ExecuteIndirect(DISPATCH) with no compute PSO gets the same no-op.
  • d3d12_close_parity: the four "with nothing set" Draw/Dispatch rows go from stricter to match.
  • New d3d12_null_pso_noop test covers Draw, DrawIndexed, Dispatch and ExecuteIndirect(DISPATCH), zero and nonzero. On the Vulkan layer it also submits real null-PSO work and checks that a CopyBufferRegion recorded after it still runs.
  • d3d12_compute_test expects Close() == S_OK for a dispatch with no PSO.

Testing (Windows 11, MSVC, RTX 3060 Ti)

Branch d3d12-null-pso-noop on main 1cc6e3c12, MSVC RelWithDebInfo, Ninja, NVIDIA 610.88.

AI-assisted: yes (Claude Code)

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md). The native numbers come from a synthetic probe with no game files.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

pmilewsskiedu-gif and others added 2 commits November 23, 2026 18:24
…; close parity and the null-PSO test

The host runtime runs Draw, Dispatch and ExecuteIndirect(DISPATCH) recorded with no PSO through its no-op
pipeline state (RTX 3060 Ti, NVIDIA 610.88: Close S_OK, executed, device alive; the debug layer's message is
"The runtime will use a default no-op pipeline state"). WARP closes the same lists but removes the device when a
nonzero null-PSO draw executes, so only Close is compared with WARP. ExecuteIndirect(DISPATCH) gets the same no-op
as Dispatch; d3d12_close_parity's four "with nothing set" rows now match WARP; d3d12_null_pso_noop_test adds the
ExecuteIndirect cases and a layer-only run of real null-PSO work followed by a copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@SirKingg SirKingg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent Windows/GPU review of d0656b7f64578dd3dde858355b080f7325ba6a77 (AI-assisted; synthetic fixtures only, no game files).

Windows 11, MSVC 19.44, RTX 4070 Ti, NVIDIA 610.88. With LEONIDA_VK_VALIDATION=1, targeted CTest d3d12_null_pso_noop, d3d12_close_parity, d3d12_compute, d3d12_draw, d3d12_bundle, and d3d12_com passed (6/6). The null-PSO test reported eight WARP/layer Close matches, successful zero-work WARP and layer copies, successful nonzero layer copy, and zero validation errors. The 100-case Close parity test reported 0 failures (31 known differences).

Independent synthetic probes: native NVIDIA Close succeeded for all eight zero/nonzero cases; zero and nonzero Draw/Dispatch/ExecuteIndirect(DISPATCH) followed by a copy completed and the device remained alive. Layer negative controls preserved E_INVALIDARG for an invalid root argument and a null indirect argument buffer; Reset(nullptr) cleared the error. A bound compute PSO without a root signature still failed Close; Reset(nullptr) and ClearState(nullptr) restored null-PSO no-op behavior, and the compute fixture continued to pass with validation enabled.

Limits: WARP nonzero work was not submitted; indexed nonzero draw was checked at Close only. Indirect signatures that modify root arguments and their effects on later commands were not independently exercised. The M4 compute target was not generated because llvm-mc was unavailable. No full CTest run was performed.

No approval at this point: coordination records an unresolved overlap with #6945 (see #6750 and #6910), and the stateful indirect case remains unverified.

@dadsmallbuk1

Copy link
Copy Markdown

Heads-up, for the coordinator and both authors: #6945 (@KorahX365, opened 15:31) and #7007 (@lines9686-rgb, opened 15:40) both implement D3D-482. They change the same record_draw/record_dispatch paths in runtime/shims/d3d12_com.cpp, and both add runtime/test/d3d12_null_pso_noop_test.cpp, so whichever merges second will conflict. #7007 also covers ExecuteIndirect(DISPATCH). #6945 passed here earlier today (RTX 5090: 9/9 cases match WARP). Could you two decide which to keep, or fold the ExecuteIndirect part into one?

AI-assisted (Claude Code).

@nnonno91

Copy link
Copy Markdown

AI-assisted verification of d0656b7 on Windows 11 (build 26200), RTX 5090 (NVIDIA 617.42, Vulkan 1.4.351, subgroup 32..32), MSVC 19.51.36244 Release. The Vulkan-backed layer used the RTX 5090 with default Vulkan settings.

CTest passed 4/4: d3d12_null_pso_noop, d3d12_close_parity, d3d12_compute, and d3d12_draw.

The null-PSO test passed all eight cases, including zero and nonzero ExecuteIndirect(DISPATCH). Both returned S_OK from Close on the layer and WARP. The Vulkan layer also submitted the null-PSO work and completed the following buffer copy. The 100-case Close parity test reported 69 WARP matches, 31 known differences, and zero failures. Synthetic tests only.

@Bj0rnis

Bj0rnis commented Nov 23, 2026

Copy link
Copy Markdown

Verified on Windows 11 (MSVC 19.44 / Ninja, Vulkan SDK 1.4.363.0) at d0656b7f with LEONIDA_VK_VALIDATION=1:

  • NVIDIA GeForce RTX 5070 Ti: 5/5 PASS (d3d12_com, d3d12_null_pso_noop, d3d12_close_parity, d3d12_compute, d3d12_draw; 2.33 s, 0 Vulkan validation errors).
  • AMD Radeon(TM) Graphics (iGPU): 5/5 PASS (1.35 s, 0 Vulkan validation errors).

@TripleJ160

Copy link
Copy Markdown

Tested d0656b7f on RTX 5090 (NVIDIA 616.92) and the Ryzen 7 9800X3D Radeon iGPU (AMD 25.10.30), Windows 11 Pro build 26200, MSVC 19.44, Vulkan SDK 1.4.363.0. 4/4 CTests passed on each adapter with Vulkan validation enabled.

  • d3d12_null_pso_noop: all 8 cases passed on each GPU, with zero validation errors. The copy after nonzero null-PSO draw, dispatch, and indirect dispatch completed.
  • d3d12_close_parity: 100 cases checked, zero unexpected results.
  • d3d12_compute and d3d12_m4_compute passed. M4 matched all 1,924 reference words on each GPU.

Synthetic fixtures only. AI-assisted.

@lines9686-rgb

Copy link
Copy Markdown
Contributor Author

Thanks @dadsmallbuk1. For the record: @KorahX365 claimed D3D-482 at 15:19:26 and I claimed at 15:19:32, so their claim came first and I hadn't seen it.

What #7007 has beyond #6945:

  • ExecuteIndirect(DISPATCH) with no compute PSO is a no-op too, matching native D3D12.
  • The four "with nothing set" rows in d3d12_close_parity go from stricter to match. Without this, that test still describes the old behaviour.
  • On the layer, real null-PSO draw/dispatch/indirect work is executed before a copy.
  • It keeps @pmilewsskiedu-gif's commit as theirs.

It has been verified on RTX 5090, RTX 5070 Ti, the 9800X3D iGPU and my RTX 3060 Ti.

@KorahX365, either way is fine with me. Keep #7007, or I rebase those three parts onto #6945 as a follow-up once it merges and close this one. I'll go with whatever you or the coordinator prefer.

AI-assisted (Claude Code).

@moistman7

Copy link
Copy Markdown

Tested d0656b7f merged onto main 4da521de (clean) on native Windows 11 26200, MSVC 2022 Build Tools, RelWithDebInfo, on both adapters of one machine: NVIDIA GeForce RTX 5090 (617.42) and AMD Radeon Graphics (Ryzen 7 9800X3D iGPU, RDNA2, AMD driver 32.0.21042.62) via LEONIDA_VK_DEVICE: pass.

@skorex

skorex commented Nov 23, 2026

Copy link
Copy Markdown

Duplicate of #6945

#6945 makes the same change and was opened earlier. Topic: D3D-482 null-PSO Draw/Dispatch are no-ops.

Suggest closing this PR in favour of #6945, and porting anything this one adds that #6945 lacks there.

@Ryneh13

Ryneh13 commented Nov 23, 2026

Copy link
Copy Markdown

Tested d0656b7 on a GeForce RTX 5050 (driver 610.88, Vulkan 1.4.341), Windows 11 25H2 (26200.9974), MSVC 19.52 Release.

All four targeted tests passed: d3d12_null_pso_noop, d3d12_close_parity, d3d12_compute, and d3d12_draw.

I followed up on the stateful ExecuteIndirect case. I set two root constants to (17, 29), then recorded CONSTANT + DISPATCH without a compute PSO, targeting only the first constant. After binding a PSO, a direct Dispatch read back (0, 29) on native D3D12 and (17, 29) on Leonida. The mismatch reproduced in all three runs. The dispatch-only and no-indirect controls matched on both backends.

Synthetic fixtures only. Vulkan validation off. AI-assisted (Codex).

@lines9686-rgb

Copy link
Copy Markdown
Contributor Author

Closing in favour of #6945 (@KorahX365 claimed D3D-482 first). The ExecuteIndirect no-op, the close-parity rows and the layer execution check are offered there: #6945. Thanks to everyone who tested this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants