user_sgpr_census: support MS stage techniques and pairing with PS (USER-SGPR-CENSUS-MS-TECHNIQUE) #1795

Merged
leonida/mandy
abnalstlll-byte merged 1 commit from feat/user-sgpr-census-ms-technique into main 2026-11-28 14:59:41 +00:00

Pull request successfully merged and closed

abnalstlll-byte commented 2026-11-25 12:14:38 +00:00

Description

This PR implements mesh shader stage support in tools/user_sgpr_census.py and expands its test coverage.

Changes

  1. Technique Regex (tools/user_sgpr_census.py):
    • Expanded TECHNIQUE_RE from r"^.?(VS|PS)_(.+?)(?:_[0-9a-f]{8})?(?:_Wrapped)?$" to r"^.?(VS|PS|MS)_(.+?)(?:_[0-9a-f]{8})?(?:_Wrapped)?$" to correctly recognize mesh shaders (MS_).
    • Updated technique(name, stage) docstring and matching logic.
  2. Configurable Stage Pairs (pair_census):
    • Parameterized pair_census(index, stages=("vs", "ps")) to allow pairing any stage pair (e.g., MS with PS) while preserving 100% backwards-compatible dictionary return keys when called with default ("vs", "ps").
  3. CLI & Report (main):
    • In --pairs mode, if ms stage shaders are present in index.json, automatically computes and outputs MS/PS pairs summary and includes ms_ps_pairs in the JSON report.
  4. Test Suite (tests/test_user_sgpr_census.py):
    • Added ms shader stage fixture to INDEX with pointer reads at s16.
    • Added test assertions for ms in test_lowest_pointer_per_stage and --expect ms=16 in test_expect_passes_and_fails.
    • Added technique parsing assertions for MS_ tokens in test_technique_names.
    • Added test_mesh_shader_pair_census_and_cli verifying pair_census with ("ms", "ps") and CLI reporting.

Verification

  • python -m pytest tests/test_user_sgpr_census.py: 45 passed in 2.34s.
  • python -I tools/user_sgpr_census.py --help: Verified clean stdlib execution.
  • python -I tests/test_text_write_line_endings.py: 3/3 tests passed.
  • python -I scripts/check_no_game_data.py tools/user_sgpr_census.py tests/test_user_sgpr_census.py: Clean-room confirmed, 0 violations.

Claimed in #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162037146).

AI-assisted (Claude Code)

### Description This PR implements mesh shader stage support in `tools/user_sgpr_census.py` and expands its test coverage. ### Changes 1. **Technique Regex (`tools/user_sgpr_census.py`)**: - Expanded `TECHNIQUE_RE` from `r"^.?(VS|PS)_(.+?)(?:_[0-9a-f]{8})?(?:_Wrapped)?$"` to `r"^.?(VS|PS|MS)_(.+?)(?:_[0-9a-f]{8})?(?:_Wrapped)?$"` to correctly recognize mesh shaders (`MS_`). - Updated `technique(name, stage)` docstring and matching logic. 2. **Configurable Stage Pairs (`pair_census`)**: - Parameterized `pair_census(index, stages=("vs", "ps"))` to allow pairing any stage pair (e.g., `MS` with `PS`) while preserving 100% backwards-compatible dictionary return keys when called with default `("vs", "ps")`. 3. **CLI & Report (`main`)**: - In `--pairs` mode, if `ms` stage shaders are present in `index.json`, automatically computes and outputs `MS/PS pairs` summary and includes `ms_ps_pairs` in the JSON report. 4. **Test Suite (`tests/test_user_sgpr_census.py`)**: - Added `ms` shader stage fixture to `INDEX` with pointer reads at s16. - Added test assertions for `ms` in `test_lowest_pointer_per_stage` and `--expect ms=16` in `test_expect_passes_and_fails`. - Added technique parsing assertions for `MS_` tokens in `test_technique_names`. - Added `test_mesh_shader_pair_census_and_cli` verifying `pair_census` with `("ms", "ps")` and CLI reporting. ### Verification - `python -m pytest tests/test_user_sgpr_census.py`: 45 passed in 2.34s. - `python -I tools/user_sgpr_census.py --help`: Verified clean stdlib execution. - `python -I tests/test_text_write_line_endings.py`: 3/3 tests passed. - `python -I scripts/check_no_game_data.py tools/user_sgpr_census.py tests/test_user_sgpr_census.py`: Clean-room confirmed, 0 violations. Claimed in #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162037146). AI-assisted (Claude Code)
zmasi commented 2026-11-28 12:04:41 +00:00

#1795 | head 1e0554da8f81d2adcd5e6c4ec5049dddf6b49a6c (merged cleanly with main d48a957bb) | pytest tests/test_user_sgpr_census.py | red on main: 2 failed, 43 passed (technique('MS_Terrain', 'ms') returned None and pair_census lacked stages=) | green on PR+main: 45 passed | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited TECHNIQUE_RE, technique, pair_census, and main in tools/user_sgpr_census.py (extending technique matching to MS stage shaders and generalizing pair_census(index, stages=("vs", "ps")) to emit ms_ps_pairs alongside vs_ps_pairs when mesh shaders are present while keeping VS/PS-only reports unchanged). Also verified tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

#1795 | head 1e0554da8f81d2adcd5e6c4ec5049dddf6b49a6c (merged cleanly with main d48a957bb) | `pytest tests/test_user_sgpr_census.py` | red on main: `2 failed, 43 passed` (`technique('MS_Terrain', 'ms')` returned `None` and `pair_census` lacked `stages=`) | green on PR+main: `45 passed` | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `TECHNIQUE_RE`, `technique`, `pair_census`, and `main` in `tools/user_sgpr_census.py` (extending technique matching to `MS` stage shaders and generalizing `pair_census(index, stages=("vs", "ps"))` to emit `ms_ps_pairs` alongside `vs_ps_pairs` when mesh shaders are present while keeping VS/PS-only reports unchanged). Also verified `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
MoonEyes commented 2026-11-28 14:59:33 +00:00

Red/green: classified READY by cloud-4 (red on main 09c153948, green on head merged with main); head 1e0554da8f81 unchanged since 2026-11-25, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: classified READY by cloud-4 (red on main 09c153948, green on head merged with main); head 1e0554da8f81 unchanged since 2026-11-25, before that run. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No description provided.