[PR #1737] d3d12: refuse command signatures with arguments before the draw (D3D-INDIRECT-STATE-REFUSE) #1753

Open
opened 2026-11-26 21:18:50 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1737
Author: @potatoe0100
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: d3d12-indirect-state-refuse


📝 Commits (1)

  • cc642e6 d3d12: refuse command signatures with arguments before the draw (D3D-INDIRECT-STATE-REFUSE)

📊 Changes

3 files changed (+91 additions, -1 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+6 -1)
📝 runtime/shims/d3d12_vulkan_device.cpp (+11 -0)
📝 runtime/test/d3d12_execute_indirect_validation_test.cpp (+74 -0)

📄 Description

Claimed in the coordination issue as: D3D-INDIRECT-STATE-REFUSE

Depends on: none. #1620 (INDIRECT-STATE-ARGS) touches the same function; whichever lands second drops the VERTEX/INDEX_BUFFER_VIEW part of this refusal once those arguments are replayed.

What and why

On main, CreateCommandSignature accepts a valid signature that puts arguments before its draw or dispatch (root constants, root CBV/SRV/UAV, vertex and index buffer views). But the CommandSignature object keeps only its kind and stride, and ExecuteIndirect reads the draw arguments at the start of each record. So [VERTEX_BUFFER_VIEW, DRAW] or [CONSTANT, DRAW] was accepted and then drew with the state argument's bytes as its vertex and instance counts, with no message.

Until per-command state is replayed (section 4.7 of docs/d3d12_vulkan.md), CreateCommandSignature now answers E_NOTIMPL for a signature with more than one argument, and logs it once per first argument type, the way other unimplemented features are refused. Invalid descriptions are still E_INVALIDARG as on the host, since the checks run first. One-argument signatures are unchanged, and the title's five startup signatures (section 4.9) each have one argument.

  • runtime/shims/d3d12_vulkan_device.cpp: the refusal.
  • runtime/test/d3d12_execute_indirect_validation_test.cpp: a layer-only check that eight such shapes (VBV+draw, IBV+draw indexed, constant+draw, constant+dispatch, CBV+draw, SRV+draw indexed, UAV+dispatch, VBV+constant+draw) are refused with no object, that their invalid neighbours (no root signature, short stride) stay E_INVALIDARG, and that a one-argument signature with a root signature is still created.
  • docs/d3d12_vulkan.md section 4.7: says so.

Tested

Built with VS 2022 Build Tools (MSVC 19.44), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, RelWithDebInfo, on main 57ba40bd6. No game files.

  • ctest -R ^d3d12_execute_indirect_validation$ with LEONIDA_VK_VALIDATION=1: passes (state-argument signatures: 8 shapes refused with E_NOTIMPL; 51 parity cases against live WARP and the RTX 4060, 0 validation errors). With only the shim change reverted, it fails at the first shape: hr=0x00000000, object created.
  • Full ctest -j 6: 384 of 384 passed, 13 skipped (game-data and optional tests).

GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro build 26300

AI-assisted: yes (Claude Code). Posted by a non-developer tester.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: D3D12 layer, no translator change)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1737 **Author:** [@potatoe0100](https://github.com/potatoe0100) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `d3d12-indirect-state-refuse` --- ### 📝 Commits (1) - [`cc642e6`](https://github.com/ubiquitarianism/leonida/commit/cc642e6a4b0c080b2eb2618c26a019feaf56c268) d3d12: refuse command signatures with arguments before the draw (D3D-INDIRECT-STATE-REFUSE) ### 📊 Changes **3 files changed** (+91 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+6 -1) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+11 -0) 📝 `runtime/test/d3d12_execute_indirect_validation_test.cpp` (+74 -0) </details> ### 📄 Description Claimed in the coordination issue as: [D3D-INDIRECT-STATE-REFUSE](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7159569770) Depends on: none. #1620 (INDIRECT-STATE-ARGS) touches the same function; whichever lands second drops the VERTEX/INDEX_BUFFER_VIEW part of this refusal once those arguments are replayed. ### What and why On `main`, `CreateCommandSignature` accepts a valid signature that puts arguments before its draw or dispatch (root constants, root CBV/SRV/UAV, vertex and index buffer views). But the `CommandSignature` object keeps only its kind and stride, and `ExecuteIndirect` reads the draw arguments at the start of each record. So `[VERTEX_BUFFER_VIEW, DRAW]` or `[CONSTANT, DRAW]` was accepted and then drew with the state argument's bytes as its vertex and instance counts, with no message. Until per-command state is replayed (section 4.7 of `docs/d3d12_vulkan.md`), `CreateCommandSignature` now answers `E_NOTIMPL` for a signature with more than one argument, and logs it once per first argument type, the way other unimplemented features are refused. Invalid descriptions are still `E_INVALIDARG` as on the host, since the checks run first. One-argument signatures are unchanged, and the title's five startup signatures (section 4.9) each have one argument. - `runtime/shims/d3d12_vulkan_device.cpp`: the refusal. - `runtime/test/d3d12_execute_indirect_validation_test.cpp`: a layer-only check that eight such shapes (VBV+draw, IBV+draw indexed, constant+draw, constant+dispatch, CBV+draw, SRV+draw indexed, UAV+dispatch, VBV+constant+draw) are refused with no object, that their invalid neighbours (no root signature, short stride) stay `E_INVALIDARG`, and that a one-argument signature with a root signature is still created. - `docs/d3d12_vulkan.md` section 4.7: says so. ### Tested Built with VS 2022 Build Tools (MSVC 19.44), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, RelWithDebInfo, on `main` `57ba40bd6`. No game files. - `ctest -R ^d3d12_execute_indirect_validation$` with `LEONIDA_VK_VALIDATION=1`: passes (`state-argument signatures: 8 shapes refused with E_NOTIMPL`; 51 parity cases against live WARP and the RTX 4060, 0 validation errors). With only the shim change reverted, it fails at the first shape: `hr=0x00000000, object created`. - Full `ctest -j 6`: 384 of 384 passed, 13 skipped (game-data and optional tests). GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro build 26300 AI-assisted: yes (Claude Code). Posted by a non-developer tester. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: D3D12 layer, no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1753
No description provided.