fix(game): what the game decided on this PC stays beside the settings, and a loose cache that cannot move is deleted #345
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
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!345
Loading…
Reference in a new issue
No description provided.
Delete branch "lndf/Longshot:fix/game-layout-followup"
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?
Type: fix · Risk: low · Tested on: Linux, RX 7800 XT (RADV); Windows · Needs: none
Why
#321 put
longshot_driver_faults.txtincache/, and the README says that folder can be deleted. A player who clears it to fix something loses the list of shaders their driver faulted on, and the game asks the driver for them again. On AMD's Windows driver one such shader froze the game (issue 996). This follow-up to #321's review also deletes a loose cache that can never move (several GB lying in the game folder for good), and fixes docs whose commands point at the old place.See #321
How to reproduce
Seen on: any system,
mainwith #321Settings and switches: defaults
Steps: on a PC whose driver faulted on a shader (
longshot_driver_faults.txtin the game folder'scache), deletecacheas the README says you can, then start the game.Expected: the faulted shaders stay left out, as the driver-faults list said.
Actual: the list went with
cache, so the game asks the driver for those shaders again (on AMD's Windows driver, the freeze of issue 996). Likewise, a skipped preparation and the load mode's fallback are forgotten.What changed
What the game decided on this PC goes back beside the settings, out of
cache/, and a folder #321 already moved has it moved back out (copied out whole whencache/won't give it up). A loose cache that can never move intocache/, becausecache/already has its own, is deleted instead of lying there for good. The docs and comments now give the right places.longshot_driver_faults.txt,longshot_prepare_skippedandlongshot_load_start.txt(with its.waited).driver_faults_pathandload_fallback_pathingpu/vk/vk_draw.cpp, andskipped_pathinvk_main.cpp, give the game folder.host/game_layout.cno longer moves them intocache/, and moves them back out of it (records). When the rename fails (acache/that takes no rename, a file held without delete sharing on Windows), the record is copied out whole through a.tmprenamed into place (copy_record), so the game, which reads only the game folder's, keeps it; the log says so, and names one that can't even be read.host/game_layout.cmove_as): whencache/has its own of a cache file (the first move failed, the file held open, and the game then made a new one), the loose one is deleted and the log says how many and how many MB. A log is never deleted.assets/pipeline_states/README.mdanddocs/development.mdgivecache/longshot_pipeline_states.binin theaddcommand and steps, which failed with the old place.cacheholds besides caches (the pipeline list you can send in) and what stays out of it.docs/development.mdhas the layout, and what switching one game folder between a build from before #321 and one after it costs.RX_VK_LOADandRX_VK_DRIVER_FAULTSrows give the game folder.vk_progcache.cpp,vk_draw.cpp,driver_faults.h,vk_main.cpp.tests/test_game_layout.py: the records stay, and move back out ofcache/; with a read-onlycache/they're copied out, the driver's faults whole (fails without the fix), and an unreadable one is logged; a loose cache with acache/copy is deleted; a loose log stays.tests/test_load_default.py: the marker is in the game folder.Measurements
Verdict: passes on Linux and Windows. There's no performance number to measure: files move between folders. The measure is the game folder after an update, below.
Hardware: Fedora Linux 45, AMD Radeon RX 7800 XT (RADV, Mesa 26.2.6); and a Windows PC
Scene: none (the game folder's files)
Method: a launcher-built game folder from
main, its caches and logs loose beside the game, updated with this branch's builder (--cli --update), started, and its folder listedBaseline:
main@aa95d35fis the launcher's nightly-189, the folder's build before the update. The run is on4e5c009a, this change merged withmainof 2026-11-15.38e83bbfis the same change rebased ontomain@7bacf846(the same 11 files), so the folder's moves hold for it.How to reproduce: copy a launcher-built game folder, run this branch's builder
--cli --update <copy>, start the game from the copy, list the folder,cache/andlogs/aa95d35f4e5c009alongshot_vk_pipelines.binand stamp)cache/logs/: this run'slongshot_log.txt(v3.0.0-rc.4-35-g4e5c009a), the run before as.1cache/prompts/cache/prompts/Flags and settings
None.
Testing
Tested:
4e5c009a(this change onmainof 2026-11-15;38e83bbfis it rebased, the same 11 files):main(nightly-189-aa95d35f), updated with this branch's AppImage and started from the launcher. Everything moved intocache/andlogs/, nothing was left loose, the game wrote its log intologs/with the run before rotated to.1, and the button prompts were made incache/prompts/.LongshotBuilder-v3.0.0-rc.4-35-g4e5c009a-windows-x64.zip(LongshotBuilder.exe --cli --update), then played. It works as on Linux.python -I -B tests/run_all.pyon Linux, ona7f436bb: 575 passed. The 18 failures fail on a cleanmain@71b1edd8too, the same list.a7f436bb, after the game runs above):tests/test_game_layout.pywith a read-onlycache/.host/game_layout.cbuilds with llvm-mingw 20261104-Wall -Wextra -Werror.longshot_vk.dllbuilds;hos_main.c,game_layout.c,prompts.c;game_layout.cwith-Wall -Wextra -Werror);scripts/check_windows_files.py.Not tested: in the game, a file held open while the game moves it (an antivirus scan): a loose cache that can't move (deleted at a later start), and a record copied out instead of moved (
a7f436bb).tests/test_game_layout.pycovers both; no run met them, and the runs above were beforea7f436bb, which changes only that failure path.Must be tested: none: Linux and Windows were both run.
Risks
What could break: a loose cache file is deleted only when
cache/has one of the same name. It's a cache, so the worst case is the game making it again (a shader preparation, minutes). A log is never deleted. The records move only out ofcache/into the game folder, never over a file there.Turning it off: revert the commit (the records then go back into
cache/at the next start).Compatibility: after updating,
longshot_driver_faults.txt,longshot_prepare_skippedandlongshot_load_start.txtare back beside the game. The shader and pipeline caches are kept, not translated again. Saves,longshot_options.iniand the vk ABI don't change.Issues
See #321
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.@Beanstalk
Beanstalk test farm
Commit
a7f436b· tier untrusted · approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.4e5c009abf38e83bbf8bRebased onto
main@7bacf846. The merge of main into the branch is dropped (the one commit now sits on main); one conflict indocs/development.md, theRX_VK_DRIVER_FAULTSrow, where this PR's "(not incache)" wording is kept and main's neighbouring rows stay as main has them. The diff is the same 11 files and line counts as before. No tests were run here; the test boxes stay yours.Tested in the game on Linux and Windows, on
4e5c009a, this change onmainof 2026-11-15.38e83bbfis it rebased: thanks for the rebase. Both pass:main(nightly-189) with this branch's AppImage and started it from the launcher.cache/andlogs/, and nothing was left loose.logs/longshot_log.txt, with the run before rotated to.1.cache/prompts/.LongshotBuilder-…-windows-x64.zip(--cli --update) and played it. It works as on Linux.The description now has both runs, and the Testing and Measured boxes are ticked.
WIP: fix(game): what the game decided on this PC stays beside the settings, and a loose cache that cannot move is deletedto fix(game): what the game decided on this PC stays beside the settings, and a loose cache that cannot move is deletedRead in full (code only, nothing run). The code does what the description says and I found no bug.
driver_faults_path,load_fallback_pathandskipped_pathnow all resolve togame_folder_path(). The.waitedstrike goes throughload_default::strike_*(load_fallback_path()), so it follows.state_list_prepareremoves the same paths it used to, and the check intests/test_load_default.pywas updated rather than weakened.hos_game_layout: records are moved back out ofcache/only when nothing is at the destination, so no file is overwritten.move_asdeletes a loose cache only whencache/has its own, and a log is never deleted. Thekeptanddroppedcounts match whattests/test_game_layout.pyasserts.file_sizeis portable (GetFileAttributesExA/stat).One thing to fix before merge: the description says "the docs now give the right places", but four lines still send people to
cache/for the files this PR moves out of it (inline comments below). A player following the README would look in the wrong folder, and the shipped README would contradict the new "Where the files go" paragraph. I tried to push the four one-line fixes to the branch and the push was not allowed, so they are suggestions here.Overlap: #737 and the other open progcache PRs touch only comment lines near this change in
gpu/vk/vk_progcache.cpp, so expect trivial conflicts. #604 toucheshost/game_layout.celsewhere.Correction to my review above: the four stale lines are not in the diff, so they could not be inline comments. They are:
README.mdline 363 (Intel steps): "If the game folder'scachefolder has alongshot_prepare_skippedfile" -> "If the game folder has alongshot_prepare_skippedfile".README.mdline 367: "longshot_driver_faults.txt(in thecachefolder)" -> "(in the game folder, notcache)".README.mdline 1143: "longshot_prepare_skippedfile in itscachefolder" -> "in the game folder".docs/design.mdline 267: "longshot_driver_faults.txt in the game folder's cache/" -> "in the game folder, not in cache/".Review findings retained as an ordinary comment. I am following this PR as a watcher; another reviewer should make the final approval decision. The code findings and validation gaps below still need consideration.
Reviewed
38e83bbf8bfc2064a0eda53e3584d8eb91377a34. This keeps the PC's driver-fault decisions and preparation choices when caches are cleared, and removes obsolete loose caches. Request changes: the record migration needs a recoverable failure path.host/game_layout.c:148. On an update from the cache-folder layout, letcache/longshot_driver_faults.txtremain readable but make its rename fail (for example, deny rename through directory permissions, or hold it open without delete sharing on Windows). This loop silently continues.gpu/vk/vk_draw.cpp:1189–1202now reads only the game-folder path, so the old record remains on disk but its keys are ignored andfault_quarantine()initializes empty. A known-faulting shader can therefore enter the driver again—the failure this PR intends to prevent. Preserve the readable record through a verified copy/publication fallback or have the reader use the old path until migration succeeds; report the failed migration. Add a fixture with a readable-but-unmovable record and verify that its keys still enter the quarantine. The new test currently covers successful migration only. The other three records also silently lose effect on a failed move.README.md:363,:367,:1143anddocs/design.md:267. There is alsoREADME.md:317, which tells players with a skipped preparation to delete the marker fromcache/; after this change that action does not remove the marker the game actually reads, leaving shader preparation skipped. Update all five to the game folder.The successful migration, loose-cache deletion and log-preservation paths otherwise match the description. Preparation removes both the fallback marker and its
.waitedcompanion through the relocated path.Author-reported evidence includes Linux/RADV and Windows game runs on
4e5c009a, a Windows cross-build, and 511 game-free checks passing with 16 reported baseline failures. Those runs precede this rebase and do not exercise record-migration failure. Cached checks also show a failed guide/source-review check and pending Beanstalk approval; I have not diagnosed the CI failure.The forge reports this head unmergeable. A read-only merge inspection confirms a conflict in the
RX_VK_LOADdocumentation row: retain current main's compute-fallbackcreatedefault from PR 975 together with this PR's new marker location. PR 737 redirects pipeline notes to a shared shader store; retain this PR's explicit game-folder fallback path when combining them (land this fix first). PR 789, PR 902 and PR 903 change separate cache invalidation, diagnostics and saving paths, not this migration. No duplicate fix identified.Code-only review: no builds, tests or runtime runs performed by this reviewer. No branch changes or fixes pushed.
38e83bbf8ba7f436bb61Thanks both. Rebased onto
main@71b1edd8, keeping PR 975'sRX_VK_LOADdefault with this PR's marker location.bibiburl's P1 is fixed in
a7f436bb. A record that can't be renamed out ofcache/is copied out whole (through a.tmprenamed into place) and logged, and one that can't be read either is named in the log.tests/test_game_layout.pycovers it with a read-onlycache/: without the fix the driver's faults never reach the game folder, with it they arrive whole.The five stale doc lines (HumanBean's four and
README.md:317) now name the game folder.The Linux and Windows runs were on
4e5c009a, before this fix. The fix only touches the failure path, and I'll rerun once it's in.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.