Commit Graph

19 Commits

Author SHA1 Message Date
0d4c33c0a1 Merge pull request #1606 from IlyassRS3/fix/root-sig-contract-console-and-validation
root_sig_contract: reject unpaired ptr64_lo on 1-dword tables and harden console/input validation (ROOT-SIG-CONTRACT-CONSOLE-AND-VALIDATION)
2026-11-28 11:35:37 +01:00
244e89f39c root_sig_contract: accept root constants of 0 values, as the runtime 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>
2026-11-25 16:40:50 -05:00
4cfb7c7af7 root_sig_contract: reject unpaired ptr64_lo on 1-dword tables and harden console/input validation 2026-11-25 06:45:53 +01:00
a63d4bbd79 root_sig_contract: handle deeply nested JSON, spurious ptr64_hi error, and bad pack_layout shapes 2026-11-24 09:44:00 +01:00
6b421e6b02 root_sig_contract: verify the source pair of a 64-bit address (#6769)
Squash-merged after diff review of PR #6769
2026-11-23 10:45:37 -06:00
f54c6395ed Merge pull request #4312 from Victor Garcia
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-22 23:13:27 -05:00
7c2252609d D3D-448: console root-argument layout, measured for compute and used there
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>
2026-11-23 01:44:40 +01:00
58a74d4bbf Stabilize root-signature cluster ordering and examples 2026-11-22 23:47:19 +01:00
17aef14d53 Merge pull request #2248 from Vonsek 2026-11-22 11:43:23 -05:00
7474385c59 fix(rootsig): require the low slot for 32-bit pointer reads
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.
2026-11-22 17:29:11 +01:00
95345d8310 root_sig_contract: reject boolean root-constant counts 2026-11-22 18:04:47 +02:00
826e2747ab Merge pull request #427 from Italo Felipe 2026-11-22 08:07:58 -05:00
3727ec726d fix(tools): reject noninteger SGPR indices in reconciliation and clustering 2026-11-22 10:04:25 -03:00
6cf95d1d92 fix(tools): reject negative SGPR indices in root signature checks 2026-11-22 10:01:09 -03:00
a6a3bc1348 root_sig_contract.py: check the slot for a low address read 2026-11-22 13:07:11 +01:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").

tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:27:00 +00:00
b7e2998072 BUILD: reject nested malformed root-signature JSON shapes 2026-11-22 02:07:39 -06:00
fee3f1e308 BUILD: validate root signature tool JSON inputs 2026-11-22 00:51:47 -06:00
612f1edebd Root signature packer + reconciler + hard-fail (fix the least verifiable part of the layer)
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.
2026-11-21 17:04:28 -03:00