[PR #337] [CLOSED] d3d12: ExecuteIndirect accepts the argument ranges newer D3D12 runtimes accept (D3D-EXECIND-RANGE) #389

Closed
opened 2026-11-26 20:17:43 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/337
Author: @natterman12
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: d3d12/execute-indirect-host-divergence


📝 Commits (1)

  • 7f96cff d3d12: ExecuteIndirect accepts the argument ranges newer D3D12 runtimes accept

📊 Changes

3 files changed (+63 additions, -26 deletions)

View changed files

📝 runtime/shims/d3d12_com.cpp (+13 -6)
📝 runtime/src/vulkan_replay.h (+7 -7)
📝 runtime/test/d3d12_execute_indirect_validation_test.cpp (+43 -13)

📄 Description

Claimed in the coordination issue as: D3D-EXECIND-RANGE (#14)

Alternative to: #306 (draft, carried over from old-pr/10041). Both start from the same measurement; they decide the layer's behaviour in opposite ways, so please take one and close the other. See "Why not only the test" below.

What and why

d3d12_execute_indirect_validation fails on main on any host with a current D3D12 runtime. PC runtimes disagree on five ExecuteIndirect cases:

narrower rule wider rule
Argument range max_count * stride (max_count - 1) * stride + record_size
max_count 0 the offset must still be inside the buffer nothing is checked beyond alignment
Measured on WARP and an RTX 5060 (e1ec785b2's message) D3D12Core 10.0.26100.9818 on Windows 11 26300: WARP and RTX 3080 Ti here; WARP and RX 9070 XT in #306

e1ec785b2 moved the layer from the wider rule to the narrower one to match the hosts its author had, which made the test fail on every host with the wider rule, as it had failed on narrower hosts before. On this machine: 49 parity cases ... 5 failures, each layer=0 warp=1 hw=1 expected=0.

This change:

  • Layer, recording (runtime/shims/d3d12_com.cpp): the argument range is (max_count - 1) * stride + record_size, checked only when max_count is non-zero. The record-size, stride, alignment, buffer-dimension and count-buffer checks are unchanged.
  • Layer, replay (runtime/src/vulkan_replay.h): the same arithmetic. A zero count, which recording never passes on, needs alignment only.
  • Test: the five cases carry host_varies. The layer has to accept them; a live host may answer either way and is reported, not judged. Every other case still requires layer, WARP and hardware to agree. Two cases neither rule accepts are added (244+16>256, 224+20+16>256), so the wider rule's own boundary is pinned. The positive GPU path now also replays a padded-stride dispatch at the end of the buffer and a zero count at an offset outside it, with validation on.

Why not only the test

Keeping the layer strict and making the test tolerant (the approach of #306) leaves the layer refusing calls that the current Windows runtime runs. A refusal here fails Close() and the whole command list is dropped. Accepting costs nothing:

  • the wider rule is the one Vulkan states for vkCmdDrawIndirect / vkCmdDrawIndexedIndirect (stride * (drawCount - 1) + offset + sizeof(command) <= size), so replay needs no special handling;
  • no byte outside the argument buffer is read under it;
  • a title that only ever made calls valid under the narrower rule is unaffected.

What neither pull request can answer is which rule the console's own driver applies; that needs the executable. If you would rather keep the layer strict until then, #306 is the one to take.

Tested

Windows 11 10.0.26300.9974, NVIDIA GeForce RTX 3080 Ti, driver 621.24, D3D12Core and WARP 10.0.26100.9818, MSVC 19.44.35230, Vulkan SDK 1.4.363.0. Clean build of this branch (RelWithDebInfo). No game files.

  • d3d12_execute_indirect_validation: before, 5 failures of 49 cases. After: 51 parity cases (WARP=live, HW=NVIDIA GeForce RTX 3080 Ti), positive GPU dispatch ok, 0 validation errors, 0 failures, and runtime-dependent cases: the live hosts accepted 10 and refused 0 answers. The two added cases are refused by the layer, WARP and the hardware driver alike.
  • Full ctest: 290 tests, 2 failed, 9 skipped. The two are d3d12_vulkan_device (line 6576: tiles == 1, #262 / #238) and d3d12_depth_resolve (#66); both fail the same way on main here. d3d12_indirect_zero, d3d12_indirect_rt, d3d12_indirect_rt_upload_sysmem, d3d12_indirect_dispatch_count, d3d12_state_map and command_list pass.
  • Not tested on a host with the narrower rule: I have none. There the five cases should print the hosts' refusal and still pass, since only the layer is judged; that path is untested.
  • A note for anyone building on Windows: with the build folder under %TEMP%, MSBuild warns (MSB8029) and then does not rebuild after a header edit, so my first run tested stale code. The numbers above are from a clean build outside %TEMP%.

AI-assisted: yes (Claude Code)

Checklist

  • 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. (not applicable: 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/337 **Author:** [@natterman12](https://github.com/natterman12) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `d3d12/execute-indirect-host-divergence` --- ### 📝 Commits (1) - [`7f96cff`](https://github.com/ubiquitarianism/leonida/commit/7f96cff90da27e822d45c3380a193ca6bf00c0b3) d3d12: ExecuteIndirect accepts the argument ranges newer D3D12 runtimes accept ### 📊 Changes **3 files changed** (+63 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_com.cpp` (+13 -6) 📝 `runtime/src/vulkan_replay.h` (+7 -7) 📝 `runtime/test/d3d12_execute_indirect_validation_test.cpp` (+43 -13) </details> ### 📄 Description Claimed in the coordination issue as: D3D-EXECIND-RANGE (#14) Alternative to: #306 (draft, carried over from `old-pr/10041`). Both start from the same measurement; they decide the layer's behaviour in opposite ways, so please take one and close the other. See "Why not only the test" below. ### What and why `d3d12_execute_indirect_validation` fails on `main` on any host with a current D3D12 runtime. PC runtimes disagree on five `ExecuteIndirect` cases: | | narrower rule | wider rule | |---|---|---| | Argument range | `max_count * stride` | `(max_count - 1) * stride + record_size` | | `max_count` 0 | the offset must still be inside the buffer | nothing is checked beyond alignment | | Measured on | WARP and an RTX 5060 (e1ec785b2's message) | D3D12Core 10.0.26100.9818 on Windows 11 26300: WARP and RTX 3080 Ti here; WARP and RX 9070 XT in #306 | e1ec785b2 moved the layer from the wider rule to the narrower one to match the hosts its author had, which made the test fail on every host with the wider rule, as it had failed on narrower hosts before. On this machine: `49 parity cases ... 5 failures`, each `layer=0 warp=1 hw=1 expected=0`. This change: - **Layer, recording** (`runtime/shims/d3d12_com.cpp`): the argument range is `(max_count - 1) * stride + record_size`, checked only when `max_count` is non-zero. The record-size, stride, alignment, buffer-dimension and count-buffer checks are unchanged. - **Layer, replay** (`runtime/src/vulkan_replay.h`): the same arithmetic. A zero count, which recording never passes on, needs alignment only. - **Test**: the five cases carry `host_varies`. The layer has to accept them; a live host may answer either way and is reported, not judged. Every other case still requires layer, WARP and hardware to agree. Two cases neither rule accepts are added (`244+16>256`, `224+20+16>256`), so the wider rule's own boundary is pinned. The positive GPU path now also replays a padded-stride dispatch at the end of the buffer and a zero count at an offset outside it, with validation on. ### Why not only the test Keeping the layer strict and making the test tolerant (the approach of #306) leaves the layer refusing calls that the current Windows runtime runs. A refusal here fails `Close()` and the whole command list is dropped. Accepting costs nothing: - the wider rule is the one Vulkan states for `vkCmdDrawIndirect` / `vkCmdDrawIndexedIndirect` (`stride * (drawCount - 1) + offset + sizeof(command) <= size`), so replay needs no special handling; - no byte outside the argument buffer is read under it; - a title that only ever made calls valid under the narrower rule is unaffected. What neither pull request can answer is which rule the console's own driver applies; that needs the executable. If you would rather keep the layer strict until then, #306 is the one to take. ### Tested Windows 11 10.0.26300.9974, NVIDIA GeForce RTX 3080 Ti, driver 621.24, D3D12Core and WARP 10.0.26100.9818, MSVC 19.44.35230, Vulkan SDK 1.4.363.0. Clean build of this branch (`RelWithDebInfo`). No game files. - `d3d12_execute_indirect_validation`: before, 5 failures of 49 cases. After: `51 parity cases (WARP=live, HW=NVIDIA GeForce RTX 3080 Ti), positive GPU dispatch ok, 0 validation errors, 0 failures`, and `runtime-dependent cases: the live hosts accepted 10 and refused 0 answers`. The two added cases are refused by the layer, WARP and the hardware driver alike. - Full `ctest`: 290 tests, 2 failed, 9 skipped. The two are `d3d12_vulkan_device` (`line 6576: tiles == 1`, #262 / #238) and `d3d12_depth_resolve` (#66); both fail the same way on `main` here. `d3d12_indirect_zero`, `d3d12_indirect_rt`, `d3d12_indirect_rt_upload_sysmem`, `d3d12_indirect_dispatch_count`, `d3d12_state_map` and `command_list` pass. - Not tested on a host with the narrower rule: I have none. There the five cases should print the hosts' refusal and still pass, since only the layer is judged; that path is untested. - A note for anyone building on Windows: with the build folder under `%TEMP%`, MSBuild warns (MSB8029) and then does not rebuild after a header edit, so my first run tested stale code. The numbers above are from a clean build outside `%TEMP%`. AI-assisted: yes (Claude Code) ### Checklist - [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. (not applicable: 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>
4ld0 2026-11-26 20:17:43 +01:00
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#389
No description provided.