Steam Deck

Steam Deck

RedBaronK™ Nov 25, 2023 @ 9:08pm
Stuttering after deleting shader cache
I followed a guide online and downloaded DeckCleaner 1.2 to clear my shader cache. Now I am getting stutters occasionally while playing non steam games I added via desktop. Anyone know why? I was under the impression Deck Cleaner only deletes and frees up storage from shader cache left behind by uninstalled apps, not active ones.
< >
Showing 1-15 of 16 comments
Buju Nov 25, 2023 @ 9:19pm 
According to what I see in its code[github.com], it simply runs
rm -r /home/deck/.steam/steam/steamapps/shadercache
. This means it simply deletes the entire shader cache, regardless of which programs' shaders were cached.

I'm not sure why this needs to have a whole github repo for 1 line.
Last edited by Buju; Nov 25, 2023 @ 9:20pm
RedBaronK™ Nov 25, 2023 @ 10:35pm 
Originally posted by Buju:
According to what I see in its code[github.com], it simply runs
rm -r /home/deck/.steam/steam/steamapps/shadercache
. This means it simply deletes the entire shader cache, regardless of which programs' shaders were cached.

I'm not sure why this needs to have a whole github repo for 1 line.

Great, the entire shader cache? Ugh. So then it broke something, because now my game stutters slightly while something loads during gameplay. Should have just left it alone, it was working fine before this.

So if this code doesn't make any changes, and only deletes the entire shader cache, shouldn't the problem be solved once the shader cache is rebuilt? Does the deck re-download the shaders or do I have to rebuild them myself? I tried reinstalling the game and it's still stuttering.
RedBaronK™ Nov 25, 2023 @ 11:03pm 
I don't know if this matters, but I checked out the shader cache folder via desktop mode, and all the folders of games downloaded and installed directly from steam have significantly larger shader cache folder sizes than the games installed via non-steam games mode. There's also no stuttering on steam games while the non-steam games stutter, I'm guessing this is because one has more shaders downloaded vs the other.

Any reason why there is such a large discrepancy in shader file sizes between the two?
deaddoof Nov 25, 2023 @ 11:29pm 
Originally posted by RedBaronK™:
I don't know if this matters, but I checked out the shader cache folder via desktop mode, and all the folders of games downloaded and installed directly from steam have significantly larger shader cache folder sizes than the games installed via non-steam games mode. There's also no stuttering on steam games while the non-steam games stutter, I'm guessing this is because one has more shaders downloaded vs the other.

Any reason why there is such a large discrepancy in shader file sizes between the two?

Steam compile shaders for all instances, so you will never experience hitches. Your non-steam games never experience all moments where you need to compile shaders.

I would enable
RADV_PERFTEST=gpl
in games where you didn't download the shader cache. You should experience less shuttering.

https://www.phoronix.com/news/RADV-GPL-Getting-Good

https://www.supergoodcode.com/through-the-loop/
Buju Nov 26, 2023 @ 2:00am 
Originally posted by RedBaronK™:
Originally posted by Buju:
According to what I see in its code[github.com], it simply runs
rm -r /home/deck/.steam/steam/steamapps/shadercache
. This means it simply deletes the entire shader cache, regardless of which programs' shaders were cached.

I'm not sure why this needs to have a whole github repo for 1 line.

Great, the entire shader cache? Ugh. So then it broke something, because now my game stutters slightly while something loads during gameplay. Should have just left it alone, it was working fine before this.

So if this code doesn't make any changes, and only deletes the entire shader cache, shouldn't the problem be solved once the shader cache is rebuilt? Does the deck re-download the shaders or do I have to rebuild them myself? I tried reinstalling the game and it's still stuttering.

Yes, it seems it only deletes the shader cache. The problem should be gone after seeing each shader compilation stutter once, as the cache is rebuilt.

I suggest that if you run a script, try to view its code first and if it's short enough, try to understand what it's doing before you run it. In the case of "DeckCleaner", which simply has 1 line of real functionality, it is very easy to figure out. In this way, you can be empowered to understand how you're affecting your system.
WarnerCK Nov 26, 2023 @ 2:37am 
Originally posted by RedBaronK™:
Any reason why there is such a large discrepancy in shader file sizes between the two?
Some game videos are in a patent-encumbered format. Valve re-encode them (well, record the Vulkan pipeline of the videos playing) and include them with the pre-cached shaders.
RedBaronK™ Nov 26, 2023 @ 8:01am 
Originally posted by deaddoof:
Originally posted by RedBaronK™:
I don't know if this matters, but I checked out the shader cache folder via desktop mode, and all the folders of games downloaded and installed directly from steam have significantly larger shader cache folder sizes than the games installed via non-steam games mode. There's also no stuttering on steam games while the non-steam games stutter, I'm guessing this is because one has more shaders downloaded vs the other.

Any reason why there is such a large discrepancy in shader file sizes between the two?

Steam compile shaders for all instances, so you will never experience hitches. Your non-steam games never experience all moments where you need to compile shaders.

I would enable
RADV_PERFTEST=gpl
in games where you didn't download the shader cache. You should experience less shuttering.

https://www.phoronix.com/news/RADV-GPL-Getting-Good

https://www.supergoodcode.com/through-the-loop/

Do I enter that command via Konsole in desktop mode?


Thank you all for the responses so far, I've been reading up a lot on this and it seems like everyone is saying once you play enough of a game it will rebuild the shaders... Obviously a lot of people mention that that's not feasible since who wants to play the same game twice, but the funny thing is, the game in question is GTA San Andreas 1.0 PC (not the remaster) and the very first time I installed it I never had a single stutter.... So I don't get how the first run didn't have any shader compiling stutters meanwhile post shader deletion does have stutter, makes no sense.

Then there's the question of shouldn't the game be old enough and hardware on the deck strong enough that even if it is compiling new shaders on the fly, I wouldn't notice it?

Really wish I didn't use deck cleaner... I also ready shader killer has the functionality I wa looking for which is deleting ONLY uninstalled games and leftover shaders.
Buju Nov 26, 2023 @ 11:51am 
GTA San Andreas? That's a pretty old game and shouldn't have any shader compilation lag. It sounds like something else must have happened other than deleting the shader cache.
RedBaronK™ Nov 26, 2023 @ 2:46pm 
Hey guys I solved it! So the problem was that I had GTA on TDP limit mode to save battery before the wipe... When I wiped the cache out, the compilers rebuilding the cache was taxing on the CPU due to the limited power. When I turned TDP off, it used maximum CPU power and there were only slight stutters here and there as it was building back up.

Thanks all for the help!
deaddoof Nov 26, 2023 @ 3:17pm 
Originally posted by RedBaronK™:
Originally posted by deaddoof:

Steam compile shaders for all instances, so you will never experience hitches. Your non-steam games never experience all moments where you need to compile shaders.

I would enable
RADV_PERFTEST=gpl
in games where you didn't download the shader cache. You should experience less shuttering.

https://www.phoronix.com/news/RADV-GPL-Getting-Good

https://www.supergoodcode.com/through-the-loop/

Do I enter that command via Konsole in desktop mode?

Thank you all for the responses so far, I've been reading up a lot on this and it seems like everyone is saying once you play enough of a game it will rebuild the shaders... Obviously a lot of people mention that that's not feasible since who wants to play the same game twice, but the funny thing is, the game in question is GTA San Andreas 1.0 PC (not the remaster) and the very first time I installed it I never had a single stutter.... So I don't get how the first run didn't have any shader compiling stutters meanwhile post shader deletion does have stutter, makes no sense.

Then there's the question of shouldn't the game be old enough and hardware on the deck strong enough that even if it is compiling new shaders on the fly, I wouldn't notice it?

There are many ways to set environment variables. Each one is different depending on your needs. This method works in game mode but I do not know if it will screw up steam input recognition.

Example
For non steam games.

Target: konsole
Starts In: .....
Launch options: --fullscreen

I want to unset LD_PRELOAD. Make LD_PRELOAD = ""

Target: env
Starts In: .....
Launch options: LD_PRELOAD="" konsole --fullscreen

For steam games, add the variables before %command%

In Settings Gear -> Properties

General -> Launch Options:

RADV_PERFTEST=gpl %command%

https://wiki.archlinux.org/title/steam

https://help.steampowered.com/en/faqs/view/7D01-D2DD-D75E-2955

https://userbase.kde.org/Session_Environment_Variables

https://wiki.archlinux.org/title/environment_variables

Really wish I didn't use deck cleaner... I also ready shader killer has the functionality I wa looking for which is deleting ONLY uninstalled games and leftover shaders.

Do not regret. Deal with it. People who are great at technology just deal with all their mistakes whatever they are.
nicoper Nov 26, 2023 @ 3:33pm 
Originally posted by RedBaronK™:
Great, the entire shader cache? Ugh. So then it broke something, because now my game stutters slightly while something loads during gameplay. Should have just left it alone, it was working fine before this.

So if this code doesn't make any changes, and only deletes the entire shader cache, shouldn't the problem be solved once the shader cache is rebuilt? Does the deck re-download the shaders or do I have to rebuild them myself?
If you want to nuke shader cache, it's much better to do it through Steam's own settings menu. (Settings -> Downloads -> Shader Cache)
Disable the toggle, wait a few seconds, and re-enable it.
All cached shaders will be deleted, and Steam will re-download them for all installed games. (maybe don't do this on a mobile hotspot or other metered connection)
If you delete the folders manually (like you did with the script) Steam won't know that they've been deleted and won't download them again.
RedBaronK™ Nov 26, 2023 @ 9:00pm 
Originally posted by nicoper:
Originally posted by RedBaronK™:
Great, the entire shader cache? Ugh. So then it broke something, because now my game stutters slightly while something loads during gameplay. Should have just left it alone, it was working fine before this.

So if this code doesn't make any changes, and only deletes the entire shader cache, shouldn't the problem be solved once the shader cache is rebuilt? Does the deck re-download the shaders or do I have to rebuild them myself?
If you want to nuke shader cache, it's much better to do it through Steam's own settings menu. (Settings -> Downloads -> Shader Cache)
Disable the toggle, wait a few seconds, and re-enable it.
All cached shaders will be deleted, and Steam will re-download them for all installed games. (maybe don't do this on a mobile hotspot or other metered connection)
If you delete the folders manually (like you did with the script) Steam won't know that they've been deleted and won't download them again.
But steam will only download shaders for games officially bought off of steam, not non-steam games correct? During my research into fixing this mess I was reading that valve essentially pairs up shader cache with every game sold by them so that it speeds up shader compiling speed to make it all run without stutters and smoothly on the deck.... I read this is one of the advantages of buying from valve vs installing manually off of ISO or any other method that involves playing as you build and compile shaders.
RedBaronK™ Nov 26, 2023 @ 9:02pm 
Do not regret. Deal with it. People who are great at technology just deal with all their mistakes whatever they are.

Not gonna lie, I did learn a lot about this entire shader business... But it felt like I was forced to while going crazy trying to fix this lol.
deaddoof Nov 26, 2023 @ 9:13pm 
Originally posted by RedBaronK™:
Do not regret. Deal with it. People who are great at technology just deal with all their mistakes whatever they are.

Not gonna lie, I did learn a lot about this entire shader business... But it felt like I was forced to while going crazy trying to fix this lol.

It's fine. Graphic drivers are compilers. Compilers turn source code into runnable programs. D3d, Opengl, and Vulkan all compile GPU code into runnable GPU programs.

Shader hitches are the graphic driver compiling graphic code before you can run them. The process is essential to how GPU work. Shader cache is essential because it helps you avoid recompiling the same shader you just ran. It helps reduce CPU overhead.

Because Valve controls the OS and hardware, Steam has the ability to download pre compiled shader which means your steam deck have near 0 CPU overhead for running GPU code. Valve provides a huge performance benefit for steam games.

However, Valve has been investing a ton a money in Linux GPU drivers in general. You can enable GPL shader pipeline which makes shader compiles super fast. Even with overhead, you should not have shader compile hitches at all.

GPL shader or shader cache isn't the only way to get rid of shader hitches.

Look at Dolphin monster idea below. Emulate the whole GPU

https://dolphin-emu.org/blog/2017/07/30/ubershaders/
RedBaronK™ Nov 27, 2023 @ 9:24pm 
Originally posted by deaddoof:
Originally posted by RedBaronK™:

Not gonna lie, I did learn a lot about this entire shader business... But it felt like I was forced to while going crazy trying to fix this lol.

It's fine. Graphic drivers are compilers. Compilers turn source code into runnable programs. D3d, Opengl, and Vulkan all compile GPU code into runnable GPU programs.

Shader hitches are the graphic driver compiling graphic code before you can run them. The process is essential to how GPU work. Shader cache is essential because it helps you avoid recompiling the same shader you just ran. It helps reduce CPU overhead.

Because Valve controls the OS and hardware, Steam has the ability to download pre compiled shader which means your steam deck have near 0 CPU overhead for running GPU code. Valve provides a huge performance benefit for steam games.

However, Valve has been investing a ton a money in Linux GPU drivers in general. You can enable GPL shader pipeline which makes shader compiles super fast. Even with overhead, you should not have shader compile hitches at all.

GPL shader or shader cache isn't the only way to get rid of shader hitches.

Look at Dolphin monster idea below. Emulate the whole GPU

https://dolphin-emu.org/blog/2017/07/30/ubershaders/

Hey thanks for the explanation, I've been reading up on RADV_PERFTEST=gpl you mentioned and from all I've read, it sounds like it's a good thing... What I'm kind of surprised about is how it's been out for MONTHS and people were talking about how this will be on by default "in the future"... But these posts were from like 10 months ago.

What's the reasoning behind valve not turning it on by default? Are there any downsides?
< >
Showing 1-15 of 16 comments
Per page: 1530 50

Date Posted: Nov 25, 2023 @ 9:08pm
Posts: 16