cancel
Showing results for 
Search instead for 
Did you mean: 

PC Drivers & Software

ThreeDee
Paragon

A good explanation of shader caching stutters after installing new drivers

I just came across a great explanation of how and why you might suffer from stutters for a few minutes after updating your drivers and/or launching a new game you've never played before

https://www.reddit.com/r/Amd/comments/zitv7x/people_dont_understand_shader_cache_stuttering/

 

People don't understand shader cache stuttering and compilation

 

A lot more people are starting to become aware of Unreal 4's DX12 shader compilation stutters, but they don't understand what they are, why they happen and why they notice stuttering in various games with different drivers and GPUs.

To do an ELI5, cache is when software creates its own reference point for a location of an index, so that it can quickly reference that cache instead of doing a complete end to end analysis of the entire code. That's why having something cached is always preferable to doing a clean run/scan/compile. It's also how human memories work through neurons linking. That's also caching .

There are 3 types of cache when it comes to games and GPUs.

The more popular topic recently has become DX12 State Pipeline caching. One of the reasons modern APIs like DX12 and Vulkan can be faster or at least, less CPU bound, than older DX11-OpenGL is because they HAVE to create these caches as reference points, so CPUs have to do less thinking/searching to send data to the GPU. This is almost exclusively done on the engine side and it's up to the developers to precompile shaders so they aren't generated on the fly at the time a new effect is introduced, that would otherwise generate perceived stutters and sudden drops in FPS and GPU usage. The shaders should preferably be compiled before you load in-game or asynchronously, so there aren't stalls/stutters.

Leaving DX12 aside, what a lot of people on AMD, Nvidia and Intel are experiencing, but more so on AMD's end from what I read (I mostly browse AMD's subreddit after all, even if the experience should be applicable to all), is driver shader compilation. Modern GPU drivers, when run in DirectX9, 10, 11, possibly OpenGL and previous to DX9 also, do driver side shader caching. This means the driver will always create a cache when running a new game, so that Loading Times are reduced (less new things to look up) and generally provide more consistent frametimes, not necessarily boost performance. Due to this, ANY AND EVERY TIME you'll start a new game for the very first time, it will appear to stutter somewhat in the first 5-10 minutes. You just need to understand that this is how it works, that it will go away, that AMD drivers aren't broken and that Nvidia and Intel experience the same thing. Shader Caching is GOOD. It improves the gaming experience.

Lastly, we need to talk about Shader Cache Invalidation. This applies to both DX12/Vulkan State Caching and pre DX12/Vulkan driver side caching. Whenever you install a new driver, the driver has new code and references to go by. So whatever cache was generated before, now with the new driver, it's invalidated. The caching process needs to begin anew. It works exactly as before tho. So be calm, and keep gaming.

DXVK Async is a great tool for a lot of DX9-10-11 games, even on Windows, because it does asynchronous shader compilation. So if a game would have either stutters due to the engine shader compilation or just from general streaming stutters, DXVK Async would reduce these stutters.

DgVodoo also does a similar good job in DX12 for older DirectX1 to 9.0c games, alongside Glide also.

And finally, as for Unreal Engine 4. Most stuttering previous to more recent DX12 titles were streaming problems. That got mostly fixed in time with newer, better versions of Unreal 4. Or were never an issue with competent developers. See The Coalition for Gears of War 4, 5 and Tactics.

Recently, The Callisto Protocol was a disastrous launch on PC due to DX12 shader compilation stutters (among other things also). It's possible it really was an error with the final release build. Most DX12 games don't stutter all the way through a game's entire length. To give an example, go play Hellblade: Senua's Sacrifice in DX12. The game is VASTLY LESS CPU BOUND in DX12 than DX11, but it will stutter rather severely in the first 5-10 minutes, regardless if you use RT or not. But after those 10 minutes? The game will be smooth as butter. Aside from those rare instances you'll see a new effect for the first time, in that split second. And it's really rare. It's not ideal, but this is how most games that don't precompile shaders in DX12, work. And it's NOT. THAT. BAD. in the end. It can be better, but you need to understand how this works.

Thank you for coming to my Tech TED talk.

EDIT: Inconsistent framepacing, also known as judder, is a different topic entirely. Just throwing this out there. It can also be somewhat perceived/felt as micro intermittent stutter, but it's not related to Shader Caching or engine streaming issues.


ThreeDee PC specs
2 Replies
Kleonmen
Adept I

Hey you seem to know your way around this. When i play cs go it load shaders. For the first time it stutters while loading . After like 15 minutes its fine. But the next day after closing the pc it loads shaders again. Isnt it supposed to save them?

0 Likes

it should be caching some shaders at least .. but it could also depend on your setup .. what hardware you are running .. type of drive(s) the game is installed on and/or the shader cache is located on .. how much RAM in your system as well as VRAM on your GPU .. how full your drives might be .. background programs running .. what antivirus software you are using if it's not the built in Windows Defender ...etc

You could try running DDU and removing all past/present GPU drivers (Nvidia and AMD depending what you have had installed on this install of Windows) .. reboot and then do a clean install of the latest GPU drivers from either Nvidia.com or AMD.com .. 

You can also manually reset shader cache in the Radeon software and IF Nvidia's control panel has a similar option .. do it in there too IF you are running an Nvidia GPU

IF you are running a DDR3 setup .. be sure to have AHCI enabled on your SATA controllers so you get better performance out of your drives

 


ThreeDee PC specs