protonscr

MESA_GLSL_CACHE_DIR points to an invalid (non-existent) directory due to case-sensitivity issues

steamclosed Steam client
ValveSoftware/steam-for-linux#5178 · opened 2017-09-23 by kparal · updated 2017-10-12 · 6 comments · github
1 matching comments, n / p to jump
Kkparal 2017-09-23 github

Your system information

  • Steam client version (build number or date):
    steamver
    (please allow copy&paste)
  • Distribution (e.g. Ubuntu): Fedora 26
  • Opted into Steam client beta?: No
  • Have you checked for system updates?: Yes

Please describe your issue in as much detail as possible:

After some recent Steam update the Mesa shader cache stopped working for Steam games, making their load times very long. I found out that Steam is overriding MESA_GLSL_CACHE_DIR but pointing it to an invalid directory.

For example, for Natural Selection 2:

$ pgrep Natural
3410 /data/Steam/SteamApps/common/Natural Selection 2/ns2_linux32
$ cat /proc/3410/environ | tr '\0' '\n' | grep MESA
MESA_GLSL_CACHE_DIR=/data/Steam/steamapps/shadercache/4920

(I use /data/Steam as my primary game library, but that's not the point here, the problem is present even when using the default library location of ~/.local/share/Steam).

The problem is, there's no /data/Steam/steamapps/shadercache/4920 directory:

$ ls /data/Steam/steamapps/shadercache/4920
ls: cannot access '/data/Steam/steamapps/shadercache/4920': No such file or directory

Because there's no /data/Steam/steamapps:

$ ls /data/Steam/steamapps
ls: cannot access '/data/Steam/steamapps': No such file or directory

But there is /data/Steam/SteamApps! :

$ ls /data/Steam/SteamApps/shadercache/4920/
nvidiav1

Due to some included hack, I found out that by renaming SteamApps to steamapps, all my library is still loaded and shader cache starts working. Steam probably looks for both folders and accepts any of them as valid. But it hardcodes the MESA_GLSL_CACHE_DIR variable to steamapps rather than using the actual name of the directory.

I checked with a new user account that Steam now creates steamapps folder by default. I assume that SteamApps has been the default in the past, and it was changed to steamapps. But rather than renaming the directory, Steam devs decided to accept both as valid. But this peculiarity was not remembered when implementing MESA_GLSL_CACHE_DIR functionality.

Please fix. Either make MESA_GLSL_CACHE_DIR point to the right folder, or rename SteamApps to steamapps for all existing users.

Thanks.

Steps for reproducing this issue:

  1. try to use Mesa shader cache on Linux while having SteamApps dir (as used to be the case in the past) instead of the steamapps dir (as it is the case now)
  2. see that the MESA_GLSL_CACHE_DIR is exported to an non-existing directory, and it's not populated, therefore the shader cache is not being used (you can also see that games still load slow, or with GALLIUM_HUD that they make lots of shader compilations on every start)
PPlagman 2017-09-23 github

Thanks for the report; how long ago was this Steam library folder created? I'm surprised you ended up with SteamApps; we might need to fix them up in the wild.

Kkparal 2017-09-23 github

I guess since the time you announced Steam for Linux? :) The directory is obviously modified now, but I see some files around from Feb 2013, which is the time when I created a Steam account.

PPlagman 2017-09-24 github

This is fixed, next Beta that contains cache fixes should have the fix.

Kkparal 2017-09-27 github

Thanks. If you want me to test it, just let me know once the new Beta is released and I'll give it a try.

PPlagman 2017-09-27 github

Can you test with today's Beta client update?

Kkparal 2017-09-28 github

With the latest Beta, this works correctly with both steamapps and SteamApps dirs. Thanks.