feat(tools): build and test a title's shader set as part of the build #33

Manually merged
github merged 1 commit from gh-pr/33/head into gh-pr/33/base 2026-11-26 19:14:38 +00:00
Owner

@⁠Dark3581 on GitHub · 2026-11-22 09:56 UTC · original
Dark3581:feat/shader-build → main · +618 −0 · 8 files · 1 commits · merged 2026-11-22 09:59 UTC

What

A title's shader set can now be built and tested as part of the build, from your own package and into the build folder, so nothing of it is ever committed.

  • cmake/Shaders.cmake: with -DANYBOX_GAME_PACKAGE=<package> and -DANYBOX_SHADER_TRANSLATOR=<checkout> (both or neither), configure adds the targets shaders (the external translator's shader stage into build/shaders/work, then the store in build/shaders/store), shader_store (store only) and shader_pipelines (every pipeline on this PC's GPU, with its cache in build/shaders). Optional: ANYBOX_PIPELINE_CHECK, ANYBOX_SHADER_JOBS, ANYBOX_WAVE64_EMULATE. Without the two paths nothing changes.
  • tools/build_shaders.py runs those steps and writes build/shaders/build.json: translator revision and whether it had local changes, carved and translated counts, store counts, pipeline totals with the name of each failed or skipped pipeline, plus translate.log and pipelines.log. A new translation drops older store and pipeline results so tests cannot pass on stale data. The translator stays a separate program called by path; AnyBox contains none of it.
  • Tests labelled shaders (registered only when configured): shaders_store (every carved shader translated, a complete store, and the C++ store in d3d12_x finds every container with the translation's stage), shaders_gpu (gpu_report.py --store finds a device for every module; skipped without Vulkan), shaders_pipelines (the last pipeline run completed with no failure; skipped until it has run).
  • Docs: BUILD.md and a GAME_TESTING.md section.

Tested

  • Windows 10, MinGW GCC 15.2, clean build: 61 of 61 tests pass with the shader options set (shaders_pipelines skipped), and the default configuration is unchanged. check_conventions.py passes.
  • tools_test_build_shaders (11 cases, in CI, no game data): a fake translator and a fake checker cover translation, store, pipelines, translator failure, an incomplete store, a failed pipeline, stale-result dropping, missing inputs and the summary parser (including a crashed run with no summary).
  • On one title's package with the current upstream translator: cmake --build build --target shaders carved and translated 26,503 shaders in 72 minutes (wave64 emulation on); the store holds 25,889 modules, 614 duplicates, 0 missing, 0 invalid, 0 conflicts. shaders_store found 26,503 of 26,503 containers through the C++ store (10 s); shaders_gpu passes on an RTX 3070 Ti. The pipeline target is running separately. No game data in the PR.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • python tools/check_conventions.py passes (no comments in code, one declaration per export, Conventional Commit subjects)
  • Unimplemented paths stop (AbxNotImplemented / AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragment
  • Known gaps added, changed or removed through docs/dev/debt/changes/<branch>.md (none: no library behaviour changes)
  • Generic behaviour, not specific to one title
  • No game files, keys, notes or logs added to the repository
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • Source of behaviour: n/a
  • AI-assisted: yes
**@⁠Dark3581** on GitHub · 2026-11-22 09:56 UTC · [original](https://github.com/Dark3581/AnyBox/pull/33) `Dark3581:feat/shader-build` → `main` · +618 −0 · 8 files · 1 commits · merged 2026-11-22 09:59 UTC ### What A title's shader set can now be built and tested as part of the build, from your own package and into the build folder, so nothing of it is ever committed. - **`cmake/Shaders.cmake`**: with `-DANYBOX_GAME_PACKAGE=<package>` and `-DANYBOX_SHADER_TRANSLATOR=<checkout>` (both or neither), configure adds the targets `shaders` (the external translator's shader stage into `build/shaders/work`, then the store in `build/shaders/store`), `shader_store` (store only) and `shader_pipelines` (every pipeline on this PC's GPU, with its cache in `build/shaders`). Optional: `ANYBOX_PIPELINE_CHECK`, `ANYBOX_SHADER_JOBS`, `ANYBOX_WAVE64_EMULATE`. Without the two paths nothing changes. - **`tools/build_shaders.py`** runs those steps and writes `build/shaders/build.json`: translator revision and whether it had local changes, carved and translated counts, store counts, pipeline totals with the name of each failed or skipped pipeline, plus `translate.log` and `pipelines.log`. A new translation drops older store and pipeline results so tests cannot pass on stale data. The translator stays a separate program called by path; AnyBox contains none of it. - **Tests labelled `shaders`** (registered only when configured): `shaders_store` (every carved shader translated, a complete store, and the C++ store in `d3d12_x` finds every container with the translation's stage), `shaders_gpu` (`gpu_report.py --store` finds a device for every module; skipped without Vulkan), `shaders_pipelines` (the last pipeline run completed with no failure; skipped until it has run). - Docs: BUILD.md and a GAME_TESTING.md section. ### Tested - Windows 10, MinGW GCC 15.2, clean build: 61 of 61 tests pass with the shader options set (`shaders_pipelines` skipped), and the default configuration is unchanged. `check_conventions.py` passes. - `tools_test_build_shaders` (11 cases, in CI, no game data): a fake translator and a fake checker cover translation, store, pipelines, translator failure, an incomplete store, a failed pipeline, stale-result dropping, missing inputs and the summary parser (including a crashed run with no summary). - On one title's package with the current upstream translator: `cmake --build build --target shaders` carved and translated 26,503 shaders in 72 minutes (wave64 emulation on); the store holds 25,889 modules, 614 duplicates, 0 missing, 0 invalid, 0 conflicts. `shaders_store` found 26,503 of 26,503 containers through the C++ store (10 s); `shaders_gpu` passes on an RTX 3070 Ti. The pipeline target is running separately. No game data in the PR. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] `python tools/check_conventions.py` passes (no comments in code, one declaration per export, Conventional Commit subjects) - [x] Unimplemented paths stop (`AbxNotImplemented` / `AbxUnsupported`); silent stubs are listed under Silent stubs through a debt fragment - [x] Known gaps added, changed or removed through `docs/dev/debt/changes/<branch>.md` (none: no library behaviour changes) - [x] Generic behaviour, not specific to one title - [x] No game files, keys, notes or logs added to the repository - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] Source of behaviour: n/a - [x] AI-assisted: yes
Configure with ANYBOX_GAME_PACKAGE and ANYBOX_SHADER_TRANSLATOR to get the
shaders, shader_store and shader_pipelines targets, which run an external
translator, build the shader store and create every pipeline into
build/shaders, and the shaders_store, shaders_gpu and shaders_pipelines
tests, which check the result. Nothing of the shader set is committed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:14:37 +00:00
github manually merged commit cf14194bb4 into gh-pr/33/base 2026-11-26 19:14:38 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.