Repository navigation
Conversation
… a successful build Every change to the shader chain translates all shaders again into a new b-<chain> folder, and nothing removed the old ones: a Breath of the Wild build folder held b-157e1b96c8da (2.1 GB) and b-a78f966a7b38 (2.3 GB) besides the current one, and each upstream update added another. build_shaders now calls prune_stale_chains last, after the libraries, their tables, the regression check and the reuse key of the current chain are in place (a reused build prunes too). It removes the b-<12 hex digits> folders of other chains in shader/cache and shader/ios and their keys (ios/b-<chain>.key, mac-b-<chain>.key), and logs one line with the freed size. A build that stops or fails earlier keeps the old libraries. Nothing else reads an old folder: the host and the packers take only the current chain, shader_regressions.py compares with the next chain's predecessor, which is the folder that stays, and the Metal compile cache already took the old libraries in. The compile cache is not touched. Tests in test_nsp_mac.py: two old chains are removed and the current one stays, a failed build and a build without libraries keep everything, other names (cas, a file, a malformed name) stay. Reference entry in docs/reference/shaders.md, the Breath of the Wild note and the symptom index.
Merged
3 tasks done
tmrsm
pushed a commit
to tmrsm/NX2Apple
that referenced
this pull request
Oct 29, 2026
…Free space Every change to the shader chain translates all shaders again into a new b-<chain> folder, and nothing removed the old ones. A Breath of the Wild build folder held two (2.1 GB and 2.3 GB, 4.4 GB together), and each upstream update adds another. Patch 0032 (forwarded as seedds/nxnative#682): after a successful shader build the NSP script removes the b-<old> folders in shader/cache and shader/ios and their keys, and logs the freed size. A failed or stopped build keeps them. The Mac launcher's Free space sheet gets an "Old shader versions" row for folders that were left before this change or by another checkout. It lists the b-<12 hex digits> folders (and keys) that are not the current chain, with their sizes, and removing them costs nothing on the next build. The current chain is DMSH_CHAIN in the checkout's dm/gfx/nvn/dmsh_chain.h, read as the NSP script's chain_of() does. Without it nothing counts as old. The Shader output row stays as it is, and choosing both counts the old versions once. Strings in zh, en and sv, and the Qt table regenerated (the Qt front end has no Free space feature).
seedds
added a commit
that referenced
this pull request
Oct 30, 2026
… a successful build (PR #682) Every change to the shader chain translates all shaders again into a new b-<chain> folder, and nothing removed the old ones: a Breath of the Wild build folder held b-157e1b96c8da (2.1 GB) and b-a78f966a7b38 (2.3 GB) besides the current one, and each upstream update added another. build_shaders now calls prune_stale_chains last, after the libraries, their tables, the regression check and the reuse key of the current chain are in place (a reused build prunes too). It removes the b-<12 hex digits> folders of other chains in shader/cache and shader/ios and their keys (ios/b-<chain>.key, mac-b-<chain>.key), and logs one line with the freed size. A build that stops or fails earlier keeps the old libraries. Nothing else reads an old folder: the host and the packers take only the current chain, regress.py builds its chains in the work folder, shader_regressions.py compares with the folder that stays, and the Metal compile cache already holds what the old libraries compiled. The compile cache is not touched. A folder that cannot be removed (a permission error, a locked file) is a [RED] line, not an error: the build is done, and the next one tries again. Tests in test_nsp_mac.py: two old chains are removed and the current one stays, a failed build and a build without libraries keep everything, a removal that fails keeps the build, other names (cas, a file, a malformed name) stay. Reference entry in docs/reference/shaders.md, the Breath of the Wild note and the symptom index. Co-authored-by: v0lumehi <[email protected]>
Owner
|
Landed on main as 8b06fab, with you as co-author. Thank you: the pruning, its tests and the docs are yours and almost unchanged. One addition: a folder that cannot be removed (a permission error, a locked file) now logs a |
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
… a successful build (PR seedds#682) Every change to the shader chain translates all shaders again into a new b-<chain> folder, and nothing removed the old ones: a Breath of the Wild build folder held b-157e1b96c8da (2.1 GB) and b-a78f966a7b38 (2.3 GB) besides the current one, and each upstream update added another. build_shaders now calls prune_stale_chains last, after the libraries, their tables, the regression check and the reuse key of the current chain are in place (a reused build prunes too). It removes the b-<12 hex digits> folders of other chains in shader/cache and shader/ios and their keys (ios/b-<chain>.key, mac-b-<chain>.key), and logs one line with the freed size. A build that stops or fails earlier keeps the old libraries. Nothing else reads an old folder: the host and the packers take only the current chain, regress.py builds its chains in the work folder, shader_regressions.py compares with the folder that stays, and the Metal compile cache already holds what the old libraries compiled. The compile cache is not touched. A folder that cannot be removed (a permission error, a locked file) is a [RED] line, not an error: the build is done, and the next one tries again. Tests in test_nsp_mac.py: two old chains are removed and the current one stays, a failed build and a build without libraries keep everything, a removal that fails keeps the build, other names (cas, a file, a malformed name) stay. Reference entry in docs/reference/shaders.md, the Breath of the Wild note and the symptom index. Co-authored-by: v0lumehi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Every change to the shader chain translates all shaders again into a new
b-<chain>folder, and nothing removed the old ones. A Breath of the Wild build folder heldb-157e1b96c8da(2.1 GB) andb-a78f966a7b38(2.3 GB) besides the current chain, 4.4 GB of libraries nothing reads, and every upstream update that changes the chain adds another 2 GB per game.build_shadersnow callsprune_stale_chainslast. It removes theb-<12 hex digits>folders of other chain versions inshader/cache(Mac) andshader/ios(iOS), and their keys (shader/ios/b-<chain>.key,shader/mac-b-<chain>.key), and logs one line:removed old shader libraries b-… (N GB). It runs only after the libraries, their tables, the regression check and the reuse key of the current chain are in place, so a build that stops or fails keeps the old libraries. A reused build prunes too, so folders left by earlier builds go at the next run.What reads
b-*folders, and why deleting the old ones is safe:DM_MSL_DIR,nvn_mtl.m),pack_app.py,build_ipa.sh,pso_offline.pyandregress.pytake only the current chain's folder.shader_regressions.pycompares the new build with the newest otherb-*/_b_build.json. That check has run before the prune, and the next chain change compares with the folder that stays, so no report has to be moved.dmsh_build.pytakes the libraries of older folders into the Metal compile cache before it translates. The first build of the new chain has done that already. Only a chain that comes back (an older checkout) compiles again what the cache does not hold.dmsh_mtlcache.py,shader/cache/cas/metallib) is not touched. It is keyed by the MSL text and the compiler, not by the chain, so entries are shared across chains. It grows only with new MSL, and no code removes an entry, so it is not bounded.Reference entry: Old shader library folders grew a game's build folder with each chain change. It is linked from the Breath of the Wild note, and the symptom index is updated.
Checked
dm/tools/tests/test_*.pypass. New intest_nsp_mac.py: two old chains removed and the current kept, a failed build and a build without libraries keep everything, other names (cas, a file, a malformed name) stay.dm/tools/lint_python.py: 0 new findings.Docs
docs/reference/shaders.mdentry and the game note, andpython3 dm/tools/docs_symptoms.pywas run (the symptom index)