• Find an incredible deal for Black Friday or Cyber Monday? Share those epic bargains with the community by posting them in this forum thread!

Question Can cached shaders cause game stability issues?

Been trying to learn something about shaders cached on the system. I'm curious where the code comes from that is used when compiling them, for one thing. For instance: can a shader compiled from an older driver cause issues when you update drivers.

I know you can delete the cached shaders (if you can find them as it varies based on system and game) as they'll just be re-compiled next time you start Windows or a game. The only downside I've seen is a slight slowdown or stuttering next time playing the game until they recompile.

What I don't understand is if there's any real benefit from deleting for fixing stability issue after a driver update, or maybe even a failed overclocking attempt. If shaders in the cache were compiled using code from the old driver that's not relevant to the new driver is what I'm thinking.

But it would only make sense to compile after installation if the shader depends on other code or settings that can vary on a client system...so I'm curious what that might be.

Any information would be helpful... but even more so informative. It's an interesting thing to know about.
 
Last edited by a moderator:
driver version doesnt have anything to do with shaders incompatibility
...
That doesn't make sense because Radeon Settings even has an option to reset shader cache...and when it's all done the AMD shader cache folder (created by the driver installation) is 'refreshed' with new (by date) .bin files. And, when I update drivers it sometimes creates new .bin's while leaving the old ones and sometimes not.

But if not, what then is responsible for compiling the shaders and what libraries, provided by what, does it draw routines from when it compiles them?

It seems obvious it has to be done peculiar to each computer else they'd not have to compile them on the computer but could distribute them with the software that needs/uses them. So if it's peculiar to the computer and something changes and it doesn't get recompiled couldn't that create a possible incompatibility?

So what changes most often... driver updates. Twice a month, if you let it.
 
...
But if not, what then is responsible for compiling the shaders and what libraries, provided by what, does it draw routines from when it compiles them?
game engine and cpu is responsible for compiling shaders
libraries are DirectX (HLSL) or OpenGL (GLSL) or Vulkan (SPIR-V)
your game compiles them, driver will just save it for another time
so if game next time asks for compiling shader through API (DX/ogl/vulkan) driver will send back already precompiled shader instead of compiling it from scratch

It seems obvious it has to be done peculiar to each computer else they'd not have to compile them on the computer but could distribute them with the software that needs/uses them. So if it's peculiar to the computer and something changes and it doesn't get recompiled couldn't that create a possible incompatibility?
alot of games already have precompiled shaders, some games compile them during map loading, some compiles them in real time as u move around, some saves its own caches
shader compatibility is based on DirectX/OpenGL/Vulkan version
cpu/gpu doesnt really matter, noet even driver version has any effect on shaders
if u run directX9 it gets compiled under directx 9 pixel/vertex shaders
its just mathematical code, hardware doesnt really matter, if your gpu wouldnt support it, game wouldnt even run
if game gets updated with some shader changes, drivers will create new cache as that will be new shader which doesnt have any cache yet (different instruction layout)

as for reseting shader cache....well if u play lots of games...later on u may end up with some cache backups for games which u no longer play

as for performance goes...some games may actually give u reduced performance if u enable it, as they can use small shaders (only few instructions) and cpu will compile it faster in real time then getting it from harddrive
 
game engine and cpu is responsible for compiling shaders
libraries are DirectX (HLSL) or OpenGL (GLSL) or Vulkan (SPIR-V)
...
My question is still the same: where do those libraries come from? Does the game provide them? Does the OS? Does the GPU driver package contain libraries used to do the compiling? All of the above?

I understand the CPU 'does' the compiling. I also understand that shaders are just small, efficient program routines for doing parallel mathematical calculations on the GPU.
 
My question is still the same: where do those libraries come from? Does the game provide them? Does the OS? Does the GPU driver package contain libraries used to do the compiling? All of the above?
games can include libraries, but its standardized API, games dont change those APIs
microsoft changes API for directX, any change usualy means different DirectX number 8/9/10/11/12 or feature set (10.0, 10.1 etc)
opengl and vulkan comes from khronos group, its opensourced, it also differs in version numbers...any change to api means different opengl/vulkan version.
gpu drivers talks between game engine and API. its a middle man which can do some changes on the fly without noticing game engine or api

shaders have to be hardware supported, its gpu instructions
 
....
as for reseting shader cache....well if u play lots of games...later on u may end up with some cache backups for games which u no longer play
Interesting Reddit thread I ran across while crawling the web for more info on this. Doesn't seem to be a lot of controversy or argument, so I think most of it is pretty much correct at least.

https://www.reddit.com/r/nvidia/comments/8xufkn View: https://www.reddit.com/r/nvidia/comments/8xufkn/why_dont_games_just_compile_all_shaders_during/


One point that I got is sometimes shaders must be compiled 'in-game' since it depends on (GPU?) pipeline state. That helps to understand why multi-core CPU's can be a big help if the game is created to recognize the hardware threads available and put shader compiling on different ones... that should help with stuttering problems.

They also make a point it gets info from the driver, and those shaders that ARE cached have to be re-compiled at driver updates so it appears it does get data from the driver.
 
..
opengl and vulkan comes from khronos group, its opensourced, it also differs in version numbers...any change to api means different opengl/vulkan version.
....
OK..Khronos group develops(?) the libraries and provides them open-source. But how do they get onto my computer so the game (or whatever) can source them when compiling a shader is necessary? I can understand directX libraries furnished by MS with dX (or whatever), maybe with OS updates, maybe those updates that sometime come with new games. But what about openGL or Vulkan libraries... do they come with the game too? Wouldn't they come as a component of GPU driver updates?

Or maybe it's possible to come from any of them...OS, driver package OR game, maybe even game launcher (Steam, Uplay, etc.).
 

ASK THE COMMUNITY

TRENDING THREADS