Valve's shader cache system can be extremely helpful for Linux gaming, however it can also at times be quite problematic but Valve may have solved a big problem with it.
The idea behind the system is that you're supposed to see small regular downloads for the shader cache of each game, as Valve continue to build it up and then spread it out to everyone to help improve game performance on Linux and Steam Deck. However, over the years quite a lot of people have reported how it kept giving full downloads of the whole thing instead of being incremental.
Writing on the GitHub bug report from 2021 today, Valve developer Pierre-Loup Griffais said:
Shader cache downloads are designed to be incremental. Reports here indicate a daily download of the full shader cache file size, which is inconsistent with expectations - a small download and full disk write is expected instead.
After looking at the logs shared on this issue and on #9200, we've investigated and found a server-side problem with the system that keeps track of the ordering of shaders in those updates.
We've just rolled out an initial fix and will continue to monitor the situation. If the issue persists, please comment on this report and attach your
shader_log[.previous].txt
as indicated above.
Hopefully now fewer people (or no one) will see the issue but do let them know on the bug report if it happens to you.
Last edited by Schattenspiegel on 15 February 2023 at 9:06 pm UTC
I also second a per-game option. There are only a few games I care about at any given time, though I leave them on my HDD for faster access. I think my shader cache now uses north of 100GB... I'm not even sure if that's still useful, since Mesa also has a size limit?
I also wonder if old shaders are evicted from servers?
I will probably disable background processing again, depending on how many updates I get daily having 50 games installed.
Steam still has to process the whole cache, it's just downloading less. And I do not play all games I have installed all the time, so background processing is a waste if the increments happen often on a lot of games.
Any one knows how this all works with games like Callisto Protocol where Steam downloads shader caches only for the game to then upon launch to rebuild the shaders anyway, sounds like the two systems are fighting each other and that perhaps the steam shader cache should be disabled for games like this, or does it still help in some way that I don't understand?
I haven't played that specific game, but lots of things can happen.
Firstly, having a cache should accelerate your launch times, then, because cached shaders are not recompiled.
Secondly, drivers tend to not compile shaders until they are actually used, which cause stutter, but reduce compilation time a lot (a whole lot of shaders are apparently unused, usually). That one is debatable, but this is where the steam shader cache usually helps. There are ways to force it, so it could be what the game is doing here.
Indeed, if the game recompiles everything, you should just expect a very minor speed improvement on launch (assuming background processing of shaders is disabled, for a "fair" comparison: otherwise, launch speed should increase a lot).
Or maybe this is its last gasp and next time things will be golden.
shader cache was broken for me. it just kept downloading and piling up to 30GB in total, so I disabled it, and I didn't notice any game-breaking stutters, probably because my 16 threads CPU dealt with compiling shaders fast enough. If shaders can be shipped precompiled, why don't games do it?
if shaders should be compiled for your hardware ans software specifically, why even bothering with this precompiled cache system?
Short answer to the two questions is
1: As you mention in the 2nd question, it is both hardware and OS dependent. The combination of those that each player could have is obviously unknown to the game developer, as well as a large variable so adding those to the game would include a SIGNIFICANT file size increase for everyone with most of that data irrelevant to each user.
2: Of equal significance, the cache is more required for Linux as the programs and graphics are designed to work with (typically) Windows drivers. So pre-adding them as above is not useful for the majority of people. However, Steam building then for Linux already removes one major variable, and with the Steam Deck builds removes all variables as the hardware is consistent. They have the info on your system, so know which cache is applicable whether Steam Deck or PC.
Aside: this is a common issue for later console system emulation, and why some emulators can support shared graphical caches and some do not. I.E. how much a hardware/OS difference impacts the emulation ability determinesv whether it's even viable to share.
Since I enabled that I had pretty much forgot that shader pre-caching was a thing.
ok so now we have only a few hundred kb downloads and half an hour of shader pre-compiling in the background...for however many people use this feature and dare to have more than one game installed ... this seems a bit wasteful energy wise, does it not?It would happen during gameplay anyway, so it's only a waste if you don't play the games you have installed. If that's true, then you are wasting money and material on your hard drive too.
Your same thought has crossed my mind, too. It's partly the reason why I only keep games installed which I've played within the last 12 months.
Every time I restart the client I get 20+ downloads immediately, plus recompilation and today was no different. I restarted just now and got 21 downloads for a total of 2.6GB (with associated fossilize_replay processes).I noticed the same happening to me. I'm not sure if it has gone away because I haven't been able to get on Steam for a while. But you're not alone!
Or maybe this is its last gasp and next time things will be golden.
Every time I restart the client I get 20+ downloads immediately, plus recompilation and today was no different. I restarted just now and got 21 downloads for a total of 2.6GB (with associated fossilize_replay processes).I noticed the same happening to me. I'm not sure if it has gone away because I haven't been able to get on Steam for a while. But you're not alone!
Or maybe this is its last gasp and next time things will be golden.
Thanks for that!
I restarted the client just now to apply the latest beta update and for the first time in recent memory not a single download was done, so I have hope that things are indeed fixed.
See more from me