run_game_wine.sh: keep the drivers' shader cache from run to run (WINE-RUN-SHADER-CACHE) #2436
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2436"
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 ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-27T06:49:11Z.
Claimed in the coordination issue as: WINE-RUN-SHADER-CACHE (finding by z3r0rc in #1608, its shader-cache part)
What and why
scripts/run_game_wine.shexportedXDG_CACHE_HOME=$RUN/session/cache, a new folder in each run folder. NVIDIA'sGLCacheand Mesa's shader cache live underXDG_CACHE_HOME, so every launch started with an empty driver cache andcompiled its pipelines again.
XDG_CACHE_HOMEis used when it is set;--cache DIRnames a folder instead. Both are kept from runto run.
--cache fresh, or neither of the two, gives the old behaviour: a new folder in the run folder, for a cold-cachemeasurement.
shader cache: kept in DIRorshader cache: fresh).--helpanddocs/linux_proton.mddescribe it.Not in this PR: the compile-gate defaults from the same finding (
LEONIDA_COMPILE_HELPER,LEONIDA_ASYNC_PIPELINES),which need a retail run to judge.
Tested
tests/test_run_game_wine.py, three new cases against the script's stubs: a fresh cache by default; the caller'scache kept across two runs (the stub
wineappends tonvidia/GLCache, and the second run finds the first'sline);
--cache DIRand--cache freshover a caller'sXDG_CACHE_HOME.AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly.docs/design.md. (n/a: no translator change)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-28T03:27:49Z.
#2436 | head
6fe01249f6| python -I tests/test_run_game_wine.py | red: ModuleNotFoundError: No module named 'fcntl' (PR branch predates main's Windows skip guard) | green: OK (skipped=12 on Windows 11 after merging main's Linux-only guard) | full suite: same as main (514/521 standalone stdlib tests passed, 0 new failures vs main02f71ccfe7; compileall=0; node viewer_streaming=0) | Windows 11, Python 3.14.7, no game files | AI-assisted: yes, Antigravity (Gemini)main02f71ccfe7;scripts/check_no_game_data.pypassed (0).tests/test_run_game_wine.pyis Linux-only (fcntl/bash/ Wine stub), so all 12 tests skip on Windows oncemainis merged. A Linux runner still needs to verify the live Red -> GreenXDG_CACHE_HOMEassertions forVERIFY-2436.Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-28T20:46:29Z.
Linux verification for
VERIFY-2436on CachyOS (kernel 7.3.6-3, Bash 5.3.20, Python 3.14.10). Heade73386f5merged cleanly intomainat1bc055e6.I ran the same current
python -I tests/test_run_game_wine.py -vfixture before and after, changing only which runner it called. On baremainwith the PR fixture, 9 passed and the 3 new cases failed as expected. The old runner ignores the caller's cache, rejects--cacheand uses the expected fresh directory without the new status line. With the PR, 12/12 passed with no skips. That covers the default fresh cache, the caller's cache surviving two stub launches, and both forms of the explicit override (directory orfresh).The cases ran offline with Wine stubs. No game files or GPU work were needed. AI-assisted with Codex.
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T23:38:01Z.
Tested
e73386f5bmerged (no commit) withmainaa918e5d9: Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean.tests/test_run_game_wine.pyskips all of its 12 tests on Windows (it needsbashand Wine). Green and red can't be observed on this machine, so this is diff reading only.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:40:20Z.
Independent verification on Windows 11 (
10.0.26200, x64, Git Bash +Python 3.12.10&Python 3.14.5) withe73386f5bcmerged ontoorigin/main(0efc2bd43d,0merge conflicts):scripts/run_game_wine.sh):origin/main):bash scripts/run_game_wine.sh --cache freshexits2(run_game_wine.sh: unknown argument: --cache (see --help)).e73386f5bcmerged ontoorigin/main):bash -n scripts/run_game_wine.shexits0,bash scripts/run_game_wine.sh --helpexits0and documents--cache DIR|fresh, andbash scripts/run_game_wine.sh --cache ""exits2(run_game_wine.sh: --cache needs a value (see --help)).python -I -B tests/test_run_game_wine.py:Ran 12 tests,OK (skipped=12)on Windows under bothPython 3.12.10andPython 3.14.5(matching the Linux-only guard).python -I tests/test_docs_table_rows.py(2/2),python -I tests/test_docs_repeated_lines.py(3/3),python -I tests/test_ci_registration.py(18/18), andpython -I tests/test_text_write_line_endings.py(3/3) all exited0;test_docs_cli_flags.pyandtest_docs_links.pyadd0issues ondocs/linux_proton.mdorscripts/run_game_wine.sh.git diff --checkandpython -I scripts/check_no_game_data.pyacross all 3 touched files exited0.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T04:27:45Z.
Review: COMMENTED
Reviewed head
e73386f5bagainst the base by static inspection only. No builds, tests, or GPU runs.docs/linux_proton.md:104andscripts/run_game_wine.sh:217. A warmMESA_SHADER_CACHE_DIRor__GL_SHADER_DISK_CACHE_PATHstill reaches Wine under--cache fresh. The launcher prints “fresh” even though the driver can reuse that explicit cache during a cold-cache comparison. Please document that the flag selects the XDG cache root, name the driver overrides callers should unset for cold measurements, and add a stub assertion for their precedence.scripts/run_game_wine.sh:217andscripts/run_game_wine.sh:221. Fresh mode can reuse cache entries already present in an accepted output directory. Retrying a failed display startup with a different cache choice also appends a second, potentially contradictory status. Please reserve an unused directory for fresh mode or reject a pre-existing one, and write the session header anew on each launch.tests/test_run_game_wine_safety.py:194. This fixture inheritsXDG_CACHE_HOME. If it names a regular file, the new directory creation aborts the launcher before the fixture can verify summary exit propagation. Please add--cache freshto the shared fixture arguments.The new cache parsing guards unset values under
set -u, and the directory operations quote paths with spaces. The shared base already uses Bash 4 case conversion for device selection.--cachetakes precedence over the caller's XDG setting. The launcher passes through separate Mesa, NVIDIA, AMD, DXVK, and VKD3D cache environment variables, and the new Wine stub exercises the XDG selection.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-30T08:16:13Z.
Thanks, all three addressed in
206bb4b6:--cache freshnow unsetsMESA_SHADER_CACHE_DIR,MESA_GLSL_CACHE_DIRand__GL_SHADER_DISK_CACHE_PATH, so a fresh run is cold whatever the caller had set; with a kept cache the caller's variables stay and win over the XDG root.--helpanddocs/linux_proton.mdsay both.test_a_fresh_cache_drops_the_drivers_own_cache_variableschecks the stub sees none of them under fresh and the caller's values under a kept cache.session/cachein a run folder that is accepted again, andsession.txtis written anew on each launch (>), so there is oneshader cache:line;test_a_fresh_cache_is_empty_in_an_accepted_run_folder.--cache fresh.Linux, Python 3.13:
tests/test_run_game_wine.py14/14 (the two new tests fail with the old script),tests/test_run_game_wine_safety.py3/3, also withXDG_CACHE_HOMEnaming a regular file. Merges cleanly into maind762b139.AI-assisted (Claude Code); I ran the tests and checked the results.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:30:38Z.
Review: APPROVED
Reviewed head diff against
main:scripts/run_game_wine.shcleanly adds--cache DIR|fresh(defaulting to callerXDG_CACHE_HOMEorfresh), unsets driver-specific cache overrides and clearssession/cacheonfreshruns, records the active cache mode insession.txt, updatesdocs/linux_proton.md, and adds unit test coverage intests/test_run_game_wine.pyandtests/test_run_game_wine_safety.py. Clean-room verified and all CI checks green.(AI-assisted review.)