[PR #565] [CLOSED] Translator: --shader-list to translate only a subset of shaders #609

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/565
Author: @x2Tweek
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: shader-subset


📝 Commits (4)

  • b13a2f3 Translator: --shader-list to translate only a subset of shaders
  • f0ac759 Translator: --shader-list writes subset to separate dir, never touches full index
  • 01d444c Translator: --shader-list never touches the full index; add tests
  • d50e1a4 make_game: include shader list content in shard plan identity

📊 Changes

5 files changed (+255 additions, -66 deletions)

View changed files

📝 make_game.py (+93 -66)
📝 tests/test_make_game_empty_translation.py (+58 -0)
📝 tests/test_rdna2spirv_cli.py (+30 -0)
📝 tests/test_shader_stage_resume.py (+63 -0)
📝 tools/rdna2spirv.py (+11 -0)

📄 Description

Claimed in the coordination issue as: SHADER-SUBSET (issue #14)

What and why

Add --shader-list FILE to tools/rdna2spirv.py and make_game.py
so only the shaders whose stems are listed in FILE are translated,
instead of all 26,503. This cuts retranslation time for testing
translator changes on a small subset of the corpus.

make_game.py skips verify_translation_completeness() when
--shader-list is given (the subset index is intentionally incomplete)
and never touches the existing spirv/index.json — the full index
always survives a subset run. The subset is written to a separate
<spirv>/subset/ directory.

The content of the list is part of the shard plan's identity: the same list reuses finished shards, while a changed list (or the same file rewritten with other stems) translates again.

rdna2spirv.py reads the list of shader stems (one per line) and
filters the .s files from the disassembly directory before
translation, after the existing --limit and --shard filters.

This is the translation half of the "translate only the shaders the
game actually uses" item. The other half — runtime instrumentation to
record which shader IDs --run requests — is C++ work not included
here. This PR builds on PR #497's native_hashes.txt index
(conceptually) but does not depend on it: --shader-list works with
any list of shader stems.

Tested

python -I tools/rdna2spirv.py <work>/shaders/dxbc/disasm --out <scratch> --shader-list <5-stem-list> --no-asm --no-validate --assembler python:

  • Exactly 5 of 26,503 shaders translated
  • index.json has 5 entries matching the list
  • py_compile + compileall on both files: OK
  • check_no_game_data.py on both files: OK

python -I tests/test_make_game_empty_translation.py (15 tests, including new full-index-survives-subset test): OK
python -I tests/test_rdna2spirv_cli.py (37 tests, including new --shader-list filter test): OK

python -I tests/test_shader_stage_resume.py (including the new subset-list identity test): OK

GPU: not needed (CPU-only translation). No game files used.

AI-assisted: yes

Checklist

  • No game data, keys or decryption in this change or its report
  • Translator rule: not applicable (no translator rule changed)

🔄 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/565 **Author:** [@x2Tweek](https://github.com/x2Tweek) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `shader-subset` --- ### 📝 Commits (4) - [`b13a2f3`](https://github.com/ubiquitarianism/leonida/commit/b13a2f3dd16959288def1252955388a9b8f3c5a7) Translator: --shader-list to translate only a subset of shaders - [`f0ac759`](https://github.com/ubiquitarianism/leonida/commit/f0ac759305facf57f56435d817d14f6e810471eb) Translator: --shader-list writes subset to separate dir, never touches full index - [`01d444c`](https://github.com/ubiquitarianism/leonida/commit/01d444ccb3a0c0e4095e5a5059ec8d64a3704ae3) Translator: --shader-list never touches the full index; add tests - [`d50e1a4`](https://github.com/ubiquitarianism/leonida/commit/d50e1a436373181d51c6bca93736658e71659ec5) make_game: include shader list content in shard plan identity ### 📊 Changes **5 files changed** (+255 additions, -66 deletions) <details> <summary>View changed files</summary> 📝 `make_game.py` (+93 -66) 📝 `tests/test_make_game_empty_translation.py` (+58 -0) 📝 `tests/test_rdna2spirv_cli.py` (+30 -0) 📝 `tests/test_shader_stage_resume.py` (+63 -0) 📝 `tools/rdna2spirv.py` (+11 -0) </details> ### 📄 Description Claimed in the coordination issue as: SHADER-SUBSET (issue #14) ### What and why Add `--shader-list FILE` to `tools/rdna2spirv.py` and `make_game.py` so only the shaders whose stems are listed in FILE are translated, instead of all 26,503. This cuts retranslation time for testing translator changes on a small subset of the corpus. `make_game.py` skips `verify_translation_completeness()` when `--shader-list` is given (the subset index is intentionally incomplete) and never touches the existing `spirv/index.json` — the full index always survives a subset run. The subset is written to a separate `<spirv>/subset/` directory. The content of the list is part of the shard plan's identity: the same list reuses finished shards, while a changed list (or the same file rewritten with other stems) translates again. `rdna2spirv.py` reads the list of shader stems (one per line) and filters the `.s` files from the disassembly directory before translation, after the existing `--limit` and `--shard` filters. This is the translation half of the "translate only the shaders the game actually uses" item. The other half — runtime instrumentation to record which shader IDs `--run` requests — is C++ work not included here. This PR builds on PR #497's `native_hashes.txt` index (conceptually) but does not depend on it: `--shader-list` works with any list of shader stems. ### Tested `python -I tools/rdna2spirv.py <work>/shaders/dxbc/disasm --out <scratch> --shader-list <5-stem-list> --no-asm --no-validate --assembler python`: - Exactly 5 of 26,503 shaders translated - `index.json` has 5 entries matching the list - `py_compile` + `compileall` on both files: OK - `check_no_game_data.py` on both files: OK `python -I tests/test_make_game_empty_translation.py` (15 tests, including new full-index-survives-subset test): OK `python -I tests/test_rdna2spirv_cli.py` (37 tests, including new --shader-list filter test): OK `python -I tests/test_shader_stage_resume.py` (including the new subset-list identity test): OK GPU: not needed (CPU-only translation). No game files used. AI-assisted: yes ### Checklist - [x] No game data, keys or decryption in this change or its report - [x] Translator rule: not applicable (no translator rule changed) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:27 +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#609
No description provided.