Skip to content
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ on, name yours in `compatibilitytools.d/Scarlight-<version>/scarlight.conf` (`PR
DXC's `dxil.dll` and `dxcompiler.dll` in `Scarlight-<version>/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)**.

## Releases

Releases are on the [Releases page](https://github.com/pablogonz12/Scarlight/releases): a versioned
Expand Down
3 changes: 2 additions & 1 deletion docs/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
31 changes: 31 additions & 0 deletions docs/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ GAME_EXE="<the title's 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}"
Expand All @@ -57,6 +60,34 @@ 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.

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)

A **title profile** tells the layer what *one build of one title* needs beyond the generic path: a
Expand Down