Emulator Issues #8053
closedShader Generation Slowdown/Framedrops/Stuttering
0%
Description
Game Name?
This effects most titles. Notably, in F-Zero GX, Metroid Prime 2/3 and several others, actual defects can be caused by the shader cache stuttering in dualcore mode. Other games just suffer from an inconsistent framerate that can be annoying to users as they play the game.
The Problem:
All modern graphics processors are flexible programmable processors, which use shaders as their application of choice. Dolphin uses shaders to emulate the entire fixed-function pipeline of the Gamecube/Wii GPU.
Updating the state of the GPU is exceedingly cheap on hardware, meaning there can be a lot of shaders being generated in short order.
It takes a reasonable amount of time to generate our shaders (with some maxing out at 30ms according to my tests in F-Zero GX) which guarantee that Dolphin cannot generate the shader in one frame. A second problem is that even when the shaders take less time to generate, there are often 30 - 40 shaders being generated in short order. Even at 1 - 2ms each, that would still lead to stuttering.
In order to partially quell this problem, Dolphin caches the shaders after they are generated. That means on subsequent uses, the shaders don't have to be generated. This does not work on all hardware configurations or drivers, though, and doesn't really solve the problem. Every time Dolphin updates, the cached shaders have to be thrown out currently anyway.