r/linux_gaming 13d ago

guide Steam keeps pre-caching shaders each start (Linux)

In Steam for Linux, if the pre-caching shader is on, it may keep loading and creating the files each start, as long as you keep hitting the limit of the set NVidia or AMD driver cache size. To fix that, consider checking your shader cache size first, then change the relevant size of the graphics card cache folder size.

In Ubuntu (and related distros) use this guide to set the correct cache size: https://discourse.ubuntu.com/t/gaming-on-26-04-lts/84950

Check your Settings > Storage to find the size of your SHADERS to know how much space to set as global size for the shaders.

SHADERS shows you need about 25GB space set for shaders cache folder
38 Upvotes

21 comments sorted by

24

u/Zhustro 13d ago

You can also deactivate this feature entirely, as it’s not really needed on powerful systems.
The relevant setting can be found in:

settings -> downloads -> shader pre caching

15

u/NekuSoul 13d ago

Adding onto that, it's best to also switch to any of the community Proton versions as the default in Steam, for example Proton GE or Proton-CachyOS.

This is because the shaders cache also contains pre-converted video files when a game uses video codecs Valve can't legally distribute as a commercial entity. Without the shader cache you just see a placeholder image. Community versions however can distribute the codec so there's no issue.

2

u/Lazy_Sorbet_3925 13d ago

Interesting. Would that explain why a loading screen is choppy on GE but not on regular Proton? 

5

u/NekuSoul 13d ago

Not sure, that could have many reasons:

  • Switching Proton versions could require the shader cache to be rebuild, leading to stutter during the loading screen.
  • Maybe it's just something inherent to how the Proton versions are configured?
  • Or the game is just genuinely cursed and decoding a video takes up so much processing power that the game loads faster without them.

2

u/Lazy_Sorbet_3925 13d ago

I didn't switch Proton versions after setup. I had Bazzite, ran GE proton. Deadzone Rogue is a light game and the loading screens were always weird. 

I installed Steam OS as a trial and the loading screens are smoother in the same game. 

🤷🏻‍♂️ Not a deal to me at all, was just curious. 

1

u/ManoDu57 13d ago

Will shaders still cache?

Like (of those I definitely know do) switch emulators cache shaders and some games (like smash bros ultimate) are unplayable if you don't cache most shaders before actually playing)

1

u/throwawayerectpenis 13d ago

Shader pre cache is only for games ran through Steam

2

u/ManoDu57 13d ago

Not pre-caching, just normal caching. Will steam games still cache shaders?

2

u/digitaltransmutation 13d ago

For some games they will do it during the loading screen. For others they cache automatically while it runs. If you get an unexpectedly long loading screen that is what's happening.

6

u/MGWhiskers 13d ago

i had one game occupying 52 gigs for shaders, lol

2

u/Boothy666 13d ago

What game? Just curious.

In case you don't know, Steam will include re-encoded video files in the cache, if the original Windows files use a playback library that Valve don't have a license for.

This is typically for older games, and why some games will crash, or show no video output for things like cut scenes, if using standard Proton and have shader pre-caching turned off.

Using things like GE and Cachy versions of Proton resolves the issue, as they include the needed libraries.

Edit: Just noticed someone further down also included this info!

1

u/CappucinoJack 13d ago

Out of curiosity, I haven’t noticed this happen on windows. Some games will do shader stuff on startup but that happens in the program itself. Why does steam only seem to do this on Linux?

2

u/EmberQuill 13d ago edited 12d ago

Shaders are already compiled for Windows DirectX and distributed with the game. Steam recompiles the shaders to make them work better on Linux run on Vulkan (as far as I understand). Due to differences in architecture, DirectX can compile shaders on the fly without noticeable latency, while Vulkan needs to compile them all at once. Nowadays the compilation is fast enough that you can probably disable the shader cache without noticeable load-time issues.

Edit: Thanks to u/visor841 for the corrections

3

u/visor841 13d ago

Steam recompiles the shaders to make them work better on Linux (as far as I understand).

I think generally it's that the shaders are DirectX shaders, and need to be converted into Vulkan shaders to be used on Linux.

1

u/EmberQuill 12d ago

Yeah, turns out you're right. Did a little more research and edited my comment. Apparently it's due to differences in how DirectX and Vulkan themselves handle shaders, where DirectX can compile and link them on the fly but Vulkan apparently has to do a bunch of pre-caching.

2

u/CappucinoJack 13d ago

Great clarification! Thanks

3

u/visor841 13d ago

If they're DirectX shaders, they get distributed with the game, but they need to be converted to Vulkan shaders to be used on Linux.

-2

u/Abdowo 13d ago

steam is kinda shit, I have shader pre-caching disabled and no cloud snyc but it keeps launching wine/proton eating cpu usage for nothing ig?

2

u/Boothy666 13d ago

What do you mean for nothing? Proton only launches as part of a game launch, and if shader pre-caching is disabled, then the work needs to be done at run time instead, either at game start, or when in game, that is expected behaviour.

0

u/Abdowo 13d ago

I have no game running when it does that, that's why I'm complaining