Skip to content
Leonida Shaders: RDNA2 to SPIR-V and the Vulkan Graphics Layer
Official GTA VI screenshot, Rockstar Games. Game art, not build output: the Leonida project does not boot. · Project guide: the GTA 6 recompilation project.
  • Boots: No
  • Release: None
  • File: None

Leonida Shaders: RDNA2 to SPIR-V and the Vulkan Graphics Layer

Leonida translates 26,503 console shaders from RDNA2 to SPIR-V for Vulkan. This guide explains the shader pipeline, wave64 emulation and how translation is validated.

Contents
  1. The Shader Pipeline, Step by Step
  2. Wave64 and Why Graphics Cards Differ
  3. How Translation Is Validated
  4. Fallbacks for Older Hardware
  5. Conclusion
  6. Frequently Asked Questions

The Shader Pipeline, Step by Step

Graphics programs, called shaders, are the instructions that tell a graphics card how to draw triangles, shade pixels and compute effects. On Xbox Series hardware those programs are precompiled for AMD RDNA2 graphics. On a Windows PC running Vulkan, they must be SPIR-V, the shader language Vulkan understands. Leonida's largest single job is translating one form into the other, shader by shader, for the whole game.

The pipeline starts by carving shader containers out of the game's shader archive, without its encrypted table of contents. Each container is unpacked from its native format, disassembled with an LLVM disassembler for the console graphics target, and translated to SPIR-V. Leonida shaders work is counted exactly: 26,503 shaders in total, made up of vertex, pixel, compute, mesh and geometry shaders, each with a metadata index for pipeline creation. Translation and validation are separate steps, and both are reported separately, so a shader that translates but fails validation is not counted as done.

Wave64 and Why Graphics Cards Differ

Many of the game's shaders are wave64 shaders, written for 64 wide subgroups, which is the natural width on AMD hardware. NVIDIA and Intel graphics cards use 32 wide subgroups, so those shaders need wave64 emulation to be exact on the smaller width. The build detects subgroup widths and chooses emulation automatically, turning it on when any graphics card lacks 64 wide subgroups or when the width is unknown. On AMD's Windows driver, native wave64 is used on RDNA1 and RDNA2 when the runtime's own graphics card supports it, even if another card in the machine is narrower.

Emulation is exact for compute and mesh shaders, while cross half wave operations in vertex, pixel and geometry shaders remain approximate on 32 wide hardware. That sentence is the honest limit of the current translator, and it is stated in the project documentation rather than hidden. The choice of mode is saved next to the translated shaders, so changing it translates them again, and the default automatic mode can normally reuse shaders translated earlier.

How Translation Is Validated

Every translated shader is passed through the SPIR-V validator, and the project reports the validation count alongside the translation count. In the full corpus reruns, all 26,503 shaders passed validation after a fix for an identifier bound error, while an earlier Windows rerun passed all but two, with the same fix resolving them. Those numbers are the kind of evidence this project deals in: complete counts, rerun identifiers, and named fixes, not impressions.

Validation is not the same as correct visible output, and the project says so. The game's own shaders are checked by validation and by driver pipeline creation, not by what they draw, because nothing draws yet. Hand written test shaders, by contrast, are run on real graphics cards across more than thirty card and driver combinations, checking the translator's contract on operations from vertex fetch to wave masks. The measured status of the project page puts these two kinds of checking side by side, and the how the port is put together page shows where the translated shaders sit in the graphics layer.

Fallbacks for Older Hardware

Four fallback flags exist for devices that lack the newest Vulkan features. One drops a float control flag for devices whose pipeline check skips a shader without it. One reads barycentrics from an interpolated input for devices without the barycentric extension. One folds texel offsets into coordinates for devices without the maintenance extension. One runs mesh shaders as compute for devices without mesh shader support, and it turns itself on for Intel's Windows Vulkan driver, whose native mesh draws crash. Each fallback is documented, saved with the shaders it produced, and rerun when changed.

Fallbacks widen the hardware that can take part, at the cost of exactness or speed in the affected cases. They are not hidden settings, and they are not failures. They are the project's way of being honest about a hardware range that spans several generations, several vendors and several drivers, all of which must eventually run the same translated code.

26,503 Shaders, Counted by Stage

The shader counts are the most concrete numbers in the whole project, because they are measured, not estimated. The table below gives the breakdown exactly as the status table gives it. Translation and validation are separate steps: every shader was translated, and every shader passed validation in the full-corpus rerun.

Shader stageCount translated
Vertex shaders2,236
Pixel shaders12,101
Compute shaders2,689
Mesh shaders9,282
Geometry shaders195
Total26,503

Wave64 is the detail that decides whether those shaders run exactly on a given GPU. 23,841 shaders are wave64, which is exact on 64-wide subgroups, found on AMD hardware. On 32-wide subgroups, found on NVIDIA and Intel hardware, compute and mesh shaders stay exact with wave64 emulation, which is on by default there, while cross-half wave operations in vertex, pixel and geometry shaders are still approximate. The build flag that controls this, exactly as the README gives it, is --wave64-emulate, with values auto, on and off. Four fallback flags are forwarded to the translator the same way: --no-float-controls, --bary-fallback, --texel-offset-fallback and --mesh-compute. Each is saved next to the translated shaders, and changing any of them translates the shaders again.

Conclusion

Shader translation is Leonida's most completely measured achievement: 26,503 shaders translated and validated, with wave64 emulation for narrower hardware and documented fallbacks for older features. It is also a reminder of the project's limits, because validated shaders are not a running game. The translator has proven it can convert the game's graphics programs faithfully. The graphics layer that must run them, and the executable that must call them, are still being built.

Frequently Asked Questions

How many shaders has Leonida translated?

26,503 shaders, covering vertex, pixel, compute, mesh and geometry stages. All of them passed SPIR-V validation in the full corpus reruns.

What is wave64 emulation?

A translation mode that makes 64 wide subgroup shaders exact on graphics cards with 32 wide subgroups, such as NVIDIA and Intel cards. It is on by default where needed.

Does validated shader translation mean the game runs?

No. Validation checks the translated code, not visible output. The game does not boot yet, so no shader has drawn a frame of the game.