Dolphin, the GameCube and Wii emulator - Forums

Full Version: Why use Ubershaders?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I know the question may sound retarded, but there's something I've been wondering for a while. As I understand it, Shader Compilation causes stuttering during gameplay, so once the shaders have been compiled, they are stored in the Shader Cache until next time to avoid this problem. So then, what is the point of ubershaders when there is an option to compile the shaders before the game starts? If all the shaders are compiled then would there not be a reason to use ubershaders? Or do they just guess what shaders will be needed and not actually compile them all?
(08-31-2018, 08:19 AM)Silent Hell Wrote: [ -> ]So I know the question may sound retarded, but there's something I've been wondering for a while. As I understand it, Shader Compilation causes stuttering during gameplay, so once the shaders have been compiled, they are stored in the Shader Cache until next time to avoid this problem.

True. Now think about this: every single time you update Dolphin you´ll have to suffer this rather uncomfortable experience.

That´s where ubershaders come in.
The GPU in the gamecube and wii don't use shaders. It has a massive amount of fixed function state - hundreds of billions of combinations - and as there was no cost for the GPU to switch these states (unlike more modern GPUs that had their own shaders) there was no need to try to be careful about the total number of combinations used.

With that huge number of combinations, there's simply no way to guarantee we have a compiled shader ready for all of them. Plus some games use many thousands of different combinations in common areas - the compiled shaders dolphin and the GPU driver generate aren't large, but they do have a size that could multiply up quickly. To the point where a 'complete all-game' shader cache will be larger than any sane storage available, and sill likely to be missing some combinations.

And we don't /know/ what the needed shader state is until it's being drawn - it may be you haven't happened to see this particular material with this particular game state in the context of everything else going on that may affect GPU state. It may be some of the state differences give zero visible difference, but we don't know that until we've already drawn it....

On some games it's perfectly normal to see new GPU states even after completing the whole game once 100% due to the large number of things that could affect this state in non-obvious ways.