[PR #882] [MERGED] fssm_unpack: count containers and programs apart, per stage (BL-5) #920

Closed
opened 2026-11-26 20:19:30 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/882
Author: @quartz-heron-58
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @aslan2142

Base: main ← Head: bl5-corpus-count


📝 Commits (2)

  • 1f3f4ba fssm_unpack: count containers and programs apart, per stage (BL-5)
  • 87e19b9 test_fssm_unpack: an empty or non-string stage is stage unknown too (BL-5)

📊 Changes

4 files changed (+137 additions, -7 deletions)

View changed files

📝 docs/shader_library.md (+34 -0)
📝 tests/test_fssm_unpack.py (+55 -0)
📝 tools/fssm_unpack.py (+29 -3)
📝 tools/shader_stage_manifest.py (+19 -4)

📄 Description

Claimed in the coordination issue as: BL-5 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135048744)

What and why

BL-5 in docs/boot_leads.md asks why a count of 26,698 shader programs has been reported against this repository's 26,503, and whether the difference of 195 (the geometry-shader count) is a counting difference or programs the carve misses.

It is a counting difference. Measured on an own 1.0.2.1 copy:

Stage Containers tag-0x0D payloads Containers with two
vs 2,236 2,431 195
ms 9,282 9,282 0
ps 12,101 12,101 0
gs 195 195 0
cs 2,689 2,689 0
total 26,503 26,698 195

26,503 is carved containers and 26,698 is the tag-0x0D payloads in them. The 195 two-payload containers are all vertex shaders: the ES and VS hardware variants docs/design.md already describes ("VS as ES (two-payload VS containers)"). The carve skips nothing.

Changes:

  • tools/fssm_unpack.py prints both counts after unpacking and, when given the carve index, one line per stage (program_counts). An index entry without a stage is counted under "stage unknown", not dropped or guessed.
  • tools/shader_stage_manifest.py gains shader_stages, which reads the stage the carve index records. It shares the existing entry validation with shader_stems through one helper, so the tool reads the carve's stage and does not parse the container's program header a second time.
  • docs/shader_library.md gets a "Containers and programs" section with the two counts and the table above.

Not in this pull request: the 195 export-stage payloads stay untranslated (the tool still writes the last payload by default), and which payload a geometry-shader pipeline selects stays open, as docs/design.md says.

Tested

  • python -I tests/test_fssm_unpack.py: 48 tests pass, two of them new and synthetic (three containers with four payloads through the CLI with a carve index, including an entry with no stage; and one two-payload container without a carve index).
  • test_shader_stage_manifest, test_shader_stage_resume, test_library_shaders_stage (1 skipped, as on main), test_make_game_dry_run, test_vs_layout_census, test_fssm_crosscheck: pass.
  • The tests/test_docs_*.py checks pass except test_docs_links, which fails the same way on plain main at 8f05e09e (docs/boot_leads.md links CONTRIBUTING.md relative to docs/).
  • The table is program_counts run over the index.json and fssm_index.json of a make_game.py shader stage on the own copy. The unpack CLI itself was not re-run on the real corpus with this change. The full translator suite was not run: the translator is not touched.
  • Windows 11, Python 3.12.10.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator rule in this change.)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/882 **Author:** [@quartz-heron-58](https://github.com/quartz-heron-58) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `bl5-corpus-count` --- ### 📝 Commits (2) - [`1f3f4ba`](https://github.com/ubiquitarianism/leonida/commit/1f3f4ba3bbd7f05ee8114e0fac4d3bc78fe5a272) fssm_unpack: count containers and programs apart, per stage (BL-5) - [`87e19b9`](https://github.com/ubiquitarianism/leonida/commit/87e19b960eb24b46a4bb187cf29735be9f135b01) test_fssm_unpack: an empty or non-string stage is stage unknown too (BL-5) ### 📊 Changes **4 files changed** (+137 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/shader_library.md` (+34 -0) 📝 `tests/test_fssm_unpack.py` (+55 -0) 📝 `tools/fssm_unpack.py` (+29 -3) 📝 `tools/shader_stage_manifest.py` (+19 -4) </details> ### 📄 Description Claimed in the coordination issue as: BL-5 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135048744) ### What and why BL-5 in `docs/boot_leads.md` asks why a count of 26,698 shader programs has been reported against this repository's 26,503, and whether the difference of 195 (the geometry-shader count) is a counting difference or programs the carve misses. It is a counting difference. Measured on an own 1.0.2.1 copy: | Stage | Containers | tag-0x0D payloads | Containers with two | |---|---|---|---| | `vs` | 2,236 | 2,431 | 195 | | `ms` | 9,282 | 9,282 | 0 | | `ps` | 12,101 | 12,101 | 0 | | `gs` | 195 | 195 | 0 | | `cs` | 2,689 | 2,689 | 0 | | total | 26,503 | 26,698 | 195 | 26,503 is carved containers and 26,698 is the tag-0x0D payloads in them. The 195 two-payload containers are all vertex shaders: the ES and VS hardware variants `docs/design.md` already describes ("VS as ES (two-payload VS containers)"). The carve skips nothing. Changes: - `tools/fssm_unpack.py` prints both counts after unpacking and, when given the carve index, one line per stage (`program_counts`). An index entry without a stage is counted under "stage unknown", not dropped or guessed. - `tools/shader_stage_manifest.py` gains `shader_stages`, which reads the stage the carve index records. It shares the existing entry validation with `shader_stems` through one helper, so the tool reads the carve's stage and does not parse the container's program header a second time. - `docs/shader_library.md` gets a "Containers and programs" section with the two counts and the table above. Not in this pull request: the 195 export-stage payloads stay untranslated (the tool still writes the last payload by default), and which payload a geometry-shader pipeline selects stays open, as `docs/design.md` says. ### Tested - `python -I tests/test_fssm_unpack.py`: 48 tests pass, two of them new and synthetic (three containers with four payloads through the CLI with a carve index, including an entry with no stage; and one two-payload container without a carve index). - `test_shader_stage_manifest`, `test_shader_stage_resume`, `test_library_shaders_stage` (1 skipped, as on `main`), `test_make_game_dry_run`, `test_vs_layout_census`, `test_fssm_crosscheck`: pass. - The `tests/test_docs_*.py` checks pass except `test_docs_links`, which fails the same way on plain `main` at `8f05e09e` (`docs/boot_leads.md` links `CONTRIBUTING.md` relative to `docs/`). - The table is `program_counts` run over the `index.json` and `fssm_index.json` of a `make_game.py` shader stage on the own copy. The unpack CLI itself was not re-run on the real corpus with this change. The full translator suite was not run: the translator is not touched. - Windows 11, Python 3.12.10. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No translator rule in this change.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:19:30 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#920
No description provided.