fix(linux): make the folder __GL_SHADER_DISK_CACHE_PATH names, or NVIDIA keeps no shader cache #2363
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2363
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/keep-driver-cache"
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?
Title: fix(linux): make the folder __GL_SHADER_DISK_CACHE_PATH names, or NVIDIA keeps no shader cache
When a player or a launcher points NVIDIA's shader cache at a folder that does not exist yet, the Linux driver keeps no cache at all, so every start compiles every pipeline again. The game now creates that folder before Vulkan loads.
What changed
host/hos_main.c:driver_cache_folder(), called right afterdriver_cache_room()in the Linux main and before the window. If__GL_SHADER_DISK_CACHE_PATHis set, it creates the folder and any missing parent folders. If it can't, it prints one line saying the driver will keep no shader cache. A value the player set is never changed, only created.tests/test_driver_cache_folder.py: compiles the function out ofhos_main.cand runs it on a missing nested path, an existing one, a trailing slash, a double slash, a path under a regular file (it reports the error and doesn't crash) and an empty value. It also checks that main calls it before the window, and that the Linux game file is still namedhookshot(see below).tests/display_startup_failure_test.cpp: an empty stub for the new call, next to thedriver_cache_roomone.Mesa needs nothing: it creates
MESA_SHADER_CACHE_DIRitself, including missing parents (checked with lavapipe and Mesa 26.2.6).Why updates don't lose the cache (checked while looking for this)
The question was whether players lose the driver's compiled pipelines when they update Hookshot or move the game folder. On Linux with NVIDIA they don't:
GLCache/<id>/<driver>/<hash of the name>.toc/.bin. Forhookshotthe file is the same one in every Hookshot folder on the PC.VkApplicationInfoapplication name or version, or an added engine name and versionhookshot-v2: 7.1 ms, a second cache file). Setting__GL_SHADER_DISK_CACHE_APP_NAMEwould get around that, but it would also rename the cache file every player has now. So it isn't set. The new check keeps the Linux game namedhookshotinstead.RX_VK_PREPARE_AGAIN=1):bin/hookshotreplaced by a file with different bytes, as an update does: 51.0 s. Predicted 14.2 s, precompile 14.6 s.mkw_vk_pipelines.bin) is checked against the vendor, the device and the driver'spipelineCacheUUID. It is not checked against Hookshot's version or path, so it stays valid across updates: 300 of 300 pipelines were found in it with the program replaced and moved. A cache from another driver or GPU is still dropped.What does start the driver cache over: a driver update (expected: the driver drops its own cache), the cache's size limit (raised to 10 GiB on Linux already) and the case this PR fixes.
Tested
--prepare-shaders,__GL_SHADER_DISK_CACHE_PATHset to a missing two-level-deep folder) created the folder, and NVIDIA's cache filled it (35 MB within seconds). Nothing went to~/.cache.tests/test_driver_cache_folder.py,tests/test_driver_cache_room.pyandtests/test_display_startup_failure.pypass.tests/run_all.pyon Linux: 358 passed and 4 failed, none of them from this change. Two need zstandard and one needs Tk, which this PC's Python doesn't have. The fourth istest_wayland_libdecor_hint.py, where a newer clang's-Wunused-but-set-globalfires on that test's own harness.Not tested: Windows. Its NVIDIA cache (DXCache/GLCache under LocalAppData) wasn't checked, and this change is Linux-only.
github-sync referenced this pull request2026-11-12 06:22:54 +00:00