GPU: validate ByteStride alignment and root signature in signature::create #3315
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by mgunes1311-lab on 2026-11-26T17:18:11Z.
Coordination
Claimed in https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7197202703 (
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.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T17:28:37Z.
Review: APPROVED
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).
Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T22:34:22Z.
Windows 11,
63bcca4+ this PR:signature::tests::misaligned_strides_and_rootless_binding_arguments_are_rejected_and_clear_outandsignature::tests::host_device_agrees_on_stride_alignment_and_root_requirementby name: 2 passed.cargo test -p victory-gpu --lib: 233 passed / 0 failed / 1 ignored (unpatched63bcca4here: 231).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.The second test asks the real device, so it is exercising this card's own
CreateRootSignature/alignment answer rather than only our copy of the rule. Synthetic only. AI-assisted.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.