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

Closed
leonida/mandy
Undefined3301 wants to merge 0 commits from fspx-library-state-fill into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

Undefined3301 commented 2026-11-25 20:04:58 +00:00

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.

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 commented 2026-11-25 20:22:32 +00:00

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).

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).
Sign in to join this conversation.
No description provided.