I have some questions regarding the OpenGL Shader Disk Cache, but first some background:
I have been using it for various games (mostly via Wine). At first I let games store everything in default location ($XDG_CACHE_HOME/.nv/GLCache). However I quickly found out that having multiple games use the same location means that the caches for my games disappeared. Reading up about it, I read that the maximum per cache size is 256mb, and that it gets garbage collected when it gets full. (but right not I can’t find where I found that information, so I’m hoping it is still correct). I also know you have to rebuild the cache when driver changes and/or I think when the game has been updated.
So, I switched to using separate paths per game by setting __GL_SHADER_DISK_CACHE_PATH different for each game. This allowed me to have separate caches per game. This meant my caches survived longer, and I didn’t have to rebuild them so often. However, lately I’m noticing that for a specific game: Overwatch on Wine, I’m losing my shadercache without the driver changing or game changing. This happens when it gets bigger then ~150mb (Seen it hit 175mb), the next time I log in it is back to 0mb and you have play a couple of hours to fill it again, this means stuttering, lots of stuttering, especially the first game.
So now my questions:
- Am I correct that the maximum size is still 256mb? (Is it smaller / bigger?)
- At what point does it get garbage collected?
- Are there other reasons why the cache might be getting deleted?
- If the max is 256mb, why is it so small?
- Could we get an increase? Or a way to set a bigger maximum with an ENV variable?
Now, I’m just citing one game, but I’m sure it won’t the only game that has that many shaders. And the purpose of the shader cache gets defeated if you constantly have to rebuild it.