GPU: support multi-argument ExecuteIndirect signatures with root constants #956
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!956
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-956"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@MartinIndra02 on GitHub · 2026-11-24 14:27 UTC · original
MartinIndra02:feat/gpu-multi-arg-execute-indirect→main· +673 −28 · 4 files · 2 commits · openCloses #757
Summary
Adds support for multi-argument
ExecuteIndirectcommand signatures that combine 32-bit root-constant arguments (D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT) with a draw/dispatch/mesh argument:crates/victory-gpu/src/indirect.rs:signatureparsing (Signature::ConstantPrefixed) to handle command signatures with one or more leadingCONSTANTarguments followed by a draw/draw-indexed/dispatch/dispatch-mesh terminal argument.ID3D12CommandSignatureremapping guest root-constant slots/dwords to the host pipeline's translateduser_dataroot constants, and clamps argument counts (arg_offset/ stride-aware) before executing.ExecuteIndirectwith root constants on hardware and WARP.crates/victory-gpu/src/draw.rs&pipeline/host.rs&list.rs:list.rs->State::execute_indirect.State::clear_indirect_constants(per native D3D12 state-leakage feedback from@andrewpozdnakov7-jpgand@fuzeofficlal) to zero only the overwritten guest root-constant dwords afterExecuteIndirect, preserving neighboring dwords and the other pipeline's roots, with regression testdraw::tests::indirect_constants_clear_only_overwritten_guest_range.Verification (Windows 11, RTX 3080
621.24, WARP, Rust1.98.1)cargo test -p victory-gpu --lib -- --test-threads=1: 53 passed, 0 failed, 1 ignoredcargo clippy -p victory-gpu --all-targets -- -D warnings(default +--features diagnostics): 0 warningscargo xtask policy: 154 files okNo game data used. AI-assisted; all builds and GPU tests executed on my machine.
@MichaelSmithAI on GitHub · 2026-11-24 14:45 UTC · original
A guest command-list readback on RTX 4090 under Wine/vkd3d-proton 3.2 checked what the next direct dispatch actually sees. A constant-prefixed indirect dispatch replaced two adjacent compute root dwords (pixel index and value) and wrote
[53, 29, 1, 255]to pixel 1. The following direct dispatch wrote[0, 29, 0, 255]to pixel 0. Both overwritten dwords were zero and the neighboring dword retained 29.With only the guest-state reset removed, the direct dispatch reused the earlier index 1 and value 19. Pixel 1 then contained
[19, 29, 1, 255]and pixel 0 kept its seeded value. This checks one contiguous compute mapping in a single stage. Multi-stage mappings and title signatures remain unmeasured.@shortselow-byte on GitHub · 2026-11-24 15:22 UTC · original
Tested at head
db86e1e(onmainffe310e) on AMD, since the runs above are NVIDIA (native and vkd3d-proton): Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT (RDNA2, driver 32.0.21045.16010).multi_argument_indirect_dispatch_sets_root_constants_and_clamps: passed on the AMD device (default adapter, checked with a temporary print) and on WARP (--features diagnostics,VICTORY_D3D12_WARP=1). So AMD's driver passes each record's root constants throughExecuteIndirectand the over-limit record is clamped to zero groups (got = [0x11223344, 0, 0xCAFEBABE]).plan_indirect_maps_root_constants_and_rejects_unsupported,indirect_constants_clear_only_overwritten_guest_range) pass too.cargo test --locked -p victory-gpu --lib -- --test-threads=1: 53 passed on AMD, 56 on WARP withdiagnostics. Whole workspace: 345 passed, 0 failed.cargo clippy --workspace --all-targets --locked -- -D warnings, and with--all-features: clean.Not covered: no D3D12 debug layer on this machine, and no in-title run.
@Zipettte on GitHub · 2026-11-24 15:40 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
db86e1e:cargo test -p victory-gpupasses, 53 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@Marvisak on GitHub · 2026-11-25 00:29 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-gpu/src/draw.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 09:36 UTC · original
I rebased
db86e1e387onto current main940d32f69b. The fork branch contains 8c89464 and 3003511, both with MartinIndra02's Git authorship. The second retains the original co-author trailer.On WARP, a local guest shader ran through State::execute_indirect and then a normal direct dispatch in the same list. The indirect dispatch wrote [1, 0.25, 0.75, 2] to the output texture in both controls. Without the guest-side clear call, the direct dispatch read back [1, 0.5, -0.25, 2]. With the clear, it read back [1, 0, 0, 2], preserving both neighboring dwords. All eight indirect-related tests and the full GPU suite passed (149 passed, 2 ignored). Strict Clippy with and without diagnostics and the repository policy check passed.
If you reuse the rebased patch or its test coverage, please preserve the existing Git authorship and keep this trailer on the clearing change if it is folded into another commit:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted. Synthetic tests only.
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 17:28 UTC · original
I refreshed the rebase of
db86e1e387on main13f91caee2. The current clamp writes the list's own argument buffer. The rebased shader copies the constant prefix into that buffer and clamps the draw or dispatch at its offset. Diagnostics read the clamped records. Both commits retain MartinIndra02 as Git author. Fork branch · 32385fc · b0e185aIn six paired WARP runs the same synthetic indirect dispatch wrote [1, 0.25, 0.75, 2] and left its input arguments intact. A following direct dispatch read [1, 0.5, -0.25, 2] with the guest constant clear disabled and [1, 0, 0, 2] with the clear. The included multi-record clamp test also passed. Serial victory-gpu passed with 201 passed and 1 ignored in both D3D12 debug flag settings. Strict GPU Clippy and repository policy passed.
The second commit retains the original trailer. Please keep it if you squash or otherwise fold the change into a new commit.
Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted. Synthetic data only.
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 01:13 UTC · original
I refreshed the #956 rebase on
63bcca43c6a00a758510398fa43096ce7e4f7df0. 8ac1ec7 carries the multi-argument signature support. abad7ee carries the post-indirect constant clear and its test. Both retain MartinIndra02 as Git author. The new main's placed-UAV tests and the original indirect regression coexist after resolving the test insertion conflict. Fork branch.With the same synthetic WARP readback, the support-only commit leaves the later direct dispatch at
[1, 0.5, -0.25, 2]. The two-commit branch returns[1, 0, 0, 2]. Indirect readback is[1, 0.25, 0.75, 2]on both, and both keep the original arguments. Six paired runs passed their expected comparison. The full GPU suite passed with 249 tests and one ignored with each D3D12 debug setting, including all eight indirect tests. Strict GPU Clippy and asset policy passed.Please preserve both Git authors when replaying the commits and retain the existing
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>on the constant-clear change.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.