What does the Nvidia shader cache do?

Kol Khara

Junior Member
Jul 8, 2015
22
0
0
I've read the label, it stores compiled shaders on the disk so that the CPU doesn't have to recompile them later. The real question is, what does it actually do to the game?

If it needs you to compile the shaders first, then is it only useful if those shaders are used again?
If say you're in a Single Player game, as you're progressing level through level the CPU is constantly compiling new shaders and you never or rarely need those shaders for a second time. So not only might it not help at all, it could actually cause stuttering every time it needs to write those compiled shaders to the cache.

Of course I'm just guessing what it does.
 

Sabrewings

Golden Member
Jun 27, 2015
1,942
35
51
I've wondered that myself. Elite does a shader compute when it installs or your hardware changes.

I haven't really researched it, but my educated guess is that it's a compiled optimization for your particular hardware. Just a guess, though.
 

Headfoot

Diamond Member
Feb 28, 2008
4,444
641
126
Compiled GPU code is not going to be compiled as you are running through a level. Almost all big games are going to use (pre) compiled code. The only other ways would be something like Minecraft which uses the JVM (iirc? Pocket Version is C++ I think) which can work differently. JIT is slower than compiled code, sometimes quite substantially.

Games are going to compile shaders on load, or on install depending on the game.
 
Last edited:

Kol Khara

Junior Member
Jul 8, 2015
22
0
0
Compiled GPU code is not going to be compiled as you are running through a level. Almost all big games are going to use (pre) compiled code. The only other ways would be something like Minecraft which uses the JVM (iirc? Pocket Version is C++ I think) which can work differently. JIT is slower than compiled code, sometimes quite substantially.

Games are going to compile shaders on load, or on install depending on the game.

Then what does this in the Nvidia CP mean:
"Enabling shader cache reduces stutter"
 

Sabrewings

Golden Member
Jun 27, 2015
1,942
35
51
Found this:

ve been having a play around with this shader cache today and how it works.
My conclusion is its pretty much worthless for me.
Here is why...

I only play BF4 regularly.

Each time I load a new level in multi-player the shade cache creates a .bin file of 8mb, and the occasional .toc file of 2mb.

After approx 15 different levels are loaded the size reaches the limit of 128mb for autoclean of the shader cache, and it deletes ALL but the last .bin file that was created.
You are effectively back to square one at this point.

So if playing on a map rotation, unless you are playing the same few maps you likely will never see the benefit of the cached files, because my the time you get round to playing a map for the 2nd time.....you've probably hit the 128mb limit and the cache for that map has deleted itself

I could of course missed the point of how this cache works and benefits us, but would welcome the enlightenment if that's the case

oh and don't get me started on the choice of location for this cache...the User Temp dir.
For those that use ccleaner regularly, or like myself have my Temp folders on a RamDisk that doesn't save on shutdown....its pointless.

http://forums.guru3d.com/showthread.php?t=388292

I've had mine enabled for a decent while and I have nearly 200MB of cache data. I don't know how it does on a slower hard drive as I get 1400MB/s off my PCIe SSD.

Edit: More info.

Yes he is correct and not to mention the WinSxS folder on Win7 but we won't get into that disaster wink.gif


The deal with shader cache is that is designed to store compiled shaders. The process to initially compile the shaders uses CPU cycles.

This means depending on many factors, shader cache can help or hurt performance.

Examples:
»» If the CPU is fast enough and the shaders are simple enough, you might compile the shaders in real time faster than it would take you to read a previously compiled shader from a slow hard disk. There could even be instances where the CPU compiles in real time faster than reading from an SSD.

»» Same scenario as above, but the shaders are complex.. This makes the same scenario potentially provide different results if the CPU penalty is significant to re-complile a complex shader in real time. In this scenario it could help, assuming the storage is fast enough to be read from.

»» A slow CPU may not be able to compile even a simple shader without impacting frame rate which is sometimes why we see that some games start out a bit choppy and 'smooth out' over time after cache of the game engine comes into play. If the game engine doesn't offer caching then NVIDIA might help smooth frames. If the game engine does offer caching, NVIDIA may possibly assist, or negatively impact the frame rates/frame times.

»» GPU memory limitations. If there is simply very little GPU memory there may be no choice but to swap things to disk, otherwise the game/app may not run at all.


IMO I think the answer really DEPENDS, and that is also why it seems to help in some games/applications but not others. I wouldn't just disable it for all, you CAN configure this setting per game using the program settings of NVCP.

http://www.overclock.net/t/1553142/shader-cache-setting
 
Last edited: