Skip to content

NSP script: a shaders_stale build event when cached libraries cannot be reused - #490

Closed
v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:nsp-chain-event
Closed

v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:nsp-chain-event

Conversation

@v0lumehi

Copy link
Copy Markdown
Contributor

What and why

A change to the shader translation chain (DMSH_CHAIN) or to a profile's shader inputs makes the cached libraries unusable (b-<V>/, stamp inputs.tsv). The NSP script then rebuilt them without a word: a front end saw only the long shader stage. Front ends that want to explain it had to match a text line.

With --progress json the script now sends one shaders_stale event (reason chain or inputs, old, new, count) before the rebuild, plus a [NOTE] line in every mode. A step that reuses its libraries, or has none cached, sends nothing. Documented in docs/frontends.md (Building). Part of the runtime/build-events interface in #388.

Checked

  • Tests: dm/tools/tests/test_nsp_progress.py (new ShadersStale cases fail without the change), test_docs.py, test_nsp_chain/incremental/mac; lint_python.py: 0 new.
  • Games run: none (script-only change, no build run).
  • Devices and OS: macOS only, unit tests.

Docs

  • Event documented in docs/frontends.md
  • No chain tool changed
  • No game files, keys or data extracted from a game

…aries cannot be reused

With --progress json, a shaders_stale event (reason chain or inputs, old, new,
count) goes out once before the shader step rebuilds libraries that a
translation chain or profile input change made unusable, with a [NOTE] line.
Until now the libraries of another chain were ignored without a word.
seedds added a commit that referenced this pull request Oct 31, 2026
Emit a shaders_stale event before rebuilding libraries after a chain or
profile input change, with the same explanation in human progress modes.

Check completion stamps separately for the selected targets so partial
current-chain outputs cannot hide old libraries. Count each current shader
key once per selected target instead of summing retained historical copies.
Document the count as scheduled base libraries, including cache restores,
and cover interrupted rebuilds, mixed targets and duplicate old caches.

Co-authored-by: v0lumehi <[email protected]>
@seedds

seedds commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Landed on main as 2716f78f, with two reporting corrections:

  • Check completion stamps separately for each selected target. An unstamped output from an interrupted chain rebuild no longer hides the old libraries, and current Mac libraries cannot hide stale iOS libraries.
  • Count each current shader key once per selected target, rather than summing historical copies. The documented count is scheduled base libraries, including cache restores.

Validation: 107 tests passed across test_nsp_progress, test_nsp_mac, test_nsp_incremental, test_nsp_chain and test_docs. The new cases failed against the original implementation and pass with the fixes. The pinned Python lint/type ratchet reports 0 new findings.

Regression level: low, because only reporting and its tests/docs changed; no game regression runs. No shader-chain tool changed. Confidence is high in both corrections; they are generalized root-cause fixes, with no game-specific rules or workarounds.

Credited @v0lumehi as co-author because the original event/protocol implementation is retained. Closing as landed.

@seedds seedds closed this Oct 31, 2026
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
Emit a shaders_stale event before rebuilding libraries after a chain or
profile input change, with the same explanation in human progress modes.

Check completion stamps separately for the selected targets so partial
current-chain outputs cannot hide old libraries. Count each current shader
key once per selected target instead of summing retained historical copies.
Document the count as scheduled base libraries, including cache restores,
and cover interrupted rebuilds, mixed targets and duplicate old caches.

Co-authored-by: v0lumehi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants