Shader cache key hashes the whole Cargo.lock: any dependency change makes the next launch cold #334
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T12:23:22Z.
Summary
victory-shader/build.rsfolds the whole workspaceCargo.lockintoVICTORY_SHADER_SOURCE_HASH, which keys the native shader disk cache (shader_cache::build). So adding or bumping a dependency anywhere in the workspace (an app crate, a test-only crate) invalidates every cached translation, about 16,000 shaders, even though the translator did not change. The next launch is then a cold start: the prewarm pool translates everything again for the first ~50 s, and the boot stutters (#332).I hit this by adding one path dependency to
apps/victory: the next run translated 3,483 shaders before the story load, against 0 on the run before.Proposed change
Hash only what the translator is built from: its own sources and manifest,
build.rs, the rustc version, and theCargo.lockentries of the packagesvictory-shaderdepends on (its dependency closure), not the whole lock file. Bumping a crate the translator uses still changes the key. Changes elsewhere in the workspace no longer do.I'd like to take this one and will send a PR.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T12:23:26Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T12:23:48Z.
Claimed by @derz92. Open a draft pull request with
Refs #334in its description within 24 hours, or the claim expires.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-28T00:35:41Z.
Thank you, and thanks to derz92 for the fix. The shader cache key now hashes only the lock entries of the packages victory-shader depends on, not the whole Cargo.lock (#342, on main), with unit tests in lock_tests.rs. I have not measured a cold start myself. Closing. Please tell me if adding an app-only dependency still makes the next launch cold on
a6a58361.