Shader cache: an entry another thread published meanwhile is taken (port of Marvisak#1324) #664
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/664"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T03:02:05Z.
The problem
Cache::get_or_convert(crates/victory-pipeline/src/cache.rs) is the shader cache's store (victory-gpu/src/shader_cache.rs). It writes a translation to a staging file and renames it over the content-addressed entry.Sometimes another thread or process (the pipeline makers, or
victory warm's processes) has finished publishing the same entry in the meantime and still holds it open. Windows then refuses the rename, with access denied or a sharing violation.That error came back as the translation's.
shader_cache::host_shaderpasses it on, so the shader was taken as one that does not translate, and its pipelines' draws were dropped for the run.The change
If the rename fails, the staging file is removed. When the entry is now there, it is taken. When it is not there, or is not a file, the error is still given. A write that fails before the rename is still an error, as before.
This is a port of mgunes1311-lab's fix (Marvisak/VIctory#1324). It applied cleanly.
Tests
cache::tests::accepts_entry_published_concurrently_while_open, which comes with the port. During the conversion, the test publishes the same entry and holds it open in read share mode, so the rename is refused. Before the change it fails withAccess denied (os error 5).cargo test -p victory-pipeline --locked: 8 passed. That includesfailed_publication_removes_the_staging_file, which still passes.cargo clippy -p victory-pipeline --all-targets -- -D warnings: no warnings.No game files, dumps or extracted data are included.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T05:35:39Z.
Review: APPROVED
LGTM — verified on Windows:
cargo test -p victory-pipelinepassed (8/8, includingaccepts_entry_published_concurrently_while_open)cargo clippy -p victory-pipeline --all-targets -- -D warningspassed with 0 warningscargo xtask policypassed (294 files ok)Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).