OLD-8904: restore old upstream PR 8904 - root_signature: accept root constants of 0 values, as the host does (D3D-942) #657
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!657
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/657/head"
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?
@aslan2142 on GitHub · 2026-11-24 11:07 UTC · original
aslan2142:root-constants-zero→main· +94 −17 · 5 files · 4 commits · merged 2026-11-25 22:57 UTCClaimed in the coordination issue as: OLD-8904 #14
Restoration of my original pull request, old upstream PR 8904 in
ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at21625bca8c; no changes beyond the rebase.Depends on: #420 (adjacent-line conflict in pack_stage(); either order resolves easily)
What and why
pack()andpack_stage()inruntime/src/root_signature.cpprefused a 32-bit-constants parameter withNum32BitValues == 0. SoCreateRootSignaturefailed where host D3D12 answersS_OK. The serializer warns for versions 1.0 and 1.1, and both devices still create the root signature.pack()it gets no provenance entry.pack_stage()it shares its first SGPR with the next parameter, so no other offset changes.ShaderUserDatablock, not one range per parameter. The command list already refuses any write past a parameter's constant count.root_signature_test(both packers):Tested
Built and run on Linux. The Windows build used clang targeting x86_64-w64-mingw32 and ran under Wine 11.22. The same files were also built natively for Linux with clang. MSVC (
/W4 /permissive-) is left to CI.root_signature_testonmainunchanged: 56 pass, 0 fail.main's code: 58 pass, 8 fail (the 8 zero-value cases).git diff --checkandscripts/check_no_game_data.pyon the changed files: clean.GPUs tested: n/a (the test needs no GPU)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)AI-assisted (Claude Code, Claude Opus 5.5).
tools/root_sig_contract.py says its packing mirrors runtime/src/root_signature.{h,cpp}, but it still refused a constant parameter with count 0, so after this branch it rejected a signature the runtime accepts. Accept count >= 0; a zero count adds no dwords and its neighbours pack as if it were absent, in both the s0 and the console layout. Raised in review. Co-Authored-By: Claude Opus 5.5 <[email protected]>@PierreEbele on GitHub · 2026-11-25 01:15 UTC · original
Reviewed
a634430f. I built and ran the realroot_signature_test(CMake + Ninja, g++, Release, Linux arm64 sandbox):pack_stage: zero-value constants accepted). The new tests exercise the fix.The branch also merges cleanly into current main (
b4b7756e).I read the diff and the main consumer path (
CreateRootSignature->RootArgumentLayout-> the root-constant writes). A 0-value constant parameter keepsconstant_count0. The bounds check refuses any nonzero write to it, so the SGPR it shares with the next parameter is never written through it.One consistency note, not blocking:
tools/root_sig_contract.py:23says its packing "mirrors runtime/src/root_signature.{h,cpp}". It still refuses constants with count 0 (:70, "constants need an integer count >= 1"), so after this PR it rejects a signature the runtime accepts. This could be a small follow-up. I could not check the host claim (serializer warns,CreateRootSignaturereturns S_OK) here.AI-assisted review.
Recommendation: Merge
@aslan2142 on GitHub · 2026-11-25 22:57 UTC · original
Merged:
root_signatureaccepts root constants of 0 values, as the host does (D3D-942).mainmerged in.pack_stageonmainnow spills trailing compute parameters behinds[0:1]and refuses unknown parameter types. Both are kept, and only the zero-value refusal goes. A zero-value constant takes no SGPRs and no spill dwords, and a new case checks the spill offsets around one. The 64-constant check now expects compute to spill them whole, and a pixel shader to refuse them as a spill.tools/root_sig_contract.pyrefusedcount0, so it rejected signatures the runtime accepts. It now takescount >= 0, and a new test covers it (244e89f39).main5fab93967with all nine of these runtime PRs merged together (#634, #643, #684, #657, #677, #638, #710, #688, #671), on llvmpipe and the gfx1036 iGPU (RADV): no test went from pass to fail.root_signaturepasses on both.root_signature_testalso passes natively on Linux (g++), andtest_root_sig_contracthas 59 passing tests.maind34c426ef+48245b436: it merges cleanly; the semantic suite passes (493 files, 6,318 tests, 0 files failed); the 15 docs and writer tests pass;check_no_game_data.pyis clean on the 5 changed files.AI-assisted (Claude Code, Claude Opus 5.5).
latencyframes in flight while armed (mailbox replace) #671