Repository navigation
OLD-8904: restore old upstream PR 8904 - root_signature: accept root constants of 0 values, as the host does (D3D-942) - #657
Conversation
…D3D-942) pack() and pack_stage() refused a 32-bit-constants parameter with Num32BitValues == 0, so CreateRootSignature failed where host D3D12 answers S_OK (the serializer warns for versions 1.0 and 1.1; both devices create it). Such a parameter now takes no dwords and no cost: it gets no provenance entry in pack(), and in pack_stage() it shares its first SGPR with the next parameter, so every other offset is unchanged. The Vulkan push-constant range is the fixed ShaderUserData block, not per parameter, so no zero-size range is created; the command list already refuses any write past a parameter's constant count. 65 constants stay refused by the 64-dword cost limit. root_signature_test: zero-value constants alone, between other parameters and from a hand-built RTS0 blob (both packers); 64 constants pass the cost limit and are refused only as a spill; 65 by the cost limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed a634430. I built and ran the real
The branch also merges cleanly into current main (b4b7756). I read the diff and the main consumer path ( One consistency note, not blocking: AI-assisted review. Recommendation: Merge |
main's pack_stage now spills trailing compute parameters into the array behind s[0:1] and refuses an unknown parameter type. Keep both; drop only the zero-value constant refusal, as this branch does. A zero-value constant takes no SGPRs and no spill dwords, and a new case checks the spill offsets around one. The old "32-SGPR budget refuses before the cost limit" comment no longer holds with spilling and goes; main's over-cost case replaces it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…packer does
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 <noreply@anthropic.com>
… a spill for pixel This branch's check expected pack_stage(Compute) to refuse 64 constants as an unmodelled spill. main's pack_stage now spills trailing compute parameters behind s[0:1], so compute takes them (cost 64, one spilled parameter of 64 dwords). The "refused only as a spill, not for cost" check moves to a pixel shader, where a spill is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged:
AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as: OLD-8904 #14 (comment)
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 at 21625bc; 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).