shader: key cached translations on the translator's own dependencies, not the whole Cargo.lock #342
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/342"
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-27T13:04:45Z.
What this changes
Refs #334.
VICTORY_SHADER_SOURCE_HASH, the build key of the native shader disk cache, no longer hashes the whole workspaceCargo.lock. It takes the lock entries (name version source checksum) of the packagesvictory-shaderdepends on, directly or not, and still takes the translator's sources, manifest, build script and the rustc version. Bumping a crate the translator uses still changes the key; a dependency added or bumped elsewhere in the workspace no longer makes the next launch a cold start.The lock reading is in
crates/victory-shader/lock.rs.build.rsincludes it, and so does a test module (src/lock_tests.rs).lock.rsitself is hashed.cargo:rerun-if-changedstill watchesCargo.lock, so the key is recomputed whenever the lock file changes, and stays the same unless the translator's part of it changed. docs/native-host.md says what the key holds.How it was tested
ef9a2da70d8d8b55before and after adding a path dependency toapps/victory(which changesCargo.lock). On main the same edit changed the key, and the next run translated 3,483 shaders before the story load where the run before translated none. The boot stuttered for about 50 s (#332 has the pacing numbers).cargo test -p victory-shader: 357 passed. New:lock_tests::the_key_takes_the_translator_s_dependencies_only(a synthetic lock file: an app's dependency changing leaves the entries alone; a dependency of a dependency changing, in a lock holding two versions of it, changes them), andthe_workspace_lock_file_names_the_translator_s_dependencies(the real lock file givesminiz_oxideandthiserror, and notvictory-shaderitself).tests::test_modules_are_test_onlypasses with the new*_tests.rsmodule.cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory: all pass excepthost_posix::ucrt::tests::dlls_that_are_not_the_c_runtime_are_left_alone, which fails the same way on main at86786a72.cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warningscargo xtask policyChecklist
VICTORY_*variable and documented (none)Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T16:05:17Z.
Merged in
be7dc1b5with the other shader PRs from tonight. Ran the tests (native arm64), Windows clippy, the policy check and a release build on the merged tree, and swept my full corpus of 21,600 shaders before and after: 0 lost, 352 newly translated, every changed output accounted for. I have not run the game on it yet. Thanks.