GPU: validate ByteStride alignment and root signature in signature::create #3315
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!3315
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3315"
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?
@mgunes1311-lab on GitHub · 2026-11-26 17:18 UTC · original
mgunes1311-lab:gpu-command-signature-validation→main· +170 −2 · 1 files · 1 commits · openCoordination
Claimed in #1633 (
GPU: validate 4-byte ByteStride alignment and required root signature for binding arguments in signature::create). CheckedSTATUS.md,CLAIMS.md, andforge/main— zero overlapping PRs or diff incrates/victory-gpu/src/signature.rs.Problem
Per Microsoft's
D3D12_COMMAND_SIGNATURE_DESCandID3D12Device::CreateCommandSignaturespecification:ByteStridemust be a multiple of 4 bytes (E_INVALIDARGotherwise).pRootSignatureis required whenever anyD3D12_INDIRECT_ARGUMENT_DESCupdates root bindings (CONSTANT = 5,CONSTANT_BUFFER_VIEW = 6,SHADER_RESOURCE_VIEW = 7,UNORDERED_ACCESS_VIEW = 8,INCREMENTING_CONSTANT = 11), and optional only for non-binding arguments (DRAW,DRAW_INDEXED,DISPATCH,VERTEX_BUFFER_VIEW,INDEX_BUFFER_VIEW,DISPATCH_RAYS,DISPATCH_MESH).E_INVALIDARGpaths did not clear a non-null_COM_Outptr_opt_ppvCommandSignatureslot.signature::createaccepted unalignedByteStridevalues and rootless binding signatures, deferring failure or silently misinterpreting indirect argument buffers at execution time.Fix
!desc.stride.is_multiple_of(4)withE_INVALIDARGinsignature::create.root.is_null()when any indirect argument has type5..=8 | 11(binds_root) withE_INVALIDARG.*out = nullon all earlyE_INVALIDARGreturns whenoutis non-null.Verification
signature::tests::misaligned_strides_and_rootless_binding_arguments_are_rejected_and_clear_outcovering unaligned strides, all five root-binding argument types with and without a root signature, all non-binding argument types with a null root signature, and_COM_Outptr_opt_clearing on early failure.signature::tests::host_device_agrees_on_stride_alignment_and_root_requirementverifying live D3D12ID3D12Device::CreateCommandSignaturereturnsE_INVALIDARGon both cases.cargo test -p victory-gpu --locked signature::tests::(7/7 passed),cargo clippy --workspace --all-targets --all-features --locked -- -D warnings, andcargo xtask policyon Windows 11 (x86_64-pc-windows-msvc).AI-assisted contribution (Google Antigravity); all code, D3D12 validation, and tests were locally executed and verified.
@Dukestar69 on GitHub · 2026-11-26 17:28 UTC · original · approved these changes
Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090):
ByteStrideand root-binding indirect arguments (CONSTANT/CBV/SRV/UAV/INCREMENTING_CONSTANT) without a root signature while clearing non-null_COM_Outptr_opt_slots onE_INVALIDARGmatches native D3D12 behavior.cargo test -p victory-gpu --lib signature:: -- --test-threads=1(RTX 5090): 7 passed, 0 failed (includinghost_device_agrees_on_stride_alignment_and_root_requirementandmisaligned_strides_and_rootless_binding_arguments_are_rejected_and_clear_out).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.