Yuzu Shader Cache Work 2021 -
While Vulkan is generally the preferred renderer for most users, yuzu also supports OpenGL. OpenGL and Vulkan maintain separate, non-interchangeable caches. OpenGL offers multiple backends, and these do share the same cache. On NVIDIA GPUs, users can build up a shader cache using the GLASM (assembly) backend, which compiles shaders with less stutter, and then switch to the GLSL backend for better performance.
: These files are often portable between different users.
Translation takes time and computing power. The first time a game asks for a specific shader, your PC stutters or drops frames while Yuzu does the math. This is shader compilation stutter . yuzu shader cache work
With this feature enabled, when Yuzu encounters an uncompiled shader, it skips the translation on the main rendering thread. Instead, it offloads the compilation to background CPU cores.
Sometimes, your graphics card driver (NVIDIA/AMD) also caches shaders. If you update your GPU drivers, the driver may invalidate its own cache, forcing Yuzu to re-translate everything even if Yuzu’s cache exists. After a driver update, expect a temporary performance drop as the cache rebuilds. While Vulkan is generally the preferred renderer for
Switch games use shaders designed for NVIDIA Maxwell hardware. Yuzu translates these into PC-compatible code (GLSL for OpenGL or SPIR-V for Vulkan) as you play.
Instead of compiling shaders only when they are first encountered in-game, Yuzu can adopt a different strategy: precompiling shaders. With this approach, when you launch a game, Yuzu will compile all the shaders in its transferable cache before the gameplay even begins. This can lead to a very long initial loading screen—potentially over a minute for a game like Xenoblade Chronicles 3 with a large pipeline cache. However, the payoff is a completely stutter-free gaming session because no on-the-fly compilation is ever required. On NVIDIA GPUs, users can build up a
NVIDIA drivers have a default maximum size for their disk shader cache. For users who want to ensure that no shader is ever evicted from the cache, yuzu includes a feature to set the __GL_SHADER_DISK_CACHE_SKIP_CLEANUP environment variable, which allows for an unbounded shader cache size. This was implemented for the Windows version of yuzu to prevent malware from easily deleting the driver cache.
A cache for Tears of the Kingdom can reach 500MB or more. This is normal. However, if your cache exceeds 2GB, Yuzu may load slowly. Occasionally, use Tools > Delete > Shader Cache to reset if you are experiencing crashes.
: This contains hardware-agnostic instructions that can technically be shared between different computers.