Skip to content

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

Closed
BubsMcgee wants to merge 1 commit into
ProjectLeonida:mainfrom
BubsMcgee:indirect-state-args
Closed

BubsMcgee wants to merge 1 commit into
ProjectLeonida:mainfrom
BubsMcgee:indirect-state-args

Conversation

@BubsMcgee

Copy link
Copy Markdown
Contributor

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)

@adrianmjim

Copy link
Copy Markdown

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

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.

…/INDEX_BUFFER_VIEW state

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.
@BubsMcgee

Copy link
Copy Markdown
Contributor Author

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 BubsMcgee closed this Nov 25, 2026
@BubsMcgee

Copy link
Copy Markdown
Contributor Author

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.

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.

2 participants