Skip to content

Keep shader cache hits when the dump directory changes - #880

Open
Lkxex wants to merge 1 commit into
fxceless:mainfrom
Lkxex:fix/shader-cache-dump-directory
Open

Lkxex wants to merge 1 commit into
fxceless:mainfrom
Lkxex:fix/shader-cache-dump-directory

Conversation

@Lkxex

@Lkxex Lkxex commented Nov 25, 2026

Copy link
Copy Markdown

Problem

VICTORY_EMIT_DUMP selects an output directory for the translation tools. The shader build script also adds it to the translation fingerprint, so changing or clearing that path causes misses in an otherwise reusable shader cache.

Fix

Exclude the dump directory from the generated cache settings list. The regression test checks that the fingerprint excludes the dump directory and still includes VICTORY_SHADER_OPT, which controls emitted DXIL.

Validation

  • The regression test fails on the base commit and passes with this patch.
  • cargo test --locked -p victory-shader passed with 216 tests passing and 3 ignored.
  • git diff --check passed.

AI-assisted change. Validation used the repository's tests without game files.

@avt0m4t48

Copy link
Copy Markdown

I independently checked f85101b6095e8cf3cecf8f0647cc7f5428daa177 against 8d4a671c54fa9ab83254ab1a1623e401299b1f09. I compiled each revision’s unchanged shader_cache.rs with its own shader and pipeline crates and called warm() in separate Linux processes against an on-disk cache. The inputs were two synthetic compute shader containers.

  • Changing VICTORY_EMIT_DUMP to either of two new paths caused a miss on base. On the PR head, both changes hit the entry warmed with the setting unset. Empty and unset paths also hit that entry.
  • Disabling VICTORY_SHADER_OPT still caused a miss and changed the emitted DXIL. A different container still caused a first-use miss. Each fixture emitted identical DXIL across the two revisions at matched settings.
  • The first lookup after upgrading to this PR missed in the shared cache. After that lookup, changing the dump path hit. Running the old binary again still hit the original entry.

The 24 per-revision lookups and five upgrade and rollback lookups matched expectations. Linux victory-shader --lib passed 171 tests at base and 172 at head, with two ignored each. On the head, cargo check --target x86_64-pc-windows-msvc -p victory-shader -p victory-gpu --all-targets --features blake3/pure passed. Native Windows execution and CLI dump-file writing were outside these checks.

@MamaLeVrai

Copy link
Copy Markdown

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head 8d4a671 into main f85101b in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails with exactly the errors main itself has on this machine (placed_filler_twins, depth_written, a sort; PR #841 fixes them), also with --all-features; this PR adds none. cargo test --workspace --locked: run 1: 556 passed, 0 failed, 11 ignored; run 2: 556 passed, 0 failed, 11 ignored (main alone: 555 passed, 0 failed, 11 ignored). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

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.

3 participants