Leonida Translates GTA VI's 26,503 Shaders Before It Runs a Single Instruction

A high-school student's static recompilation project maps the Xbox Series build without executing it, translating every GPU program offline. The game still does not boot, and the project says so first.

9 min read • View on GitHub • More from ItsNotRexed

A wide black-ink landscape showing a squat console chip on a left cliff and a jagged range of vertical lines on a right cliff, joined by a half-finished bridge of identical small planks. A lone figure kneels at the growing edge laying one plank while an impossibly long queue of planks recedes behind them, and the gap in the middle of the bridge is still open. The image explains Leonida's core idea: a console build on one side, native PC on the other, tens of thousands of identical translation units, and a crossing that is not finished yet.
Console on one side, native PC on the other, 26,503 identical translation units in between. The open gap is the status report, drawn without a label.

Grand Theft Auto VI (Xbox Series) running natively on Windows, built on your PC from your own copy.

Leonida project maintainers, Project README · ItsNotRexed/Leonida README
Key Takeaways

Most recompilation projects start by getting code to run. Leonida inverts that. It carves 26,503 GPU programs out of a game package, disassembles the Xbox Series RDNA2 instruction set with LLVM, and translates every one to SPIR-V offline, before the game executes a single instruction. Meanwhile its PE loader maps the executable into memory and resolves imports without running any of it. The whole project is built around one rule: nothing runs until you ask, and everything is translated before you ask.

The Game Is Data Before It Is a Program

The loader's core rule is written at the top of its own header: mapping an image never runs code from the image. Leonida maps the Xbox Series executable into memory, applies relocations, resolves imports, and installs thread-local storage without executing a single instruction of the game.

That discipline shows up as a three-mode escalation ladder. --dry-run maps images, applies relocations, binds imports, and installs TLS, but runs nothing. --init adds each DLL's TLS callbacks and DllMain(DLL_PROCESS_ATTACH). --run adds the EXE's TLS callbacks and entry point on a game thread. You climb the ladder on purpose, and each rung tells you something about what broke before the next one.

The binding report prints every import classified as shim, host, module, or UNIMPLEMENTED. That last category matters. It flags unimplemented imports that return an HRESULT, so a developer can tell which failures the game can survive and which ones stop it cold.

Shutdown is deliberate too. The runtime calls ExitProcess(code) instead of returning, because a normal return runs the CRT's atexit table, which the game shares with the runtime, and those handlers would run against a stopped game. That is a detail that only surfaces after real debugging.

26,503 Programs Translated Before Anything Boots

Before the game executes anything, the toolchain carves 26,503 GPU programs out of the package. It unpacks the native RDNA2 shader programs, disassembles them with LLVM, translates each one to SPIR-V, and validates every result with spirv-val. The README reports that all of them pass.

That is the scale reveal. A modern title ships tens of thousands of shader variants, and every one has to cross from AMD's RDNA2 instruction set to the portable SPIR-V that Vulkan consumes. Leonida does this offline, on the user's machine, from the user's own package, before a frame is ever attempted.

The honest limitation is right there in the README. 21,545 of those shaders use wave64. On 64-wide subgroups the translation is exact. On 32-wide subgroups, cross-half wave operations are approximate. The project states this plainly rather than burying it in a footnote.

A Contract Written in Descriptor Slots

The descriptor layout is where the Python translator and the C++ runtime shake hands, and it is the cleverest design in the repo.

AMD's hardware defines T# (texture) and S# (sampler) descriptors. Leonida's translated shaders convert each one into an index by looking it up in a hash table, binding 2 of set 0. That index is then valid in every binding of its dimension, and each dimension has its own index space. One image, one index, any binding.

The layout encodes this with a formula: 8 + 3·dim + class. Four dimensions (2D, 2D-array, 3D, 1D) times three component classes (float, uint, sint) gives twelve storage bindings, numbered 8 through 19, each with 256 slots. Index 0 of every array is a fallback. The counts are not decorative: vk_pipeline_check.cpp creates every translated shader against them.

One descriptor, one index, every binding of that dimension. Leonida's bindless layout turns AMD's hardware descriptor model into a fixed Vulkan contract that the translated shaders can rely on.

The DLL That Exists Only to Hold a Slot

MSVC's __declspec(thread) compiles to a read of the thread environment block indexed by _tls_index. The OS loader assigns _tls_index values, and a manual mapper cannot assign one itself. This is the kind of constraint that stops a naive mapper dead.

Leonida's answer is a DLL that does nothing but exist. gta6rt_tls_host.dll declares a single thread-local variable so the OS reserves a module index. The loader loads it, reads the reserved index from its TLS directory, and patches the mapped image to use it. Each thread's TLS block is installed by swapping the helper's block for the image's template.

The constraint is documented rather than hidden: only one manually mapped TLS module can be live at a time. A second one is rejected instead of sharing and corrupting the slot. It is fragile, it leans on TEB layout, and the project keeps the workaround narrow instead of pretending it is general.

A close-up of a densely packed wall of numbered key slots, stippled for texture, with one unusually large empty slot at the center. A single small key held by a mechanical hand hovers in front of it, and a thin taut thread runs from the key's bow across the wall to a distant locked door rendered small and out of focus. The image depicts Leonida's TLS-host trick: borrowing one OS-assigned slot so a manually mapped image can be handed a key it could never cut for itself.
A manual mapper cannot cut its own TLS key, so Leonida borrows one numbered slot from the OS and threads the mapped image to it.

Built by Someone Who Cannot Rent a Car

The author is a high-school student who ports games to PC and web for fun. The GitHub profile describes an interest in exactly that, and lists Leonida alongside Hookshot, a native PC recompilation of the Switch 2 Ocarina of Time remake, and Blueshell.

The contributor list is real and active. Kam471 leads contributions, followed by slopgobblercobbler, BBareth, LouisRiverstone, and others. Pull requests show ongoing work on shader translation and GPU tests, including a wave64 change and a test measured on an RTX 4070 SUPER. The boldness of the target and the size of the community forming around it are the same story.

A black-ink hedcut-style editorial portrait of ItsNotRexed, the creator of Leonida, rendered from the GitHub avatar with stipple shading for skin and fine hatching for hair.

Why Leonida Is Not Like the Others

Several recompilation projects are playable or nearly playable. They target older consoles or different architectures, and they solve different problems. Leonida is the one aimed at a current-generation Xbox Series title and its RDNA2 shaders, and it is deliberately not playable yet.

ProjectTargetApproachStatus
LeonidaXbox Series, GTA VIStatic recompilation; RDNA2 shaders translated to SPIR-V; Xbox D3D12 emulated on VulkanDoes not boot. Shaders and assets translate; runtime incomplete
OpenShaoOriginal Xbox, Mortal Kombat: Shaolin MonksStatic recompilation from user's discReported playable
LARecompXbox 360, Midnight Club: Los AngelesRecompiled to Windows via ReXGlueFree roam and saves working
black-pcOriginal Xbox, BLACKNative run from user's default.xbeReported playable
SpaceAnimalsRecompSwitch 2, Star Fox remakeStatic ARM64-to-C++ recompilationEarlier, smaller scope
HookshotSwitch 2, Ocarina of Time remakeNative PC recompilation, same authorRelated effort, different platform

Leonida is the only entry targeting a current-generation console and translating its GPU ISA, and the only one that is not playable. That is not a weakness to apologize for. It is a different category of work.

What "Does Not Boot" Actually Means

The status table marks booting, story mode, and playability as No. The graphics layer has no shader views, pipelines, draws, or swapchain yet. What exists is the offline half: shaders translate, assets export, the loader maps and binds imports against reimplemented shims.

That makes Leonida research infrastructure, not a port. The README leads with the limitation instead of hiding it, and that framing is the reason to trust the parts that do work. When a project tells you first that it does not run, the claims about what it does translate are easier to believe.

Early. The game does not boot.

Leonida project maintainers, Project README · ItsNotRexed/Leonida README — Project status