Commit Graph

4 Commits

Author SHA1 Message Date
62137d42f8 tools: fssm_root_layout reads each program's root-layout and used-resource tables, with a census (FSSM-ROOT-LAYOUT-TABLES)
docs/d3d12_vulkan.md section 3.5 infers where root arguments arrive from the user SGPRs the shaders read and calls
the graphics bases (s8 for VS/PS/GS, s16 for mesh) a hypothesis: the SGPR census cannot see root-parameter indices
or a spill. Each native program's FSSM record names two tables that state it directly: a root-layout table (root
type, user-data dwords, first user-data dword and root parameter index per parameter) and a used-resource table.
The record layout is the one VIctory reads (Marvisak/VIctory, GPL-3.0, crates/victory-shader/src/native.rs). The
parser is written for this repository from that layout and contains no VIctory code.

tools/fssm_root_layout.py is a new module on its own. root_tables(fssm) returns the programs of one blob with both
tables. It raises FssmLayoutError (a ValueError) for a header that is not version 0x101 with a matching payload
size, a record or code range outside the payload, records that overlap each other or the slot table, and a table
that runs past the payload or overlaps a record, its program's code or the program's other table. Unnamed types
and non-zero reserved fields are kept so they can be counted. Its command line prints the tables of a file or a
folder as JSON, or writes them with --out, one file in memory at a time.

tools/root_layout_census.py reads the user's own .fssm blobs or carved containers and prints counts per hardware
stage: the lowest SGPR a parameter arrives in, the dwords each root type takes, root types and used-resource kinds,
compute programs with a spilled parameter and the first spilled dword, and how many programs agree with the
section 3.5 hypothesis, with the reasons for the rest. It also counts what would show the reading to be wrong
(unread blobs by reason, record offsets, reserved fields, unnamed types). With no input it says so.

No retranslation: tools/fssm_unpack.py and every other file in make_game's TRANSLATION_SOURCES are untouched, and
neither new file is imported by the translator or make_game.py, so a translated shader library stays valid. A
test holds the two new names out of make_game.py, translator_deps.cmake, fssm_unpack.py, rdna2spirv.py and
shader_meta.py.

Nothing here was run on real shader data. Which fields are VIctory's reading and which this corpus's earlier
measurements already support (the two table offsets are the header's `code_end` and `meta_ptr`) is in section 3.5,
with the commands and the open questions. The runtime does not use the tables yet.

Tested: tests/test_fssm_root_layout.py (32 tests: hand-built records with constants, a root descriptor, tables, an
immediate sampler, a heap and a spilled compute layout; truncated, overlapping and overflowing tables; every
prefix and 4,000 seeded corruptions of a three-program blob; both command lines) and the fssm_unpack, pal_stages,
fssm_header, fssm_crosscheck, missing-input, line-ending and CI-registration tests pass. The repository-consistency
set gives 578 passed, 5 skipped. No game files.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
2026-11-24 19:18:20 -05:00
22037f702e tools: missing inputs are one ERROR line and exit 2 in five more tools (#6701)
Squash-merged after diff review of PR #6701
2026-11-23 10:54:49 -06:00
fdd51c0656 gamedata_sps1: a missing input path is a usage error (exit 2), not a failed run (EGEN-GAMEDATA-SPS1-MISSING) (#6346)
Squash-merged after review of PR #6346 - gamedata_sps1: a missing input path is a usage error (exit 2), not a failed run (EGEN-GAMEDATA-SPS1-MISSING)
2026-11-23 08:06:25 -06:00
d1490e359e BUILD-1046: missing inputs exit 2; image_query_probe help before oracle
Eleven tools treated a nonexistent input folder as a failed run (1). They now print one ERROR line and return 2, while real read failures keep exit 1. image_query_probe imports the hardware oracle only for a GPU run, so --help stays prompt. A table-driven subprocess test covers all eleven; existing expectations are updated.
2026-11-22 21:11:07 +00:00