Dolphin, the GameCube and Wii emulator - Forums

Full Version: What exactly causes shader cache stuttering?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Would it be possible to write SPIR-V (Vulkan's Intermediate Language for Native Representation of Graphical Shaders and Compute Kernels) instead of shader's source?
SPIR-V still needs to be compiled; it's just an IR.
Is not compiling IR much faster?
Parsing/lexing should take negligible time compared to the actual compilation process, in almost any language. I think the main purpose of SPIRV is to help eliminate all the bugginess caused by the proliferation of awful frontends, plus allow the creation of common optimization passes that aren't specific to a particular GPU. But those still have to run, and still take time, I think.
(04-03-2015, 12:29 PM)NaturalViolence Wrote: [ -> ]Wait the compiling is done by the drivers not dolphin?  There are many games where the stutters often last several seconds, is that entire time seriously spent with the application waiting for the drivers to compile a shader?  What on earth could the drivers possibly be doing specifically that would take that long?
One does not question compilation speed.
[Image: compiling.png]
What about the "quick and dirty" alternative of sharing the source code for the shaders? And then Dolphin compiles all missing shaders for the game when it's started?

Also, just to be sure, Dolphin writes the shaders async to HDD, right? If it doesn't/wouldn't that would be one major source for stuttering.
Writing to the disk is always async unless you flush afterwards; the OS handles buffers in between and will often write it seconds later than you actually requested the write. it's reading that's inherently synchronous by default.

Sharing shader sources might be possible, but they can change significantly between Dolphin versions, and Dolphin has many workarounds in its shader generation that depend on the precise features supported by a given graphics driver, or even based on the current graphics settings (e.g. "per pixel lighting" changes shader generation, IIRC).
(04-08-2015, 03:57 AM)JosJuice Wrote: [ -> ]
(04-08-2015, 03:47 AM)bomblord Wrote: [ -> ]What about pre-compiled shaders? I would be willing to play through a few games and then upload my shader cache. Get enough people and you could have shader packs that people could download. How big do the shader caches typically run? If their not too big you could download them when it detects said game in your library similar to how it downloads a picture that represents the game.
The compiled shaders are different not only between games but also between Dolphin versions, graphics cards and graphics backends. A shader pack would be useful for so few people that it's not worthwhile. (Also, the pictures for the games are not downloaded.)

Couldn't this be solved by creating a compile list that is downloaded, and on first run, the computer will compile all the shaders before starting the game? Before compiling, the code is the same for every gpu, so just cache the code and store it in a shader pack for future use.
The problem is that Dolphin doesn't know which shaders it will have to compile ahead of time, until the game needs it. So no, Dolphin cannot compile all shaders before starting the game. And the code would not always be the same: it can still change depending on the graphical settings, backend and Dolphin version, and also if you've changed your GPU.
And BTW, phire already started working on uber shaders. It's still WIP and it hadn't received updates for a while but as far as I tested most (if not all) stuttering are gone...
Pages: 1 2 3 4