New Feature Release - Texture Cache Rewrite · yuzu
Hi yuz-ers! We’re very excited to offer you one of the biggest code rewrites in yuzu’s history: The Texture Cache Rewrite! Now available to our Early Access members, continue reading to learn more.
yuzu-emu.org
Hi yuz-ers! We’re very excited to offer you one of the biggest code rewrites in yuzu’s history: The Texture Cache Rewrite! Now available to our Early Access members, continue reading to learn more.
But what is the TCR?
yuzu started as a fork of Citra, so Citra’s texture cache (or rasterizer cache, as it was called at the time) was used in the early days of yuzu. However, this cache only supported OpenGL, so one of the first efforts when adding support for Vulkan was to make the code more generic, helping in GPU emulation.
When this was being worked on, we were still learning how the Nintendo Switch’s GPU worked (we still are, but even more so then). Some design decisions taken at the time stuck with the codebase making things harder to change in the future. It was also easier to break with unrelated changes.
So out with the old, in with the new. The previous implementation was no longer sufficient, so Rodrigo started working on a complete rewrite from scratch. This includes but is not limited to:
- Cleaner code. No more virtual calls or shared pointers, this allows for easier maintenance in the future.
- Proper handling for texture swizzling.
- Some operations are now done in the GPU instead of in the CPU, improving performance.
- Control over when to destroy textures.
- Previously, textures were removed from the cache on CPU writes, but now they are flagged as dirty. This allows yuzu to cache already visited image views and render targets, saving time.
- Multiple textures can coexist in the same address now.
- Aliased images are now emulated through copies on demand.
- Rendering to compressed textures is properly emulated.
- 3D BC4 textures are emulated with RGBA8.
- Rendering to texture views of different compatible formats is emulated without copies.
OK, but how does this help?
In short: it fixes a lot of graphical bugs, improves performance, and is not limited to any hardware configuration or driver in use. Improvements for everyone, once all parts are finished.