protonscr

Shader pre-caching re-replays the whole Fossilize database on a warm NVIDIA cache and writes GBs of new driver cache for a small bucket update

steamclosed
ValveSoftware/steam-for-linux#13647 · opened 2026-09-25 by zzallirog · updated 2026-09-25 · 3 comments · github
Zzzallirog 2026-09-25 github

System: Arch Linux, RTX 4060 Laptop, NVIDIA 615.71.09, Steam 1.0.0.87. THE FINALS (2073850) on GE-Proton10-34.
__GL_SHADER_DISK_CACHE_SIZE=48000000000 and __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1 are set system-wide in /etc/environment, so driver-side pruning (#11392) is ruled out.

What happens

The game's NVIDIA cache was already warm: shadercache/2073850/nvidiav1/.../steamapp_merged_shader_cache.bin, 4.3 GB. On client start Steam committed updated swarm manifests (shader_log.txt):

[2026-09-25 16:43:08] Committed bucket 70016911 (AppID 2073850) from 5598895753320162954 to 2120673634056925331   671869244 -> 698948452 bytes
[2026-09-25 16:43:28] Committed bucket 58939956 (AppID 2073850) from 1103862913764927276 to 3435466674086516885  2150571935 -> 2155141088 bytes

That is about 31 MB of new Fossilize data. On game launch Steam then replayed the whole database:

[2026-09-25 16:55:03] Starting processing job for app 2073850!
[2026-09-25 16:56:08] Still replaying 2073850 (66%, 0/317613).
[2026-09-25 17:02:00] Still replaying 2073850 (83%, 114315/220811).

In those 7 minutes (I stopped it at about half), the driver wrote about 1.2 GB of new cache (steamapp_shader_cache0..14.bin) next to the existing 4.3 GB merged file. On this machine the whole Fossilize database (~2.85 GB) compiles to ~4.3 GB of driver cache, about 1.5×. So ~31 MB of new Fossilize data should yield on the order of 50 MB, not 1.2 GB in half a run. That looks like pipelines already in the cache being compiled again.

The day before, Steam's own merge of this cache logged Mismatching key! 15,039 times (Processing NVIDIA cache file ... steamapp_merged_shader_cache.toc, 2026-09-24 15:19 and 20:00). I can't tell whether those entries are dropped.

To the user this looks like: switch games, restart Steam, and the game you already warmed up is "processing Vulkan shaders" again for roughly a quarter of an hour.

Evidence that the existing cache is enough

I disabled pre-caching and pointed the driver at a copy of the same nvidiav1 directory through a launch-option prefix, using Steam's own cache names:

export __GL_SHADER_DISK_CACHE_PATH=~/.local/share/shader-keep/$SteamAppId/nvidia   # copy of shadercache/<appid>/nvidiav1
export __GL_SHADER_DISK_CACHE_APP_NAME=steamapp_shader_cache
export __GL_SHADER_DISK_CACHE_READ_ONLY_APP_NAME=steamapp_merged_shader_cache

The game opens steamapp_merged_shader_cache.bin read-only. Its own PSO preload then wrote 0 bytes of new cache. The same preload wrote 413 MB when APP_NAME was wrong and the old cache wasn't seen. Switching between two games no longer triggers anything.

Request

Not new behaviour: please stop re-doing (or possibly invalidating) shaders that are already compiled locally. Fossilize can already skip known pipelines: the fossilize_replay bundled with Steam has --on-disk-replay-whitelist, and Steam keeps replay_cache.*.foz next to the database. A bucket update should cost the replay of what changed, not a full re-run over a warm cache. Until then the only reliable option on NVIDIA is to turn pre-caching off, which gives up its benefit for new content.

Related

  • #8076 covers the symptom ("downloaded and compiled after every reboot"). This issue narrows it to one mechanism, with log lines and a byte-level measurement: a small bucket commit leads to a full replay over a warm cache.
  • #11392 is NVIDIA driver pruning. Ruled out here (48 GB limit + SKIP_CLEANUP system-wide, merged cache intact), so the remaining cost is on the Steam side.
  • #9803 reports precompiled caches landing where the NVIDIA driver never reads them. It's the same class of problem: the driver only reads files whose names match __GL_SHADER_DISK_CACHE_APP_NAME / READ_ONLY_APP_NAME, and a mismatch there produced the 413 MB recompile above.
  • ValveSoftware/Proton#7176 ("Processing vulkan shaders every time I launch a game") was closed, but the behaviour still reproduces with Steam 1.0.0.87.

Happy to provide full shader_log.txt excerpts or run test builds.

Zzzallirog 2026-09-25 github

Update after a revert check, including two corrections to the post above.

1. The "0 bytes" result was confounded. The second launch could read the 413 MB the first launch had just written. I redid it cleanly: the cache directory reset to an exact copy of Steam's nvidiav1 (the 4.3 GB merged file plus the 15 shards from Steam's own replay), with nothing the game had written. The game's PSO preload then wrote 9.3 MB, against 413 MB with no usable cache. So Steam's cache is valid and covers ~98% of what the game compiles at load.

2. Correction to the "Request" paragraph: Steam does use Fossilize's skip machinery. steamclient.so carries --on-disk-replay-whitelist, --replayer-cache, --implicit-whitelist and replay_cache.%s.foz. During the run the total in Still replaying dropped from 317,613 to 220,811, which looks like filtering. So the question isn't whether skipping exists, it's why it misses so much.

3. What the replay actually added. After I reverted my workaround, Steam's merge on the next client start (2026-09-25 17:46) combined the 4.30 GB merged file and the 1.24 GB of shards written during the half-replay into a new 4.61 GB merged file. Only ~0.30 GB of the replay output was new. The other ~0.94 GB duplicated entries already in the cache or was discarded; I can't tell which from outside.

I'm now logging the exact fossilize_replay arguments and environment. At the next bucket update for this app I'll add them here, so it's visible which whitelist is passed and whether it matches what's already on disk.

KKlausikPL 2026-09-25 github

I can confirm a similar behavior with Borderlands 4 (AppID 1285190) running on GE-Proton11-7-x86_64 (NVIDIA / CachyOS).

Steam took over 35 minutes to pre-cache the Vulkan pipelines via Fossilize (~228,000 pipelines), producing a 3.8 GB merged cache file (steamapp_merged_shader_cache.bin) at 17:04.

However, immediately upon launching the game, it completely ignored the pre-cached data and started its own in-game shader compilation from 0%. The game ran for ~6 minutes (17:04–17:10), spending ~95% of that time recompiling shaders, which caused the cache to swell from 3.8 GB to 4.4 GB.

Cache directory right after Steam's pre-cache finished (17:04):

total 3.8G
-rwxr-xr-x 1 user user 3.8G Sep 25 17:03 steamapp_merged_shader_cache.bin
-rwxr-xr-x 1 user user 3.2M Sep 25 17:03 steamapp_merged_shader_cache.toc
-rwxr-xr-x 1 user user 3.5K Sep 25 16:27 steam_shader_cache.bin
-rwxr-xr-x 1 user user  224 Sep 25 16:27 steam_shader_cache.toc

Cache directory after game exit and post-run merge (17:11):

total 4.4G
-rwxr-xr-x 1 user user 4.4G Sep 25 17:11 steamapp_merged_shader_cache.bin
-rwxr-xr-x 1 user user 3.8M Sep 25 17:11 steamapp_merged_shader_cache.toc
-rwxr-xr-x 1 user user 3.5K Sep 25 16:27 steam_shader_cache.bin
-rwxr-xr-x 1 user user  224 Sep 25 16:27 steam_shader_cache.toc

Notable anomalies from shader_log.txt:

1.  Truncated FOZ / read errors during Steam's initial replay merge (17:04):

Processing FOZ cache file at .../fozpipelinesv6/steamapprun_pipeline_cache.3554f158047e28bf/replay_cache.cee48876fdc2242ed639a0d818e073f3.101.foz
FOZ underflow, file truncated?
...
Can't read enough bytes for cache file header, skipping.

2.  Massive flood of Mismatching key! entries during the post-game merge
    (17:11):

[2026-09-25 17:10:48] AppID 1285190 exited.
[2026-09-25 17:11:01] Processing NVIDIA cache file at .../nvidiav1/GLCache/8d0a936d3f370e8143e56d2fcd10392e/e2422cdf67884eec/steamapp_merged_shader_cache.toc.
[2026-09-25 17:11:07] Mismatching key! Entry 11095/23520.
[2026-09-25 17:11:07] Mismatching key! Entry 34635/8966.
... (thousands of lines)

It looks like the in-game compilation produces duplicate/conflicting shader keys
that conflict with the pre-compiled Steam cache, causing both redundant wait
times for the player and uncontrolled disk bloat.

Kkisak-valve maintainer 2026-09-25 github

Hello @zzallirog, this issue is already being tracked at #13622. Closing as a duplicate.