translate: --cache DIR fills the runtime's shader cache #1729
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1730"
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 Marvisak/VIctory. Originally posted by Nixitov on 2026-11-24T21:28:05Z.
What it did
victory translatetranslated every shader in a pack and printed the report, and threw the translations away. The runtime then translated the same containers again the first time a frame asked for them, inside the frame path.What it does now
victory_gpu::shader_cache::store(container, shader)publishes a translation throughvictory-pipeline's cache under exactly the keyhost_shaderreads (this build's fingerprint and the container's bytes) and with the same encoding, so the runtime finds it as a hit.Cache::storeis public now (split out ofget_or_convert, same write-then-rename) so an entry the caller already converted can be published without translating a second time.Container::bytes()is the container cut where its header says it ends. A walk finds containers inside larger files, and hashing the file's tail would key every entry where the runtime never looks, since the runtime passes exactly the container.victory translate --cache DIRopens the runtime's cache and stores one entry per container, for the programemit::translatepicks (the first VS/PS/CS/MS program), which is the one the runtime caches. Duplicate containers, which the report counts once, are still translated and stored as the runtime would. The last line says how many entries were written and where.Measured
RTX 5070, Windows 11 26200.9974, driver 617.14:
victory runagainst that cache: 1,578 hits, 0 misses. The startup pipeline backlog falls from a peak of 652 "being made" to 200 (a run against the same cache a second time).Tested
Base
mainffe310e:cargo build --release -p victory: clean.cargo test --release -p victory-gpu: 52 passed, 1 ignored, includingshader_cache::tests::a_stored_translation_is_what_host_shader_returns(store thenhost_shaderreturns the same DXIL, so both key alike) andentries_round_trip_and_reject_damage.cargo test --release -p victory-shader dxbc: 3 passed, includingbytes_stop_where_the_header_says(a container followed by other bytes hashes only its own).cargo test --release -p victory-pipeline: passed.cargo clippy --workspace --all-targets --locked -- -D warnings, with and without--all-features: clean.victory translate <a container> --cache DIRopens the folder and reports the entries written.No game data.
AI-assisted (DeepSeek V4.1 Flash coding agent).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T21:41:06Z.
Review: APPROVED
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (
ffe310e), cargo test -p victory-pipeline --locked → 5 passed, 0 failed. Windows-gated execution/hardware tests only run on Windows.translate --cache DIR fills the runtime's shader cache: CacheFill::open uses victory_gpu::shader_cache on Windows (with a not(windows) fallback), key_input hashes container+build, store/publish do atomic replace, and two pipeline-cache tests pin store-replaces-without-converting and stored==host_shader output. The bulk of the diff (apps translate CLI, gpu shader_cache, README/docs) is Windows-only; the pipeline cache logic is what macOS verified.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:25:17Z.
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.translate --cache DIRfilling the runtime's shader cache: main has this astranslate --cache(the warm-up, commitc47b5297), with the cache keyed by the translator.If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:35:16Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:README.md,apps/victory/src/main.rs,apps/victory/src/translate.rs,crates/victory-gpu/src/shader_cache.rs,crates/victory-pipeline/src/cache.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
v18446744073709551615folder makes an update lose the save in release builds (follow-up to #1729) #2495Pull request closed