scarlett: scale preparation jobs with cores and optionally seed from shaders.rpf #115

Manually merged
github merged 1 commit from gh-pr/115/head into gh-pr/115/base 2026-11-26 06:32:10 +00:00
Owner

@⁠NathansDomainSolutions on GitHub · 2026-11-24 23:31 UTC · original
NathansDomainSolutions:speedup/prep-jobs-and-pack-seed → main · +296 −1 · 5 files · 1 commits · merged 2026-11-24 23:34 UTC

Summary

  • Preparation jobs. Launch-time preparation ran a fixed 4 compiler jobs. It now runs one per available core, up to 8, and TUXBOX_SHADER_PREP_JOBS (1–32) overrides that. After #101, preparation compiles about 11k programs; it took 20 minutes on a 16-thread machine with the old fixed limit.
  • Optional seeding from the shader pack (TUXBOX_SCARLETT_SEED_PACK=1). project_tuxbox/shader_pack.py scans shaders.rpf for its plain shader records (stored after the encrypted table of contents; nothing is decrypted). It inflates each one, keeps DXBC containers, and adds them to the request archive as <sha256>.dxbc, the format the runtime records. The first launch then prepares shaders that earlier runs never reached. Linked pairs, stencil variants and programs whose root signature arrives at pipeline creation are still recorded during play.
  • The record layout follows xcl's documented pack reader (GPL-2.0-only). This is an independent implementation, credited in docs/REFERENCES.md.

Checks

  • 7 new unit tests in tests/test_shader_pack.py; the full Python suite passes (222 tests).
  • On the retail 1.0.2.1 shaders.rpf (412 MB): 25,889 distinct DXBC programs found in 4.4 s. 5,527 of them are byte-identical to requests ProjectScarlett recorded at run time on this machine.

This change was written with AI assistance (Claude Code, in two sessions) and checked as described above.

🤖 Generated with Claude Code

**@⁠NathansDomainSolutions** on GitHub · 2026-11-24 23:31 UTC · [original](https://github.com/brcly/TuxBox/pull/115) `NathansDomainSolutions:speedup/prep-jobs-and-pack-seed` → `main` · +296 −1 · 5 files · 1 commits · merged 2026-11-24 23:34 UTC ## Summary - **Preparation jobs.** Launch-time preparation ran a fixed 4 compiler jobs. It now runs one per available core, up to 8, and `TUXBOX_SHADER_PREP_JOBS` (1–32) overrides that. After #101, preparation compiles about 11k programs; it took 20 minutes on a 16-thread machine with the old fixed limit. - **Optional seeding from the shader pack (`TUXBOX_SCARLETT_SEED_PACK=1`).** `project_tuxbox/shader_pack.py` scans `shaders.rpf` for its plain shader records (stored after the encrypted table of contents; nothing is decrypted). It inflates each one, keeps DXBC containers, and adds them to the request archive as `<sha256>.dxbc`, the format the runtime records. The first launch then prepares shaders that earlier runs never reached. Linked pairs, stencil variants and programs whose root signature arrives at pipeline creation are still recorded during play. - The record layout follows xcl's documented pack reader (GPL-2.0-only). This is an independent implementation, credited in `docs/REFERENCES.md`. ## Checks - 7 new unit tests in `tests/test_shader_pack.py`; the full Python suite passes (222 tests). - On the retail 1.0.2.1 `shaders.rpf` (412 MB): 25,889 distinct DXBC programs found in 4.4 s. 5,527 of them are byte-identical to requests ProjectScarlett recorded at run time on this machine. This change was written with AI assistance (Claude Code, in two sessions) and checked as described above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Use one compiler job per core (up to 8, TUXBOX_SHADER_PREP_JOBS for 1-32)
instead of a fixed 4 during launch-time preparation.

With TUXBOX_SCARLETT_SEED_PACK=1, read the plain shader records in
shaders.rpf and add each DXBC program to the request archive, so the first
launch prepares shaders that earlier runs never reached. Nothing is
decrypted: the records follow the archive's encrypted table of contents.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:32:08 +00:00
github manually merged commit 53bf140221 into gh-pr/115/base 2026-11-26 06:32:10 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.