Skip to content

PROC-261: docs/gbuffer.md: FSSM +0x0FC is a binding-table group count, not a target count (whole corpus) - #5215

Open
throny wants to merge 2 commits into
ItsNotRexed:mainfrom
throny:doc-fssm-0xfc-binding-split
Open

throny wants to merge 2 commits into
ItsNotRexed:mainfrom
throny:doc-fssm-0xfc-binding-split

Conversation

@throny

@throny throny commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

PROC-261. Claim: #5156 (comment)
Pairs with #5169 (which removes the older line 14 that called +0x0FC "the exported target count"); this PR touches only the note at lines 46-48, which #5169 keeps unchanged, so the two apply in either order.

What the doc said

docs/gbuffer.md:46-48: the FSSM header dword at +0x0FC holds 5 and 6 on two sampled PS_DeferredTextured blobs but 16 and 18 on two vehicle deferred passes, so target counts must be read from OSG1. Four blobs, no statement of what +0x0FC is.

What was measured (all 26,503 FSSM blobs of 1.0.2.1)

  • u32 +0x0F8 + u32 +0x0FC equals the number of 20-byte records in the post-code binding table (fssm_header.binding_table()) in 26,503/26,503 blobs, in every stage. +0x0FC is 2 in all 195 GS; in PS it spans 0..84.
  • +0x0FC equals the OSG1 SV_Target count in 229 of 12,101 pixel shaders, 40 of 3,004 *Deferred* PS, 19 of 807 PS_DeferredTextured (5..21 on the six-target ones, 3..20 on the five-target ones). So it is not a target count; the doc's conclusion (read OSG1) stands and now has its reason.
  • The two groups differ in shape: in the first (5,195,311 records) word 2 is 0 or 1; in the second (445,393) word 2 is 0 or a multiple of 16 and ascends through the group in 15,967 blobs. What the groups mean is not known and the doc does not claim it.

Method and limits

  • Blobs enumerated with os.listdir (26,503, matches index.json; 769 names start with .), .dxbc paired by stem (0 missing), OSG1 parsed as 32-byte elements, SV_Target counted by semantic name. 0 unparsed OSG1.
  • The record-count identity is reproducible with the repository tool; the per-PS OSG1 comparison was a local script over the same files (counts only, not committed).

Changes

  • docs/gbuffer.md: the note at 46-48 rewritten with the counts and the command.
  • tools/fssm_header.py: binding_table() returns groups (the 0xF8/0xFC pair, None if the blob ends before 0x100); --bindings prints them per file and tallies u32 0xF8 + u32 0xFC equals the record count in N/M. Docstring updated.
  • tests/test_fssm_header.py: three tests on synthetic blobs: a genuine split, a lookalike whose header words do not add up (reported as stored, not derived), and a blob ending before 0x100.

Run

  • python -I tools/fssm_header.py <work>/shaders/dxbc/fssm --bindings → binding tables 26503, records 5640704, tail name equals file stem 691 / u32 0xF8 + u32 0xFC equals the record count in 26503/26503
  • python -m compileall -q make_game.py tools tests; tests/test_fssm_header.py (45 OK), test_fssm_crosscheck.py, test_fssm_wave_size.py, all tests/test_docs_*.py, tests/test_text_write_line_endings.py, scripts/check_no_game_data.py: all pass.

AI-assisted (Claude Code). No GPU needed. Counts only; no shader names or content.

🤖 Generated with Claude Code

…rget count (whole corpus)

u32 +0x0F8 plus u32 +0x0FC equals the binding-table record count in all
26,503 FSSM blobs; +0x0FC equals the OSG1 SV_Target count in only 229 of
12,101 pixel shaders. fssm_header.binding_table() returns the pair as
'groups' and --bindings tallies the identity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at 8d0729b24 on Windows 11: pytest tests/test_fssm_header.py -q -> 45 passed, 6 subtests passed; test_docs_table_rows.py 2 OK; git diff --check clean.

fssm_header now reads FSSM +0x0FC as a binding-table group count, not a target count, over the whole corpus; the docs row was corrected with the count and the added cases cover the group-count field next to the old misuse. I cannot recount the corpus here; the synthetic test and docs validate. No blocking issue.

@soldsawn

Copy link
Copy Markdown

Independent Windows 11 CPU + 1.0.2.1 whole-corpus verification at exact head \8d0729b248b967cfa7b0a85f4e7bde2473beb7eb\ (Python 3.14; claim: #5156 (comment)):

  • \python -m compileall -q tools/fssm_header.py tests/test_fssm_header.py: pass.
  • \python -I tests/test_fssm_header.py -v: 45/45 tests passed.
  • \python -I tests/test_fssm_crosscheck.py: 6/6 tests passed.
  • \python -I tests/test_fssm_wave_size.py: 7/7 tests passed.
  • Whole-corpus \python -I tools/fssm_header.py /shaders/dxbc/fssm --bindings\ (counts only, no game data):
    • \26503 files, directory_ok 25643, PS with table 10307, entries 55791\
    • \wave sizes: wave32:2662, wave64:23841\

    • ead methods: interp:51191, mov:4600\
    • \�inding tables 26503, records 5640704, tail name equals file stem 691\
    • \u32 0xF8 + u32 0xFC equals the record count in 26503/26503\

AI-assisted.

@Atomic258

Copy link
Copy Markdown
Contributor

Independent check — PASS: test_fssm_header.py 45/45 at head. Negative control (parent fssm_header.py): 3 errors — the +0x0FC binding-table-group-count interpretation is new. Whole-corpus doc claim consistent with the carve (26,503 shaders). AI-assisted (Devin); no game files.

@Atomic258

Copy link
Copy Markdown
Contributor

Tested 8d0729b on Windows Server 2022, CPython 3.13.12: pass

  • python -I tests/test_fssm_header.py -> Ran 45 tests, OK
  • Negative control (tools/fssm_header.py swapped to upstream/main): FAILED (errors=3)

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

@kacper-serewis kacper-serewis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted review. Across 12,101 cached pixel shaders at 8d0729b, +0xFC equaled the number of distinct observed color destinations in only 229. The 16,306 static color exports (all compr) belong to the 3,004 shaders whose carved stems contain case-sensitive Deferred. All pixel shaders together have 29,290, and the 807 PS_DeferredTextured shaders have 4,294. Please label the 16,306 cohort explicitly when combining with #5169; a case-insensitive name filter gave 3,014 shaders, so the 2,989 raw-entry cohort needs its own predicate. OSG1 describes declared targets, while static instructions establish observed destinations.

@throny

throny commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @kacper-serewis. Your 229 matches mine. The 16,306-export sentence and the 2,989 / 3,004 cohorts are in section 1, which this diff does not touch (it changes only the +0x0FC note), so I have filed the cohort labelling as a finding on #7049 rather than widening this PR. AI-assisted.

16,306 is the 3,004 PS whose .dxbc stem contains case-sensitive
'Deferred'; a case-insensitive match gives 3,014 / 16,358. All 29,290
exports of all 12,101 PS are compr. Review on ItsNotRexed#5215.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@throny

throny commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Reproduced on my 1.0.2.1 work folder, and the wording is fixed in d3813da. Counts:

  • exp mrtN: 16,306 of 16,306 compr in the 3,004 PS whose .dxbc stem contains case-sensitive Deferred.
  • A case-insensitive match gives 3,014 PS and 16,358 exports, all compr.
  • All 12,101 PS have 29,290 exports, all compr. The 807 PS_DeferredTextured have 4,294.
  • +0x0FC equals the number of distinct exp mrtN destinations in 229 of 12,101 PS, the same as your count.

The section-1 sentence now names its cohort (stem, case-sensitive), gives the case-insensitive and all-PS figures, and says these are static instructions (observed destinations) while OSG1 gives declared targets. The +0x0FC note labels the 3,004 the same way. The 2,989 raw-entry cohort keeps its own predicate in the existing text (case-insensitive on raw RPF entry names). test_docs_*, test_text_write_line_endings, test_fssm_header and check_no_game_data pass. AI-assisted.

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested d3813dad merged onto main 511e3826 on Windows 11, CPython 3.14.3, CPU only: pass.

  • python -I tests/test_fssm_header.py: 45 tests OK.
  • Negative control (tools/fssm_header.py from main, the PR's tests kept): tests/test_fssm_header.py 45 tests FAILED (errors=3).
  • py_compile on the 2 changed Python files: OK; git diff --check: clean.

No game files. AI-assisted (Claude Code).

@claudetools-gh

Copy link
Copy Markdown

Tested d3813da merged onto main@0656b0b20 on Windows 11, CPython 3.13 (CPU only), with my own 1.0.2.1 copy: pass.

  • python -I tests/test_fssm_header.py: OK.
  • python -I tools/fssm_header.py <work>/shaders/dxbc/fssm --bindings on a make_game.py shaders-stage work folder (llvm-mc 21.1.8, Windows). It gives the same totals as the PR body:
    • binding tables 26503, records 5640704, tail name equals file stem 691
    • u32 0xF8 + u32 0xFC equals the record count in 26503/26503
  • Not reproduced: the per-PS OSG1 SV_Target comparison, which is a local script that is not in the PR.

Counts only. AI-assisted (Claude Code).

@Jess-Doit

Copy link
Copy Markdown
Contributor

Tested d3813dad against my own 1.0.2.1 copy (Windows 10, Python 3.12; shaders carved and unpacked by make_game.py --stages shaders at main 1cc6e3c1): pass, and both counts reproduce independently. Counts only.

  • This head's tool: tools/fssm_header.py <work>/shaders/dxbc/fssm --bindings gives binding tables 26503, records 5640704, tail name equals file stem 691 and u32 0xF8 + u32 0xFC equals the record count in 26503/26503, the same as your run. 5,640,704 is also your two groups' sum (5,195,311 + 445,393).

  • Tests: tests/test_fssm_header.py OK.

  • The SV_Target comparison, with my own script (not this PR's code): each PS's .dxbc OSG1 read as 32-byte elements, counting SV_Target by semantic name, against FSSM u32 +0x0FC.

    • 229 of 12,101 PS match, and 40 of 3,004 *Deferred* PS.
    • 0 PS lacked OSG1 or an FSSM blob.

    These are the same numbers as yours, so "not a target count, read OSG1" holds on a second copy.

AI-assisted (Claude Code). No game data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants