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>
rt::rootsig::pack_stage() lays a root signature out for one stage the
way the console compiler does: root order from the stage base, a table
one dword (its 32-bit VA), a root view two, constants one per value,
and the first parameter that does not fit refused (the spill array
behind s[0:1] is not modelled).
Compute (base s4) is measured: on the package's FidelityFX DLL, whose 29
compute containers carry their RTS0 next to the console-compiled program,
base plus span equals RSRC2 USER_SGPR in 29 of 29, and
root_sig_contract.py --model console finds all 20 translated programs
compatible (the s0 model contradicts 7). VS/PS/GS s8 and MS s16 stay a
census hypothesis.
The compute bind point now uses this layout; graphics keeps pack(),
since every stage reads one push-constant block and a mesh shader (s16)
and a pixel shader (s8) would collide. A signature carries both
layouts; binding it where its layout refused it invalidates the list.
Test fixtures follow: the compute GLSL shaders read the new places, and
the asm fixtures a D3D12 compute PSO runs are built with
LEONIDA_USER_DATA_SHIFT=4 (compute_fixture.py shifts every SGPR and the
RSRC2 user count), so the standalone harness keeps using them at s0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The verifier already enforces the slot for a 64-bit low-word read. Apply the same rule when the pointer is zero-extended from 32 bits so a high-word read is flagged.
AI-assisted (Muse Spark + explorer fleet).
Implements docs/d3d12_vulkan.md section 3.5 as code: a portable D3D12
root-signature model (1.0/1.1, no d3d12.h) plus a packer that lays root
parameters into the 32 user-SGPR dwords in root-parameter order (constants
take N, views/tables take 2, static samplers take none). Anything that does
not fit - more than 32 user SGPRs (spill layout unknown) or more than the
64-dword D3D12 cost limit - is refused loudly instead of truncated.
tools/root_sig_contract.py reconciles a candidate signature against every
shader's user_sgpr_reads from spirv/index.json (const32 vs constant dwords,
64-bit VAs vs view/table pairs, unpaired-hi detection) and exits nonzero on
the first contradiction; --cluster shows which read-set shapes the game
actually needs.
The RTS0 chunk reader is marked hypothesis until the new Windows oracle
test (synthetic descs serialized by the real d3d12.dll) confirms the layout;
Tier A (model/packer/canonical codec/RTS0 self-consistency/reconciler) runs
everywhere with no game data and no GPU.
Tested: python -m pytest tests/test_root_sig_contract.py (12 passed);
full suite 651 passed, 20 skipped, 1 xfailed; compileall + make_game --help;
portable C++ test 17/17 PASS under g++ -Wall -Wextra -Wpedantic -Werror with
ASan+UBSan; turing atlas on RTX 2060 SUPER (subgroup 32, mesh/bary/m8/heap
true): compute32/ballot64/f16_input/maintenance8 valid, broken_negative
correctly invalid. Windows-only Tier B (oracle + MSVC build) runs in CI.