ValveSoftware / steam-for-linux

Issue tracking for the Steam for Linux beta client
4.21k stars 174 forks source link

Each time launching a non-steam game, a new shader cache file is created. #10486

Open ayssia opened 7 months ago

ayssia commented 7 months ago

Your system information

Please describe your issue in as much detail as possible:

I noticed that certain non-Steam games were taking up a very large amount of space in the shadercache folder, and after checking that folder, I found a lot of nearly identical foz files under ~/.steam/steam/steamapps/shadercache/<non-steam-game-appid>/fozpipelinesv6/steamapprun_pipeline_cache.RANDOMHASH.

Further testing revealed that each time the game was launched, a nearly identical foz file was regenerated in that folder. After multiple runs, the space taken up by that folder became very large.

It feels very strange that the generated shader cache can't be reused but has to be regenerated per launch.

Steps for reproducing this issue:

  1. Add any non-steam game to Steam.
  2. Run the game and close it. Repeat multiple times.
  3. Check the ~/.steam/steam/steamapps/shadercache/<non-steam-game-appid>/fozpipelinesv6/steamapprun_pipeline_cache.RANDOMHASH folder, there should be multiple (nearly) identical foz files there, like this: steamapprun_pipeline_cache_daf05e8efce08522.1.foz, steamapprun_pipeline_cache_daf05e8efce08522.2.foz, steamapprun_pipeline_cache_daf05e8efce08522.3.foz, the only difference is the suffix number.
Crayphish commented 2 weeks ago

I found this thread while hunting this same problem down when my own non-steam game was recompiling shaders from scratch every boot. Seconding this on client version 1721173382, also Steam Deck. Testing the same game "HoloCure" between Steam and non-Steam versions shows differing behavior in the shadercache/fozpipelinesv6 folder.

Steam version creates one fozpipelinesv6/steamapprun_pipeline_cache.904f69d2b1b44b65/steamapp_pipeline_cache.foz with mask 755 in shadercache dir, and does not create new files on subsequent runs.

Non-steam version creates multiple fozpipelinesv6/steamapprun_pipeline_cache.904f69d2b1b44b65/steamapprun_pipeline_cache_<UNKNOWNHASH>.<incremental>.foz files with mask 644 every launch, creating a new pipeline cache file from scratch each time the game is run.

This is not a perfect comparison between binaries since the game versions unfortunately differ, but I see the same behavior across all non-steam games. Result is that non-steam game pipeline cache folders grow endlessly, and performance is poor every time the game is started since all shaders are compiling from scratch as they are first run.