shader cache: victory shaders and translate --warm report shaders as cached when there is no cache #291
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD#291
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?
@itsonewi on GitHub · 2026-11-26 19:16 UTC · original
What happens
crates/victory-gpu/src/shader_cache.rs:161-171answers "this translation was already in the cache" with a counter that only moves when a cache exists:MISSESis bumped only insidecached_by, on a real miss (:262-274). In theNonearm (:167) the container is translated, butMISSESis left alone, so:170returnsOk(true)— "it was there already" — for a translation that just happened.That arm is reachable in ordinary use:
use_shader_cache(:61-67) swallows a failedCache::openwithtracing::warn!("no shader cache")and runs on withCACHEempty (cache folder on a read-only or full volume, a path that is a file, a locked or undeletable folder...). Both callers ofprecompilethen report success for work that was thrown away:victory shaders—apps/victory/src/translate.rs:436-440counts everyOk(_)towardsdoneand prints"{done} shaders in the cache"(:468).victory translate --warm—crates/victory-hle/src/modules/d3d12x.rs:71-74turns the answer inside out (|was_there| !was_there, soOk(false)means "in the cache already"), andapps/victory/src/translate.rs:227/:231print it as "{translated} translated now, {there} in the cache already".So with no usable cache folder, both commands finish with a clean summary — "N shaders in the cache", or "0 translated now, N in the cache already" — while nothing was written and the next run translates every one of them again. The only hint is one
warn!line fromuse_shader_cache, far from the summary that contradicts it.Why it matters
The whole point of
victory shadersand--warmis that the run after them finds its shaders translated. A run that says it filled the cache and did not costs the user the same warm-up twice (minutes to tens of minutes), with the tool's own output as the reason to believe it worked.Suggested fix
Count the translation in the
Nonearm as well, or returnOk(false)there, so that "was there already" means exactly that. A shader translated without a cache should show up as "translated now" (andvictory shadersshould not count it as in the cache). Reporting aCache::openfailure once at the end of the run, next to the counts, would make the cause visible.AI use
Found by reading
crates/victory-gpu/src/shader_cache.rs,crates/victory-hle/src/modules/d3d12x.rsandapps/victory/src/translate.rs. Nothing was built or run (no Windows build or GPU here), so the no-cache path was traced in the source, not reproduced.github-bot referenced this issue2026-11-26 19:49:18 +00:00
--jobs 0translates nothing and still reports success, while--warmandvictory warmsilently make it one worker #311@TinkerBell-90 on GitHub · 2026-11-26 21:03 UTC · original
I tried this on
a-publieratcd8dfc0and could not get the summary described here: theNonearm ofprecompileis not reached fromvictory shadersortranslate --warm.Both commands call
cfg.cache_subdir("shaders")?beforeuse_shader_cache(apps/victory/src/translate.rs:180and:413), andsubdir(crates/victory-core/src/config.rs:134) does the same two steps asCache::open(crates/victory-pipeline/src/cache.rs:37) on the same directory:ensure_outside_repo, thencreate_dir_all. Whatever would makeCache::openfail has already failed incache_subdir, and the command stops there with that error. SoCACHEis set whenever these two commands get to translate, unless the folder changes between the two calls.Run on Linux: the app built for
x86_64-pc-windows-gnu, under Wine 10 + vkd3d-proton on an RX 9070 XT (RADV). Not Windows. The input is one container made with the test helpers ofnative.rs(a pixel shader that is onlys_endpgm); no game files, nothing run in game.victory shadersvictory translate --warm all1 shaders in the cache, exit 01 translated now, 0 in the cache already, exit 0; on the foldervictory shadersfilled:0 translated now, 1 in the cache alreadyVICTORY_CACHE_DIRis a fileError: creating ...\shaders(os error 183), exit 1shadersexists, read-only0 shaders in the cache, 1 do not translate, reasonAccess denied. (os error 5), exit 00 translated now, 0 in the cache already, 1 do not translate, exit 0No run claims a shader is in the cache when it is not.
Ok(false)in theNonearm would still be right for a future caller, but it changes nothing these two commands print today.What does mislead is the last row. The shader translated, the write failed, and both commands count it under "do not translate".
victory shadersat least shows the reason;--warmdrops it (Err(_) => 2,translate.rs:218), so all the user sees is "1 do not translate" and exit 0. If anything here needs a fix, it is that: keep the reason in--warmasvictory shadersdoes, or tell a cache write error apart from a translation refusal.AI-assisted.