Skip to content

Add a reproducible G-buffer cohort census CLI - #5657

Open
kacper-serewis wants to merge 1 commit into
ItsNotRexed:mainfrom
kacper-serewis:feat/gbuffer-census-cli
Open

kacper-serewis wants to merge 1 commit into
ItsNotRexed:mainfrom
kacper-serewis:feat/gbuffer-census-cli

Conversation

@kacper-serewis

@kacper-serewis kacper-serewis commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Tracker item BUILD-1829. Claim receipt, first implementation item. Related documentation PR #5350.

Run python -I tools/gbuffer_census.py <dxbc> [--disasm <listing-directory>] to print aggregate JSON for indexed pixel shaders. Each cohort names its predicate. The report counts OSG1 rows, colour and depth declarations, detailed layouts and observed static compressed/uncompressed exports per MRT. Observations include readable instructions in partial listings. Coverage counters track the independent signature and listing denominators.

Validated on Windows, Python 3.13.15, CPU only. The synthetic census test, feature_scan regression suite and Python compilation passed. The normal CLI read all 12,101 indexed retail PS signatures. Of the six-row signatures, 1,702 declared six colour targets and one declared five colours plus depth. The entry-name and stem predicates yielded 3,014 and 3,004 shaders with 16,358 and 16,306 observed colour exports respectively. Seven listings in each cohort reported incomplete coverage. The historical 2,989 count did not reproduce.

AI-assisted with Codex.

@mrbean56

Copy link
Copy Markdown

Tested b0e4e660b6 on Linux (Debian 13), Python 3.13.5: pass, mutations caught.

  • pytest tests/test_gbuffer_census.py -q: 1 passed (7 assertions through subTest-like checks); pytest tests/test_feature_scan.py -q: 12 passed, so the signature_offsets/streams refactor keeps the existing scanner behavior (truncated tables still give an empty set, well-formed ones read the same).
  • Mutations: colour = shape["target"] → 0 fails the census test, and forcing complete = True fails it too, so both the denominator and the export-coverage sides are pinned.
  • The element decode (<4IBB2xI at offset + 8, i.e. SemanticIndex/SystemValueType/ComponentType/Register/Mask/ReadWriteMask/MinPrecision of a 32-byte element) matches docs/gbuffer.md's "register, semantic_index, component_type, mask, min_precision"; the system mapping (64/65/67/68) is the same one the doc's target/depth rows come from.

No GPU, no game data. AI-assisted.

@kapitche

Copy link
Copy Markdown
Contributor

Tested b0e4e66 merged with main 561b65a on Linux (WSL2) x86_64, Python 3.12.16 (-I): concern

tests/test_gbuffer_census.py: 1 run, 1 passed, 0 failed. Existing tests that import feature_scan (test_feature_scan, test_feature_scan_bad_index, test_feature_scan_order, test_inner_coverage_metadata, test_runner_calls_all_tests): all OK. Negative control: with feature_scan.py and gbuffer_census.py from main the test cannot import (ImportError: cannot import name 'signature_offsets'); with the PR's files it passes. Concern (reproduced): python -I tools/gbuffer_census.py /nonexist ends in a FileNotFoundError traceback (exit 1) from census() reading <dir>/index.json, where the other tools in tests/test_missing_input_exit_codes.py print one ERROR: line and exit 2. The CLI is not covered by the new test.

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.

3 participants