fix(vk): a game started by itself keeps the program cache prepared in another shader store #2768
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2768
Loading…
Reference in a new issue
No description provided.
Delete branch "klimovich008/Longshot:perf/shader-store-self-start"
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?
Summary
Why: a game folder whose shaders the builder prepared loses every prepared program the first time its game is started without
LONGSHOT_SHADER_STORE. Since #2629 / #2632 the builder prepares into<builder cache>/shader-storeand passes that folder to the game it starts; the game started by itself opens the older default store (%LOCALAPPDATA%\Longshot\shaders,~/.cache/longshot/shaders), sees that the program cache names another store, and starts the cache over ("its programs are in another shader store ...: prepared again"). On our day's build that cost a 41.8 s frame on the first Market visit.Who meets it: a player's version folder does not, because its game hands over to the builder when started by itself (
hos_main.chand_over), and the launcher andlongshot-builder playpass the variable. It is the folders with no builder above them: a developer'sdev build --out,scripts/dev_packs.pyruntimes,longshot_bridgesessions, the Test Farm's runs, a game folder copied somewhere else. So this is hardening for players plus a live bug fix for those folders, and it also makes such runs' measurements valid again (ours lost the cache in every fresh runtime and had cold arms in A/Bs).How to see it on main: prepare a folder with the builder (
LONGSHOT_CACHEset, so it prepares into the builder cache'sshader-store), then start the game executable directly with noLONGSHOT_SHADER_STORE. The log says "its programs are in another shader store (ae068cab, this one f8a742eb): prepared again",cache/longshot_programs.binis cut to an empty cache, and every program is translated again at its first draw.What changes (
gpu/vk/vk_progcache.cpp,disk_initand two helpers):cache/longshot_shader_store_ref.txt: one line, the store's id and its absolute folder, through a temporary file and a rename, only when it changes.LONGSHOT_SHADER_STOREreads that record before it picks a store:CompareStringOrdinal), so aLOCALAPPDATAspelled in another case is still the default.LONGSHOT_SHADER_STOREset to a folder, or=0, behaves as before and wins over the record. No new switch: it is a fix.docs/dev/reference/architecture.md(the store paragraph),switches.md(theLONGSHOT_SHADER_STORErow); contract comments invk_progcache.cppandspirv_pack.h(comment only).tests/test_program_cache_store_record.pywithtests/program_cache_store_record_test.cppbuilds the realdisk_init, cut from the source, with the realspirv_pack.h, one process per start;tests/test_spirv_pack.py's anchor follows the keep line's text.Shader caches: neither
vk_progcache.cppnorspirv_pack.his in the shader-cache stamp (builder/crates/build-compile/src/generated/shader_stamp.rs: eden, sirit, compat,vk_shader.cpp,vk_bank.cpp,vk_state.h, checked on current main), andkProgramCacheFormatstays 3. An update keeps every translated program; in the game this PR's DLL kept all 47,867 of the base's program keys. The builder's preparation step runs again after the update, as for every renderer change.Entry paths: the launcher and
longshot-builder playpass the variable (game_env/configure_store): main's behaviour, plus the record written. A version folder's game started by itself hands over to the builder: the same. A direct start with no builder above: the record.--updateand Linuxupdate-gameare gone on main since #2762 (the launcher owns updates); an update in place keepscache/and with it the record.Read first:
disk_initingpu/vk/vk_progcache.cpp, thenstore_record,open_recorded,same_recorded_nameandwrite_store_record.#737 proposed
cache/longshot_shader_store.txtfor a different format. This PR usescache/longshot_shader_store_ref.txt. #2410 tracks the cold start after deleting the default store.The follow-up bounds implicit recorded-store lookup to 750 ms. If that custom store is missing, unreadable, or too slow, startup releases the original cache's lock and opens a separate writable fallback cache. The fallback uses the default store when available and inline SPIR-V otherwise. A returning store can still reopen the original cache. An implicit lookup checks the generation under the store lock before opening it, so it cannot recreate a custom store that was cleared during the lookup. Warm/seed cache transfers carry the record and the fallback artifacts.
The Windows regression fixture uses the game's UTF-8 manifest and changes the case of only a test-owned directory component. The record name ends in
_ref.txtto distinguish it from the format proposed in #737.Testing
Tested: Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2, in the game (Market, child, 16:9, uncapped, through our harness's fresh runtimes of a player-like build of main
22d0d2009with this PR'slongshot_vk.dllover it):longshot_programs.bin,longshot_programs.idxand the record byte-identical after the run;LOCALAPPDATApointed at a job folder): made again, the cache started over, warm at the next start.The numbers are under Measurements. Game-free:
python -I tests/test_program_cache_store_record.py --cxx <clang++>: on Windows (llvm-mingw clang++ 20261104) PASS, 22 broken variants fail as they must, 9 not run (Linux-only cases); on Linux (WSL Ubuntu, clang++ and g++, as a non-root user) PASS, 29 broken variants fail with each compiler, 2 not run (Windows-only). Each variant is credited only by the case it targets.vk_progcache.cpp(--source): fails (19 checks), as it must. Its deleted-default cases pass there, as they must (main's behaviour).8cc807971: the new test (Windows),test_spirv_pack,test_program_cache_{index,format,reader,cleanup,one_variant},test_descriptor_array_census,test_load_default,test_dev_packs,test_run_all_declarationspass (test_utf8_pathsskipped here: no cargo);linux_syntax.sh gpu/vk/vk_progcache.cppok;mise run lintpasses.tests/run_all.py --jobs 4on the merged heade7e905695: 682 passed, 24 failed, 186 skipped. All 24 fail on main on this Windows PC too: the 20 that failed on main22d0d2009in the checker's run (among themtest_switch_table:LONGSHOT_LAUNCHER_STARTUPhas noswitches.defrow), andtest_log_batch,test_log_levels,test_dev_update,test_windows_on_linux, which fail the same way on main @8cc807971here. None readsvk_progcache.cpp.Follow-up at
b1717e29: the Linux game-free regression passes with a bounded lookup on a locked store, a warm fallback on repeat launch, and the original program cache restored when the custom store becomes available. The developer cache transfer and shader-store tests passed; the full Linux renderer built against the shared base. The headless game smoke on Linux (RTX 3090, NVIDIA driver 620.70.06) confirmed custom store selection, missing-store fallback, return to the original cache after restoration, and default store recreation after a clear. The seeded program cache did not match this renderer’s translator, so the positive warm-key count was verified in the synthetic regression fixture. The builder eviction fixture also verified the live fallback lock. Windows runtime verification of the revised paths is still outstanding.Still to test:
longshot-builder dev build ... --cache <dir>, orLONGSHOT_CACHEset, so the store is<cache>/shader-store), start it once through the builder, then start the game executable directly with noLONGSHOT_SHADER_STORE, expecting "the one the cache's longshot_shader_store_ref.txt names" in the log, the program keys kept and no "another shader store" line (by hand, on the Steam Deck or a Linux PC: the Test Farm's plan steps can't set up the folders, environment and files this needs, its comment says)~/.cache/longshot/shaders), delete that folder and start the game directly twice, expecting at the first start "prepared again" with the store made again and the record naming the new store, and at the second the keys of the first start kept (by hand, on the Steam Deck or a Linux PC: the Test Farm's plan steps can't set up the folders, environment and files this needs, its comment says)Measurements
Verdict: the bug's case goes from a cache emptied at the first start (582 programs translated in the first Market visit, a 41.8 s frame) to every prepared program kept (0 translated). No per-frame cost: the Market A/B is within noise, diagnostic with 3 pairs. The change runs once at start-up.
Setup: Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2; a player-like build of main
22d0d2009(longshot.exe992fc0fd,longshot_vk.dlla1af7a34) prepared by the builder; this PR as itslongshot_vk.dllalone over that build. Market, child, 16:9, uncapped (HOS_FPS_MAX=240), render thread on, 20 s window after the arrival; fps, CPU ms a frame and p99 are the window's; "translated in play" counts programs translated after the load started. Each table names the head it ran on. The last two rounds (dd9bfd0bf) changed only the Windows case comparison of the default store's name and the docs, and were not run in the game. The branch now has main @8cc807971merged in; main's commits since22d0d2009change neithervk_progcache.cppnorspirv_pack.h(the builder, the host's log folder, other renderer passes), so the start-up numbers still hold; the A/B was not run again.The bug's case and the record
LONGSHOT_SHADER_STORE22d0d200910d00286dOld folders, deleted stores, a store out of reach (cold-then-warm runs; each start a fresh run through the harness, with no variable)
22d0d200910d00286d(first three) /17c1c6f86(last three)LOCALAPPDATA), the record naming it: first startThe deleted-default runs redirected the AMD driver's own caches with
LOCALAPPDATAtoo, so their numbers show behaviour, not speed.The standard A/B (Market, child, 3 alternating pairs, both arms warm through the variable: 47,867 keys, 0 translated in every run, all 6 runs admitted)
22d0d200984e9cb9f3-0.9 % fps and +1.2 % CPU ms: within Market's run-to-run spread on this PC (about 3 % fps and 5 % CPU ms with 3 pairs), so diagnostic, and no cost is seen. The code runs once in
disk_init(one small read, two 16-byte head reads, a write when the record changes) and nothing per frame. The A/B ran at the first round's head; the later rounds changed only start-up branches.Risks
LONGSHOT_SHADER_STORE). Main dropped the cache once and was warm from the next start. A start without the cache translates every program again at its first draw (about 1,200 in a first Market visit here, 9-19 s of translation, multi-second frames). The log line names the store the cache wants. Who meets it: a folder prepared against a store on a drive that is not mounted, or a custom store deleted while the cache stays.LONGSHOT_SHADER_STOREset by hand restores main's choice for a run; a revert is enough.Not covered (each from the reviews or the checks, left because no player's or harness path reaches it):
LONGSHOT_SHADER_STOREat the preparation, then deleted: kept as a custom store out of reach every start, where main makes the default again (sol r16). No builder or launcher path names it so.XDG_CACHE_HOMEspelled through a..over a folder later removed, under a link: the same class as the bind mount (sol check-r3).CompareStringOrdinal's: NTFS volumes with XP-era or Vista-era$UpCasetables, exFAT's final sigma. Two names it calls one, or one it calls two, when a folder is missing (sol r20, r22).TEMPis inside a folder made case-sensitive:default-caseswaps the case of all ofLOCALAPPDATAand fails on a correct tree (sol r23).TEMPoutside the ANSI code page breaks its arguments; the shipped game is unaffected (sol check-r2, point 7).Store::openremakes it, as for a named store); special files or links inside a store folder; an unmount between the probe andStore::open; a cache replaced by another tool between the two head reads; a link retargeted since the record; a lock file that cannot be opened (two starts at once, fail-open as main) giving a record of another store, then taken as none; restored-store snapshots and seed-index pairing; the 4 KB record limit and the head-reread race untested; the test fixtures' 2^-32 id collisions; the guard that skips writing after a failed second read while out of reach is in the code but has no case of its own.flock()leaks its descriptor until exit; a start that holds the lock but cannot open the cache for append keeps the lock with the cache off.LOCALAPPDATAstood in), the Windows case-spelling fix in the game (game-free only; the final head's other code paths ran in the game at earlier heads, see Measurements).Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2, Market (child): a builder-prepared folder started with no LONGSHOT_SHADER_STORE kept all 47,867 program keys and translated 0 programs in play (main: the cache started over, 582 translated in the first Market visit, a 41.8 s frame); an old folder with no record behaved as main (one cold start, then warm); a record naming an unreachable store left the cache files byte-identical; a deleted default store was made again, then warm. The Market A/B (3 pairs) is within noise. Runs at heads
84e9cb9f3,10d00286dand17c1c6f86; the last rounds changed the Windows case comparison and docs only.@Beanstalk linux, any GPU (the Steam Deck if free), this PR's head. Two start-up cases this PC can't run (Windows here; Linux was only tested game-free). Uncapped and windowed if a run is timed:
frame_rate_cap = 6,vsync = 2,frame_generation = 0. No A/B is needed: the change runs once at start-up.LONGSHOT_CACHEset:<cache>/shader-store). Start it once throughlongshot-builder play(it passesLONGSHOT_SHADER_STORE), then quit. Then start the game executable directly, with noLONGSHOT_SHADER_STOREin its environment, and walk into Market. Expected:cache/longshot_shader_store.txtexists after the first start: one line, an 8-hex id and the absolute store folder;shader store: the one the cache's longshot_shader_store.txt namesand has noanother shader storeline;~/.cache/longshot/shaders; a folder started directly once with no variable and no builder cache writes that), quit, delete~/.cache/longshot/shaders, then start the game directly twice with no variable. Expected:its programs are in another shader store (...): prepared again, the store made again under~/.cache/longshot/shaders, and the record naming the new store's id;another shader storeline, the program keys of the first start kept.Please attach both starts'
longshot_log.txt(ordiagnostics/logs/) and the record file's contents.Beanstalk test farm · an earlier run: commit
e7e9056, run 2 (the newer results are in a comment below)Commit
e7e9056· approved by klimovich008 (reviewed) · dashboardDone (started 2026-11-28 22:40 UTC, last report 02:54 UTC). Run 2: re-planned by klimovich008. Comment
@Beanstalkto run it again.anyWhy it failed
any:hyrule-fieldfield.frametime_p99_ms.max_delta_pct:39.8 → 48.4 (+21.6%); limit 15.0Couldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.
any, report 2:Insufficient frame-time evidence for 2 required comparison(s). See rule results.What was tested
What will be tested · default plan (AI failed: the summary says 'manual': the farm is unattended, so it must describe only what the plan's steps do (no one looks at, checks or does anything by hand); write it again)
The AI plan failed: the summary says 'manual': the farm is unattended, so it must describe only what the plan's steps do (no one looks at, checks or does anything by hand); write it again; using the default plan.
kokiri-start, then teleport to Hyrule Field, measure field for 60 s (after 10 s warm-up); 2 runs on each side.Measurements on `any`, for the PR description
Verdict: fail on any (2 reports):
hyrule-field field.frametime_p99_ms.max_delta_pct (+21.6%)failed.Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+xess
NVIDIA GeForce GTX 980, 582.78.0Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 32 GB RAM; 2: windows+intel+intel-proprietary+igpuIntel(R) UHD Graphics 630, 0.404.2115Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAMScene: title, from the title screen; hyrule-field, from the repository's save kokiri-start; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side, title 20 s after 5 s warm-up; hyrule-field: 2 game starts a side, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)8cc8079e7e9056Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
The testers' hardware
anyNVIDIA GeForce GTX 980, 582.78.0Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 32 GB RAManyIntel(R) UHD Graphics 630, 0.404.2115Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM@Beanstalk test it anyway: the alternative plan (a Market start of this PR and of main on Linux and the Steam Deck, failing on a crash, noting the store's start-up lines) is useful as a Linux start-up check. The two sequences move to Still to test as by-hand runs.
@review
Recommendation: Request changes. The fix preserves prepared programs in the reported Windows case, but an unreachable recorded store can block Linux startup or cause shader compilation on every direct start. The Linux game paths also still need validation.
A direct start can reuse the builder's shader store and prepared program cache. The added record and probing logic preserve that cache when its store is unavailable, but can leave affected runs cold indefinitely or block on an offline filesystem.
Blocking (2): must change before merging.
gpu/vk/vk_progcache.cpp:399: The synchronous probe can hang startup indefinitely on an unavailable hard-mounted network store. (more on the line) Do: Avoid putting an unbounded remote-filesystem probe on the startup path; arrange a bounded or asynchronous lookup with a usable fallback.gpu/vk/vk_progcache.cpp:533: Deleting a recorded custom store leaves every subsequent direct start without a disk cache, with no automatic recovery. (more on the line) Do: Keep the original cache for a potentially returning store, but use a separate writable fallback cache and default store when it is unavailable, so later starts can be warm.Should fix (2): not blocking, but worth doing before merging.
tests/program_cache_store_record_test.cpp:58: The Windows fixture does not use the game's UTF-8 process configuration, so the new check fails for some valid temporary paths. (more on the line) Do: Give the fixture the same UTF-8 manifest as the game, or accept wide arguments and convert paths consistently to UTF-8.tests/test_program_cache_store_record.py:401: The Windows case-fold test changes the case of the entire temporary path, including potentially case-sensitive ancestors. (more on the line) Do: Change the case only of a test-owned component known to be case-insensitive, or skip this case when its ancestors are case-sensitive.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_progcache.cpp:526: The Linux game paths for selecting the recorded store and recovering a deleted default store have not yet been exercised. (more on the line) Do: Run the two documented direct-start sequences in game on Linux or Steam Deck and report the cache and log results.@fixcan do L1, L2, L3 and L4.Questions (1) (not confirmed from the code; they don't hold the recommendation)
Checks: Failing on this head, which is behind its base, where they pass:
CI / Third-party parts and guide screenshots (pull_request),CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request),CI / Website build and checks (pull_request),CI / Game-free checks (run_all.py, part 1/2) (pull_request).@rebase(or@fix) brings it up to date and runs them again; not held against it. Still running:CI / Game-free checks (run_all.py, part 2/2) (pull_request).More: does it help, other systems, switches, what was read
Does it help: Yes: the author's Windows game run kept 47,867 prepared keys and translated none in Market; main discarded the cache and translated 582 programs on the next Market visit, including a 41.8-second frame. The three-pair warm A/B was within the reported noise. Linux game validation remains outstanding.
Other systems: The selection runs at cache initialization on Windows and Linux, independently of GPU vendor. Windows AMD was tested in game; Linux and Steam Deck were tested only through game-free checks, and Windows NVIDIA and Intel remain untested. An offline hard-mounted Linux filesystem can block the new probe.
Switches: No switch added or removed. LONGSHOT_SHADER_STORE remains authoritative when set; when unset, its default selection now first consults the cache's record.
Reviewed:
e7e905695bagainst8cc8079713: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the renderer diff and surrounding cache/store code, the new C++ fixture and test harness, documentation and test diffs, and commit history. The checkout has no docs/review-checklist.md or adjacent Tooling AGENTS.md. Skimmed the long test's individual variants and the unchanged remainder of the renderer and store files; no generated files or recorded runs were added.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no builds, tests or project scripts were run. The PR reports Windows game runs and Linux and Windows game-free checks; one head CI check is still running.
Overlaps and merge order: #737 proposes the same record filename with different contents; coordinate the filename before both merge.
Automated code review by BeanBot (gpt-6.1-terra), asked for by klimovich008. Nothing was run; a maintainer decides.
@ -236,0 +396,4 @@return ec ? -1 : st.type() == want ? 1 : 0;};const int pack = at(dir / "spirv.pack", fs::file_type::regular);if (pack < 0) return RecordedStore::unknown;L1 (blocking): The synchronous probe can hang startup indefinitely on an unavailable hard-mounted network store.
When: A direct-start folder has a valid record pointing to a Linux hard-mounted NFS store whose server is offline. The filesystem status or head read waits for the server before disk_init can fall back; main never accessed that custom path.
Do: Avoid putting an unbounded remote-filesystem probe on the startup path; arrange a bounded or asynchronous lookup with a usable fallback.
@ -277,0 +523,4 @@!ec));} catch (const std::exception&) {}}L5 (should fix): The Linux game paths for selecting the recorded store and recovering a deleted default store have not yet been exercised.
When: A Linux or Steam Deck direct start may encounter filesystem behavior that the synthetic WSL fixture does not reproduce; the submitted game evidence covers Windows only.
Do: Run the two documented direct-start sequences in game on Linux or Steam Deck and report the cache and log results.
@ -277,0 +530,4 @@record_unknown = at == RecordedStore::unknown;}// (a recorded store outside the default folder out of reach this run, not known to be gone: no store at all, not even// the default. The file is then kept below, as for a store that did not open, for the start that reaches the storeL2 (blocking): Deleting a recorded custom store leaves every subsequent direct start without a disk cache, with no automatic recovery.
When: A copied game folder's recorded builder cache is permanently deleted. Each start classifies the missing pack as unknown and returns without writing a cache, so every session recompiles shaders; the reported run translates about 1,200 programs with multi-second frames, whereas main becomes warm after one cold start.
Do: Keep the original cache for a potentially returning store, but use a separate writable fallback cache and default store when it is unavailable, so later starts can be warm.
@ -0,0 +55,4 @@spirv_pack::Store s;if (!s.open(argv[2])) return std::puts("FAIL: the store did not open"), 1;const uint32_t w[4] = {0x07230203, 0x00010000, 1, 2};if (s.put(w, 4) < 0) return std::puts("FAIL: no blob put"), 1;L3 (should fix): The Windows fixture does not use the game's UTF-8 process configuration, so the new check fails for some valid temporary paths.
When: When TEMP contains characters outside the active Windows ANSI code page, Python passes the Unicode path to the fixture, but its narrow argv and file APIs cannot represent it; store creation or startup fails before the behavior under test is checked.
Do: Give the fixture the same UTF-8 manifest as the game, or accept wide arguments and convert paths consistently to UTF-8.
@ -0,0 +398,4 @@check("the default with LOCALAPPDATA as it is: the record written (the case below needs it)",recorded(c, b, c.default), c.record())shutil.rmtree(c.default)other_case = "".join(ch.swapcase() if ch.isascii() else ch for ch in c.env["LOCALAPPDATA"]) # (ASCII only)L4 (should fix): The Windows case-fold test changes the case of the entire temporary path, including potentially case-sensitive ancestors.
When: If TEMP is inside a case-sensitive directory, swapping an ancestor's case points LOCALAPPDATA at a different or missing path, so the test fails even when the default-store comparison is correct.
Do: Change the case only of a test-owned component known to be case-insensitive, or skip this case when its ancestors are case-sensitive.
Beanstalk test farm
Commit
d132f22· approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.@review
Recommendation: Request changes. A recorded network store can block startup indefinitely, and a deleted custom store leaves direct starts repeatedly rebuilding shaders without automatic recovery. The Windows test fixture also still fails on some valid temporary paths.
The change preserves prepared program caches when a game is started directly and carries the store record with development cache transfers. It adds startup file probing and can leave a game without a disk cache when its recorded custom store is unavailable.
Blocking (2): must change before merging.
gpu/vk/vk_progcache.cpp:399: The synchronous probe can hang startup indefinitely on an unavailable hard-mounted network store. When: A direct-start folder has a valid record pointing to a Linux hard-mounted NFS store whose server is offline. The filesystem status or head read waits for the server before disk_init can fall back; main never accessed that custom path. Do: Avoid putting an unbounded remote-filesystem probe on the startup path; arrange a bounded or asynchronous lookup with a usable fallback.gpu/vk/vk_progcache.cpp:533: Deleting a recorded custom store leaves every subsequent direct start without a disk cache, with no automatic recovery. When: A copied game folder's recorded builder cache is permanently deleted. Each start classifies the missing pack as unknown and returns without writing a cache, so every session recompiles shaders; the reported run translates about 1,200 programs with multi-second frames, whereas main becomes warm after one cold start. Do: Keep the original cache for a potentially returning store, but use a separate writable fallback cache and default store when it is unavailable, so later starts can be warm.Should fix (2): not blocking, but worth doing before merging.
tests/program_cache_store_record_test.cpp:58: The Windows fixture does not use the game's UTF-8 process configuration, so the new check fails for some valid temporary paths. When: When TEMP contains characters outside the active Windows ANSI code page, Python passes the Unicode path to the fixture, but its narrow argv and file APIs cannot represent it; store creation or startup fails before the behavior under test is checked. Do: Give the fixture the same UTF-8 manifest as the game, or accept wide arguments and convert paths consistently to UTF-8.tests/test_program_cache_store_record.py:401: The Windows case-fold test changes the case of the entire temporary path, including potentially case-sensitive ancestors. When: If TEMP is inside a case-sensitive directory, swapping an ancestor's case points LOCALAPPDATA at a different or missing path, so the test fails even when the default-store comparison is correct. Do: Change the case only of a test-owned component known to be case-insensitive, or skip this case when its ancestors are case-sensitive.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_progcache.cpp:526: The Linux game paths for selecting the recorded store and recovering a deleted default store have not yet been exercised. When: A Linux or Steam Deck direct start may encounter filesystem behavior that the synthetic WSL fixture does not reproduce; the submitted game evidence covers Windows only. Do: Run the two documented direct-start sequences in game on Linux or Steam Deck and report the cache and log results.@fixcan do L1, L2, L3 and L4.Since the last review (on
e7e905695b)Still open: L1 (The synchronous probe can hang startup indefinitely on an unavailable hard-mounted network…); L2 (Deleting a recorded custom store leaves every subsequent direct start without a disk cache…); L3 (The Windows fixture does not use the game's UTF-8 process configuration, so the new check…); L4 (The Windows case-fold test changes the case of the entire temporary path, including potent…); L5 (The Linux game paths for selecting the recorded store and recovering a deleted default sto…)
Checks: Failing on this head, which is behind its base, where it passes:
CI / Third-party parts and guide screenshots (pull_request).@rebase(or@fix) brings it up to date and runs it again; not held against it. Still running: 7 checks.More: does it help, other systems, switches, what was read
Does it help: Yes: the reported Windows game run kept 47,867 prepared keys and translated no programs in play; the comparison on main lost the cache and translated 582 programs on the next Market visit, with a 41.8-second frame. The warm-cache A/B was within reported noise.
Other systems: The store selection affects Windows and Linux startup, including development runtimes and copied game folders. Windows was exercised in game and both platforms in game-free tests; Linux in-game behavior remains untested.
Switches: No switches added, changed, or removed. LONGSHOT_SHADER_STORE continues to override the record.
Reviewed:
48fa6ef230against8cc8079713: Read the repository rules and PR template, the changed cache-transfer lines and surrounding copy and runtime logic, the recorded-store selection code, and the relevant Windows fixture and case-fold test. The remaining changed code, tests, and documentation were not read in full; recorded runs and CI results were reviewed from the PR.; nothing run (a code review).Checked and fine:
Testing: No commands that execute project code or tests were run. The PR reports Windows in-game testing and Windows and Linux game-free tests; Linux in-game coverage remains outstanding.
Overlaps and merge order: PR #737 also proposes cache/longshot_shader_store.txt with different contents; coordinate the filename before both merge.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
85b81519f7d132f228edWIP: fix(vk): a game started by itself keeps the program cache prepared in another shader storeto fix(vk): a game started by itself keeps the program cache prepared in another shader store