From c2b7e27ff39409c3599a6d4e15e04fd4bf03392c Mon Sep 17 00:00:00 2001 From: pablogonz12 Date: Wed, 25 Nov 2026 19:43:05 +0100 Subject: [PATCH 1/6] docs: the Mesa shader cache, sized, per prefix, and set in the play script Ported from #93 (branch kept): the section as written there, rebased onto the unified core, since docs/linux.md on main had no Mesa cache section. Co-authored-by: pablogonz12 --- docs/linux.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/linux.md b/docs/linux.md index 816fa100..9b1d7b68 100644 --- a/docs/linux.md +++ b/docs/linux.md @@ -46,6 +46,9 @@ GAME_EXE="" export WINEPREFIX="$HOME/.local/share/scarlight-prefix" export WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core,d3dcompiler_47=n,b" export VKD3D_CONFIG=ignore_shared_fence +export MESA_SHADER_CACHE_DIR="$WINEPREFIX/mesa-cache" # see "Mesa shader cache" below +export MESA_SHADER_CACHE_DISABLE=false +export MESA_SHADER_CACHE_MAX_SIZE=8G export VICTORY_HOOKS=1 # place the patches your build's profile lists; see title-profiles.md export VICTORY_GAME_DIR="$GAME_DIR" export VICTORY_LOG="${VICTORY_LOG:-info}" @@ -57,6 +60,31 @@ Make it executable once with `chmod +x play.sh`. Pass switches in front: `VICTOR they are listed under [switches](#switches). If you use GE-Proton's own D3D12 DLLs, make sure your prefix has them installed or copy them next to the exe. +### Mesa shader cache + +Mesa (RADV/ANV) keeps its own on-disk cache of compiled shaders, and it is worth a great deal here: +building all **751** programs of the fixed scene from cold costs **37,672 ms** of pipeline creation +in total, and the same run against a warm cache costs **148 ms**. The whole set is **8.7 MB in 253 +files**, so the disk cost is trivial next to the time it buys. + +Mesa's default cache limit is 1 GiB and it **evicts** when full — a shader evicted is a full +recompile on the next boot — so the play script sets the cache explicitly: + +| Variable | Value | Why | +|---|---|---| +| `MESA_SHADER_CACHE_DIR` | inside the prefix | one place per install; see the per-prefix note below | +| `MESA_SHADER_CACHE_DISABLE` | `false` | some drivers and wrappers default the cache off | +| `MESA_SHADER_CACHE_MAX_SIZE` | `8G` | measured to hold the scene with room to spare; 16 GiB is planned and untested | + +The directory is **per prefix**: a run started under another `WINEPREFIX` finds an empty cache and +pays the whole cold cost again, which looks exactly like a code regression and is not one. Keep one +prefix per install, and point `MESA_SHADER_CACHE_DIR` at the same directory if you want the cache to +outlive the prefix. + +`MESA_SHADER_CACHE_READ_ONLY=1` makes Mesa never write the cache; it is the only way to ship a +prebuilt cache to other machines, and it is **not** what this script does — a read-only cache never +fills in, so anything missing from it recompiles on every boot. + ## 5. Title profiles (optional) A **title profile** tells the layer what *one build of one title* needs beyond the generic path: a From 71b082e8585a2dd8ddbdf551a324383f4fc92817 Mon Sep 17 00:00:00 2001 From: pablogonz12 Date: Wed, 25 Nov 2026 20:02:15 +0100 Subject: [PATCH 2/6] docs: Mesa's cache limits, not a read-only claim MESA_SHADER_CACHE_READ_ONLY is not honoured by every Mesa (24.1 still writes a writable cache), so the section states the supported limits and what the play script does instead. --- docs/linux.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/linux.md b/docs/linux.md index 9b1d7b68..195d0be1 100644 --- a/docs/linux.md +++ b/docs/linux.md @@ -81,9 +81,11 @@ pays the whole cold cost again, which looks exactly like a code regression and i prefix per install, and point `MESA_SHADER_CACHE_DIR` at the same directory if you want the cache to outlive the prefix. -`MESA_SHADER_CACHE_READ_ONLY=1` makes Mesa never write the cache; it is the only way to ship a -prebuilt cache to other machines, and it is **not** what this script does — a read-only cache never -fills in, so anything missing from it recompiles on every boot. +Mesa's Fossilize cache path (`MESA_SHADER_CACHE_DISABLE`, `MESA_SHADER_CACHE_MAX_SIZE`, and a +directory shipped with the build) is what sets a cache's limits; `MESA_SHADER_CACHE_READ_ONLY` is not +a guarantee, since Mesa 24.1 still writes to a writable cache when it is set. This script keeps the +cache writable per prefix and capped (above) instead: a prebuilt cache shipped to another machine is +**not** what it does, and a cache that never fills in recompiles whatever is missing on every boot. ## 5. Title profiles (optional) From e21d69504054c32c7e910b579fd67986308d09e8 Mon Sep 17 00:00:00 2001 From: pablogonz12 Date: Wed, 25 Nov 2026 22:51:16 +0100 Subject: [PATCH 3/6] docs: the read-only cache is how a cache ships, and not what the script does --- docs/linux.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/linux.md b/docs/linux.md index 195d0be1..41caf8c4 100644 --- a/docs/linux.md +++ b/docs/linux.md @@ -81,11 +81,12 @@ pays the whole cold cost again, which looks exactly like a code regression and i prefix per install, and point `MESA_SHADER_CACHE_DIR` at the same directory if you want the cache to outlive the prefix. -Mesa's Fossilize cache path (`MESA_SHADER_CACHE_DISABLE`, `MESA_SHADER_CACHE_MAX_SIZE`, and a -directory shipped with the build) is what sets a cache's limits; `MESA_SHADER_CACHE_READ_ONLY` is not -a guarantee, since Mesa 24.1 still writes to a writable cache when it is set. This script keeps the -cache writable per prefix and capped (above) instead: a prebuilt cache shipped to another machine is -**not** what it does, and a cache that never fills in recompiles whatever is missing on every boot. +A cache can also be shipped with a build and read instead of written +(`MESA_SHADER_CACHE_READ_ONLY=1` with `MESA_SHADER_CACHE_DIR` pointing at the shipped directory): +that is the only way to hand another machine a warm cache without letting anything write to it, and +it is **not** what this script does. A shipped cache cannot take the shaders a run misses, and one +that is older than the build recompiles what it lacks, so the play script keeps a writable cache per +prefix, capped as above. ## 5. Title profiles (optional) From ec9e43ffb14a0bbbbb71edb8385d193f6a33e309 Mon Sep 17 00:00:00 2001 From: pablogonz12 Date: Wed, 25 Nov 2026 22:52:13 +0100 Subject: [PATCH 4/6] docs: ROADMAP and the README install point at the cache section --- docs/ROADMAP.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 0bc69ec1..2f4dbd8b 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -38,7 +38,8 @@ Mesa updates where the key does not change, and across machines. RADV's on-disk shader cache on the test machine held **1.2 GB in 312,556 files** against Mesa's 1 GiB default, so it was evicting entries and recompiling them later. Sizing `MESA_SHADER_CACHE_MAX_SIZE` and keeping our own entries out of the eviction path is a cheap, driver-side win that no closed -driver would let us see. +driver would let us see. What a user sets today — the directory, the size, and why it +is per prefix — is in [linux.md](linux.md#mesa-shader-cache). ### Faster asset streaming From a66b17c03cfe7c7e8ab6dd972dfc92a7689cfb07 Mon Sep 17 00:00:00 2001 From: pablogonz12 Date: Wed, 25 Nov 2026 22:53:04 +0100 Subject: [PATCH 5/6] docs: the README install points at the cache section too --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 45ac22c4..1f0588b9 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,10 @@ on, name yours in `compatibilitytools.d/Scarlight/scarlight.conf` (`PROTON=`); a DXC's `dxil.dll` and `dxcompiler.dll` in `Scarlight/files/` (Microsoft's binaries are not redistributed by a Linux release). [docs/steam.md](docs/steam.md) has both. +Running the game from a script instead of Steam, and the Mesa shader cache that cuts pipeline creation +from 37,672 ms to 148 ms for the 751 programs of the test set, are in +**[docs/linux.md](docs/linux.md#mesa-shader-cache)**. + ## Status **Not playable yet.** This is early work, and it is better to say so plainly: the game starts, its From 1e9a6da3a56ec1f5aff21aeef3ac56fb2b22bbca Mon Sep 17 00:00:00 2001 From: pablogonz12 Date: Wed, 25 Nov 2026 23:05:11 +0100 Subject: [PATCH 6/6] README: keep both the linux.md pointer and the Releases section --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index d9645b5a..fbdab81e 100644 --- a/README.md +++ b/README.md @@ -80,18 +80,16 @@ on, name yours in `compatibilitytools.d/Scarlight-/scarlight.conf` (`PR DXC's `dxil.dll` and `dxcompiler.dll` in `Scarlight-/files/` (Microsoft's binaries are not redistributed by a Linux release). [docs/steam.md](docs/steam.md) has both. -<<<<<<< HEAD Running the game from a script instead of Steam, and the Mesa shader cache that cuts pipeline creation from 37,672 ms to 148 ms for the 751 programs of the test set, are in **[docs/linux.md](docs/linux.md#mesa-shader-cache)**. -======= + ## Releases Releases are on the [Releases page](https://github.com/pablogonz12/Scarlight/releases): a versioned tarball named after the Proton it runs on — **Scarlight 11.14.1** runs on GE-Proton11-14. [docs/RELEASES.md](docs/RELEASES.md) says what a version number means, how to install one, and how often a new one comes. ->>>>>>> hub/main ## Status