shaders: fill fspx_state_sha256 from library sidecars (FSPX-LIBRARY-STATE-FILL) #2095

Closed
github-bot wants to merge 1 commit from gh-pr/2095/head into gh-pr/2095/base
Owner

@⁠Undefined3301 on GitHub · 2026-11-25 20:04 UTC · original
fspx-library-state-fill → main · +166 −0 · 2 files · 1 commits · closed without merging

Item: FSPX-LIBRARY-STATE-FILL

What

Adds tools/fill_fspx_library_states.py, which fills a missing fspx_state_sha256 in an existing pipeline-library translation index (<shaders>/library/index.json) from its <name>.state sidecars, plus tests/test_fill_fspx_library_states.py (standard library only, synthetic state files).

Why

An FSPX program that carries a kind-0 state is matched by both fspx_code_sha256 and fspx_state_sha256 (ShaderLibrary::program_candidates, runtime/src/shader_library.h). An index entry written before the sidecar key was recorded has the code hash but no state hash, so the incoming state filters every entry out and the pipeline is stubbed even though its translation exists.

Measured

Retail boot, RTX 4080, NVIDIA 621.24: 934 distinct FSPX compute programs reached slot 67 with a kind-0 state and were refused (no translated compute shader ... entries 1). 923 have a translation and a .state sidecar but no state key. After filling the index the count drops to 11 (the 29-program FidelityFX DLL has 27 translated here; 2 still fail the decoder) and those 923 pipelines are created for real. The boot then reaches the story transition instead of stalling one scene earlier.

The 923 entries are translations the current translator no longer reproduces (fall-through into undecodable words), so re-running library_shaders drops them rather than recording the key; the tool repairs an existing work folder in place and is idempotent (second run: 0 added).

Tests

python -I tests/test_fill_fspx_library_states.py     # 5 tests, OK
python -m compileall -q tools/fill_fspx_library_states.py tests/test_fill_fspx_library_states.py

AI-assisted: yes (DeepSeek V4.1 Flash via OpenCode/T3 Code). The tool writes LF and sorts keys atomically like the translator; no game data is in the test.

**@⁠Undefined3301** on GitHub · 2026-11-25 20:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2095) `fspx-library-state-fill` → `main` · +166 −0 · 2 files · 1 commits · closed without merging Item: FSPX-LIBRARY-STATE-FILL ## What Adds `tools/fill_fspx_library_states.py`, which fills a missing `fspx_state_sha256` in an existing pipeline-library translation index (`<shaders>/library/index.json`) from its `<name>.state` sidecars, plus `tests/test_fill_fspx_library_states.py` (standard library only, synthetic state files). ## Why An FSPX program that carries a kind-0 state is matched by both `fspx_code_sha256` and `fspx_state_sha256` (`ShaderLibrary::program_candidates`, `runtime/src/shader_library.h`). An index entry written before the sidecar key was recorded has the code hash but no state hash, so the incoming state filters every entry out and the pipeline is stubbed even though its translation exists. ## Measured Retail boot, RTX 4080, NVIDIA 621.24: 934 distinct FSPX compute programs reached slot 67 with a kind-0 state and were refused (`no translated compute shader ... entries 1`). 923 have a translation and a `.state` sidecar but no state key. After filling the index the count drops to 11 (the 29-program FidelityFX DLL has 27 translated here; 2 still fail the decoder) and those 923 pipelines are created for real. The boot then reaches the story transition instead of stalling one scene earlier. The 923 entries are translations the current translator no longer reproduces (`fall-through into undecodable words`), so re-running `library_shaders` drops them rather than recording the key; the tool repairs an existing work folder in place and is idempotent (second run: 0 added). ## Tests ```` python -I tests/test_fill_fspx_library_states.py # 5 tests, OK python -m compileall -q tools/fill_fspx_library_states.py tests/test_fill_fspx_library_states.py ```` AI-assisted: yes (DeepSeek V4.1 Flash via OpenCode/T3 Code). The tool writes LF and sorts keys atomically like the translator; no game data is in the test.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:17:40 +00:00
github-bot closed this pull request 2026-11-26 10:17:40 +00:00
Author
Owner

@⁠Undefined3301 on GitHub · 2026-11-25 20:22 UTC · original

Freeing the single open-PR slot that accounts without 2 merged PRs are limited to: the V# 47-bit range fix is the smaller, CPU-test-covered change, so it goes first. The tool and its tests stay on this branch; I will reopen this PR after the next merge (or resubmit it as a finding if the build side is preferred).

**@⁠Undefined3301** on GitHub · 2026-11-25 20:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2095#issuecomment-7173576831) Freeing the single open-PR slot that accounts without 2 merged PRs are limited to: the V# 47-bit range fix is the smaller, CPU-test-covered change, so it goes first. The tool and its tests stay on this branch; I will reopen this PR after the next merge (or resubmit it as a finding if the build side is preferred).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.