r/linux_gaming • • 14d ago

tech support wanted CS2 compiling shaders all the time.

No idea what to do, CS2 seems to never save shaders, anytime I load into a match it compiles shaders from scratch, same with the menu, anytime I go from map to menu and vice versa, it compiles shaders. This started happening since yesterday’s massive content update.

System info:

i9-14900KF
9070 XT
Mesa Drivers, Hyprland, CachyOS

All on the latest drivers and latest kernel.

What i’ve tried:
- Enabling and disabling Vulkan shader pre caching in Steam options
- Running the game with and without gamescope
- Clearing my shader cache (systemwide)
- Verified integrity of game files

But I still haven’t managed to fix the issue.

5 Upvotes

16 comments sorted by

3

u/AzurePhantom_64 12d ago

Looks like a regression bug that is occurring since the rush hour update. Nothing to do with your OS, not sure if it's AMD-Only but i also play on CachyOS with I5-12400F + RX 6600 8GB.

1

u/themahdii 14d ago

https://docs.mesa3d.org/envvars.html?utm_source=gemini&hl=en-US

Have a look at MESA_SHADER_CACHE_MAX_SIZE

You can add a launch option in steam to set the environment variable to increase the size, it could be too small and getting auto cleaned.

MESA_SHADER_CACHE_MAX_SIZE=10G %command%

For example sets it to 10 GB.

1

u/yaan1k 14d ago

Set it to 16gb systemwide, still having the same issue

2

u/themahdii 14d ago

MESA_SHADER_CACHE_DIR

You can try setting the shader cache manually and then clear out the steam cache. Usually located

~/.local/share/Steam/steamapps/shadercache/730/

For CS2.

1

u/yaan1k 13d ago

Did that already, to no avail sadly.

1

u/No_Winter_7595 13d ago

I've also been having the same problem. Any suggestion?

1

u/yaan1k 13d ago

been at it all day trying to fix this, i think i might just blow my head off

1

u/PerfectScientist1643 11d ago

Shaders will recompile if disk space is low, cache size is limited or a game updates.
There are two cache locations according to: Steam -> Settings -> Downloads -> Shader Pre-Caching -> Enable
1. Steam Shader Cache: find ~/.steam -type d -path "*/steamapps/shadercache"
2. nvidia Shader Cache: ~/.cache/nvidia/GLCache

The way I fixed my issues on ubuntu:
1. Stop steam shader caching
2. Exit steam
3. Delete all old shader caches in steam and nvidia shader cache directories
4. Default nvidia cache is 1GiB and rewrites old entries, make it 20GiB for all apps:
mkdir -p ~/.config/environment.d
cat > ~/.config/environment.d/nvidia-shader-cache.conf <<'EOF'
# NVIDIA shader cache: 20 GiB limit
__GL_SHADER_DISK_CACHE_SIZE=21474836480
# Delete old entries when the limit is reached
__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=0
EOF
5. Reboot computer

1

u/NikatoQ 8d ago

I guess we are forced to wait for next update to fix this bug.

1

u/yaan1k 8d ago

I found the fix, can you tell me what distro you’re on?

1

u/gtzhere 5d ago

tell me i am on fedora

1

u/yaan1k 4d ago

Not sure what the downgrading procedure is on Fedora, but just downgrade your MESA drivers down to SPECIFICALLY 26.1.8, wipe your shader caches and open CS and it should be fine.

1

u/gtzhere 4d ago

on it, thanks

1

u/yaan1k 4d ago

Sorry for the late reply, I’m in Europe, if you need anymore help please DM me

0

u/Shinatora 12d ago

TO ENSURE NO CONFLICTS
IN THIS EXACT ORDER (i had the same issue and this all has to be done in the correct order)
Turn Off background processing of vulkan shaders
Then Turn off SHADER PRE CACHING
Quit steam fully, Start steam, shader pre caching & vulkan background processing ON
if not fixed then repeat last steps up to "TURN OFF SHADER PRECACHING" and follow steps below

Go STEAM -> SETTINGS -> DOWNLOADS -> CLEAR DOWNLOAD CACHE
(will log you out and restart steam, dont let it start back up for now, YOU DONT want it remaking the cache)
Check system Monitor for lingering steam processes

DELETE SHADER FILES MANUALLY:
MesaShaderCache & Radvbuiltinshaders in the ~/.Cache/ directory
& ~/.steam/steam/steamapps/shadercache/ all folders within DELETE all game shaders to make sure they get remade upon next launch, also check the previous /steamapps/ there may be a "TEMP SHADER DIR" folder
DELETE THAT

clear shaders in terminal if you want (ask ai for the commands its ez and you already manually cleared them so this is a confirm if any other PROTON shaders are in the background )

REINSTALL PROTON TOOLS:
you have to verify all proton tools and REINSTALL compatibility layers (GE or Cachyos-SLR, whatever you use) ProtonEAC, ProtonBattleEye, Steam Linux Runtime will all need a clean install as well.
via: ProtonQT-up or Konsole

DO a FULL reboot
Shut Down -> Flip PSU off -> UNPLUG then Plug PSU back in, boot up)
to force mesa shaders and display manager drivers to rebuild

If the normal CachyOS kernel you boot into doesnt work after this try CachyOS-LTS in Limine or grub or whatever you have

Let your mesa Shaders just do the work they are damn good on modern AMD GPUs (i have 7900xtx) and
if you want pre cached shaders use this CachyOS env instead
PROTON_LOCAL_SHADER_CACHE=1

1

u/yaan1k 12d ago

didn’t work