Store indirect signature argument types and replay VERTEX_BUFFER_VIEW/INDEX_BUFFER_VIEW state #1620

Closed
github-bot wants to merge 1 commit from gh-pr/1620/head into gh-pr/1620/base
Owner

@⁠BubsMcgee on GitHub · 2026-11-25 06:11 UTC · original
BubsMcgee:indirect-state-args → main · +101 −8 · 5 files · 1 commits · closed without merging

Claimed in the coordination issue as: INDIRECT-STATE-ARGS

Depends on:

Fixes:

What and why

CommandSignature stored only indirect kind and byte stride, dropping every argument descriptor (VERTEX_BUFFER_VIEW, INDEX_BUFFER_VIEW, root constants, descriptor views). ExecuteIndirect recorded minimal state and the Vulkan replay applied no argument bindings, so a signature like [VERTEX_BUFFER_VIEW, DRAW] drew with whatever vertex buffer was already bound. This stores argument types from CreateCommandSignature through ExecuteIndirect into the replay, which reads VERTEX_BUFFER_VIEW and INDEX_BUFFER_VIEW values from the argument buffer and binds the matching VkBuffer before the indirect draw.

Tested

Build check only — no GPU available for vkCmdDrawIndirect validation; host-parity validation cases in d3d12_execute_indirect_validation_test.cpp can be added for signatures with vertex/index buffer arguments.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly
  • 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 — n/a (D3D12 layer, not shader translator)
**@⁠BubsMcgee** on GitHub · 2026-11-25 06:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1620) `BubsMcgee:indirect-state-args` → `main` · +101 −8 · 5 files · 1 commits · closed without merging Claimed in the coordination issue as: INDIRECT-STATE-ARGS Depends on: Fixes: ### What and why CommandSignature stored only indirect kind and byte stride, dropping every argument descriptor (VERTEX_BUFFER_VIEW, INDEX_BUFFER_VIEW, root constants, descriptor views). ExecuteIndirect recorded minimal state and the Vulkan replay applied no argument bindings, so a signature like [VERTEX_BUFFER_VIEW, DRAW] drew with whatever vertex buffer was already bound. This stores argument types from CreateCommandSignature through ExecuteIndirect into the replay, which reads VERTEX_BUFFER_VIEW and INDEX_BUFFER_VIEW values from the argument buffer and binds the matching VkBuffer before the indirect draw. ### Tested Build check only — no GPU available for vkCmdDrawIndirect validation; host-parity validation cases in d3d12_execute_indirect_validation_test.cpp can be added for signatures with vertex/index buffer arguments. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current main and merges cleanly - [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 — n/a (D3D12 layer, not shader translator)
CreateCommandSignature previously validated every argument type but discarded all but kind and byte stride. CommandSignature stored only kind+stride, ExecuteIndirect recorded minimal state, and the Vulkan replay applied no argument bindings before indirect draws, so a signature like [VERTEX_BUFFER_VIEW, DRAW] drew with whatever vertex buffer happened to be bound.

- d3d12_com.h: create_command_signature / command_signature_info carry argument types and root signature
- d3d12_com.cpp: CommandSignature stores argument_types_ + root_signature_; ExecuteIndirect reads them into the command struct
- d3d12_vulkan_device.cpp: CreateCommandSignature collects argument types from desc->pArgumentDescs and passes them through
- command_list.h: ExecuteIndirect gains argument_types field
- vulkan_replay.h: replay walks argument types; VERTEX_BUFFER_VIEW (5) and INDEX_BUFFER_VIEW (6) are read from the argument buffer via host_at, resolved to VkBuffer via buffer_at, and bound with vkCmdBindVertexBuffers2 / vkCmdBindIndexBuffer before the indirect draw

No game data, no keys, no GPU required for the change itself.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:58:23 +00:00
github-bot closed this pull request 2026-11-26 09:58:23 +00:00
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-25 09:04 UTC · original

Heads-up before anyone tests this: the diff at 13774f4df doesn't contain what the title and description say.

  • None of the 5 changed files has anything about command signatures or indirect arguments. There is no VERTEX_BUFFER_VIEW, INDEX_BUFFER_VIEW, INDIRECT_ARGUMENT or CommandSignature in it.
  • What is there is stream-output code from #1630: SOSetTargets, StreamOutput PSO acceptance, the VK_EXT_transform_feedback paths and SO_STATISTICS queries. Its +/- lines are a subset of #1630's. The 5 files are the same as #1630's, but it lacks #1630's README, docs and test hunks, and its runtime/src/vulkan_backend.h hunks that load the transform-feedback entry points.

It looks like part of the stream-output work was pushed to indirect-state-args by mistake. The review of that code is on #1630.

**@⁠adrianmjim** on GitHub · 2026-11-25 09:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1620#issuecomment-7157845628) Heads-up before anyone tests this: the diff at `13774f4df` doesn't contain what the title and description say. - None of the 5 changed files has anything about command signatures or indirect arguments. There is no `VERTEX_BUFFER_VIEW`, `INDEX_BUFFER_VIEW`, `INDIRECT_ARGUMENT` or `CommandSignature` in it. - What is there is stream-output code from #1630: `SOSetTargets`, `StreamOutput` PSO acceptance, the `VK_EXT_transform_feedback` paths and `SO_STATISTICS` queries. Its +/- lines are a subset of #1630's. The 5 files are the same as #1630's, but it lacks #1630's README, docs and test hunks, and its `runtime/src/vulkan_backend.h` hunks that load the transform-feedback entry points. It looks like part of the stream-output work was pushed to `indirect-state-args` by mistake. The review of that code is on #1630.
Author
Owner

@⁠BubsMcgee on GitHub · 2026-11-25 10:32 UTC · original

Thanks @⁠adrianmjim — confirmed and fixed. The branch had accidentally picked up stream-output code, and the actual indirect-state-args work was sitting in a local stash. I force-updated indirect-state-args to the real change (fe916f5ed): CommandSignature now stores the argument types + root signature, ExecuteIndirect carries them into the command struct, and vulkan_replay.h binds VERTEX_BUFFER_VIEW/INDEX_BUFFER_VIEW from the argument buffer before the indirect draw. The diff now matches the title/description (5 files, +101/−8) and gta6rt_d3d12_com builds cleanly on current main. No GPU validation — build check only.

**@⁠BubsMcgee** on GitHub · 2026-11-25 10:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1620#issuecomment-7159846916) Thanks @⁠adrianmjim — confirmed and fixed. The branch had accidentally picked up stream-output code, and the actual indirect-state-args work was sitting in a local stash. I force-updated `indirect-state-args` to the real change (`fe916f5ed`): `CommandSignature` now stores the argument types + root signature, `ExecuteIndirect` carries them into the command struct, and `vulkan_replay.h` binds `VERTEX_BUFFER_VIEW`/`INDEX_BUFFER_VIEW` from the argument buffer before the indirect draw. The diff now matches the title/description (5 files, +101/−8) and `gta6rt_d3d12_com` builds cleanly on current `main`. No GPU validation — build check only.
Author
Owner

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

Closing as superseded. Main's ba626820e ("Integrate post-story-load memory, queue and Vulkan runtime changes") reworked the same files: CommandSignature now carries packed_size / terminal_only / graphics_writes, and ExecuteIndirect has the newer compute-replay path and defers compound draws via reset_indirect_graphics_bindings. This PR was written against the older argument_types / root_signature shape, so rebasing is a re-implementation rather than a conflict resolution, and a "keep ours" merge would regress main's indirect/compute paths.

The remaining work — replaying VERTEX_BUFFER_VIEW / INDEX_BUFFER_VIEW arguments from the argument buffer for compound indirect draws — is still unlanded and should be re-claimed against the current design. The branch is preserved at fe916f5ed for reference.

AI-assisted.

**@⁠BubsMcgee** on GitHub · 2026-11-25 12:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1620#issuecomment-7161889013) Closing as superseded. Main's `ba626820e` ("Integrate post-story-load memory, queue and Vulkan runtime changes") reworked the same files: `CommandSignature` now carries `packed_size` / `terminal_only` / `graphics_writes`, and `ExecuteIndirect` has the newer compute-replay path and defers compound draws via `reset_indirect_graphics_bindings`. This PR was written against the older `argument_types` / `root_signature` shape, so rebasing is a re-implementation rather than a conflict resolution, and a "keep ours" merge would regress main's indirect/compute paths. The remaining work — replaying `VERTEX_BUFFER_VIEW` / `INDEX_BUFFER_VIEW` arguments from the argument buffer for compound indirect draws — is still unlanded and should be re-claimed against the current design. The branch is preserved at `fe916f5ed` for reference. AI-assisted.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.