Read-only copy of github.com/fauxn9/Project-Echidna · An attempt to bring a popular game to life on pc
  • Rust 99.3%
  • PowerShell 0.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-12-02 15:29:38 +01:00
.cargo Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
.githooks Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
apps/leonida Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
crates Kachow : LEONIDA_UNIFORM_SMEM=N — plafond de marquages par programme (le pilote NVIDIA refuse des programmes marqués, « not enough memory ») ; éteint par défaut 2026-12-02 15:29:38 +01:00
docs Kachow : bannière du README (docs/banner.jpg) 2026-12-01 01:54:06 +01:00
scripts Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
tests/fixtures/hle-probe Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
xtask Kachow : bannière du README (docs/banner.jpg) 2026-12-01 01:54:06 +01:00
.gitattributes Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
.gitignore Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
.leonida-root Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
Cargo.lock Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
Cargo.toml Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
Get-D3D12.cmd Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
Get-NVIDIA-DLSS.cmd Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
leonida.example.toml Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
LICENSE Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
README.md Kachow : bannière du README (docs/banner.jpg) 2026-12-01 01:54:06 +01:00
rust-toolchain.toml Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00
rustfmt.toml Base : mandy (ProjectLeonida/mandy, d3d12/) au commit ef329958 2026-11-29 05:21:36 +01:00

Project Echidna

Project Echidna

A performance-focused fork of the Leonida Direct3D 12 runtime (the VIctory lineage). It runs the Xbox Series build of Grand Theft Auto VI natively on Windows, tuned for a mid-range PC that is a few years old: an Intel Core i7-10700K, a GeForce RTX 2060 with 6 GB, 16 GB of RAM, PCIe 3.0 and no Resizable BAR.

The fork is developed locally under the name Kachow. Its goal is a steady 30 frames per second on the Series S profile, without ever trading RAM for frame rate.

Important

This repository contains no game code, no game data and no NVIDIA SDK files. You need your own dump of a copy of the game that you own. This project does not explain how to obtain one and will not help you do so. Grand Theft Auto VI is a trademark of Take-Two Interactive Software and Rockstar Games. This project is not affiliated with Rockstar Games, Take-Two, Microsoft or NVIDIA.


Contents


Where it stands

December 2026. All numbers are measured in-game on the target PC.

Today
Calm scenes, lightest settings 24-26 fps
Busy scenes 14-19 fps
Fast profile at the standard test save (13 runs) 12-16 fps, median frame about 66 ms (about 15 fps)
Dips at loading transitions 4-10 fps: the game commits more memory than the PC has, and Windows pages to the SSD
What limits the frame the graphics card itself: its own timestamps add up to about 70 ms of work per frame
A steady 30 fps not yet: see the roadmap

The RTX 2060 is the limit, even though it does not look busy. nvidia-smi shows about 62% of its shader units, 9% of its memory bandwidth and 83 W of its 160 W in use. Turning off shadows, volumetrics, particles, decals, distant objects and vegetation changes nothing measurable (64.6-64.9 ms per frame against 65.6-65.8 ms).

Yet the card's own timestamps around every submission add up to 69.7 ms of GPU work per frame (median of 81 seconds of play; 36.5 ms for the best tenth, 84.3 ms for the worst). Only one second in 81 stays under the 33.3 ms that 30 fps needs. The leading hypothesis, not measured yet: about 7.2 GB of resources sit in system RAM, and the card stalls reading them across PCIe 3.0, which nvidia-smi does not count as work. The breakdown is under Where a frame goes.

Two identical runs can differ by 2 to 4 fps, so every number above comes from several runs or from the per-phase timing lines of the log.


The target PC

Every setting and every measurement in this fork is made for one fixed machine:

Part Model What it means for the runtime
CPU Intel Core i7-10700K (8 cores, 16 threads, Comet Lake) No CLWB, RDPID or SHA instructions: the loader emulates or patches what the title uses. One fast thread matters more than many cores, because frame preparation is mostly serial.
GPU NVIDIA GeForce RTX 2060, 6 GB (Turing) 32-wide waves, DLSS Super Resolution, no DLSS frame generation. The texture budget is set for 6 GB.
RAM 16 GB The game alone commits 17.4-17.8 GiB. RAM is the scarcest resource, so no change may cost RAM for frame rate.
Bus PCIe 3.0, no Resizable BAR Every copy between system memory and the card goes over this link. Without ReBAR, the CPU cannot map VRAM.
Storage NVMe SSD (Samsung 970 EVO) Fast paging still causes dips when RAM runs out.

Other machines may run it too. The settings below aim at 6 GB NVIDIA cards with 16 GB of RAM.


What this fork changes

On top of ProjectLeonida/mandy ("Leonida Continued"), the base this fork starts from. Every change can be switched off with a LEONIDA_* environment variable (older VICTORY_* names still work), and each one is documented in a comment where its switch is read.

Performance

Change Switch (default) Measured on the target PC Origin
Lighter descriptor heap pass:
- spans tracked per buffer copy instead of rebuilding and re-merging 16 slices each pass;
- refreshes queued in one batch (one lock instead of about 4,200);
- slots picked with bit masks;
- per-phase timing of the pass in the log
always on; LEONIDA_BATCH_KEPT=0 turns off the reuse of a batch's touched ranges buffer-view part of the pass 11.4 → about 5.5 ms per frame:
- spans 6.05 → about 1.7 ms;
- slot selection 0.81 → 0.08 ms;
- refresh queueing 0.56 → about 0.2 ms;
RAM unchanged (about 3 MB of tables removed)
Kachow, 30 Nov 2026
GUARD_BATCH: a submission sets the write guards of every range it refreshes at once, instead of one guard per refresh LEONIDA_GUARD_BATCH (on; 0 goes back to one guard per range) ported and verified (stress tests, one in-game run without fatal errors, batches really formed); gain not measured here yet. Upstream: 156 → 60 guards per frame, 20 → 7 ms across threads readmet3xt-lab/foxhound dd8c48a, from trustno1-coder/VIctory-NVIDIA a6567e07
The skipped-shader list in every build, not only with diagnostics: the fast play build keeps the skips that water and BVH skinning depend on always 22.1-22.7 → 24.3-26.4 fps in calm scenes, 12.5-15.8 → 14.3-19.2 fps in busy ones, median 86.2 → 70.7 ms Kachow
Texture size cap LEONIDA_TEXTURE_MAX (off) at 1024 px, with 1536 MB of buffer copies: 84 → 74 ms per frame (prison prologue) earlier Kachow base
RDNA forms of float operations on NVIDIA LEONIDA_FAST_FLOAT (off) 73 → 71 ms per frame earlier Kachow base
Skipped-shader lists read from a file (@file) LEONIDA_SKIP_* lists — earlier Kachow base
DLSS presets E and F (CNN models, lighter on RTX 20 cards, softer) LEONIDA_DLSS_PRESET — earlier Kachow base

Memory

Change Switch (default) Measured on the target PC
Lazy host command lists: a submitted list no longer keeps a host list until its Reset, which takes one from the pool LEONIDA_LAZY_LISTS (off) committed memory median 18,232 → 17,596 MB, peak 19,636 → 18,581 MB, same frame rate
Physical RAM reserve for texture staging: a new staging buffer is not taken when it would leave less free physical memory than the reserve LEONIDA_STAGING_RAM_RESERVE_MB (off) without it, the first run left 351 MB free (median) and read 1,100 pages from disk per second

Measurement tools

  • Per-phase timing of the heap pass, written after each frame line of the log in the play build. It costs almost nothing.
  • GPU timestamps per submission (LEONIDA_CARD_SPANS=1, diagnostics builds). They show how long the card really works on each submission.

The scripts in scripts\ already apply upstream's tuned set for NVIDIA cards. On the target PC, Kachow adds the settings below. Pass them with -More @{ ... }; they take precedence over the scripts' own values.

Setting Value Why
LEONIDA_TEXTURE_BUDGET_MB 3072 A 6 GB card, of which Windows and the desktop keep about 0.6 GB.
LEONIDA_TEXTURE_MAX 1024 (512 for the fast profile) Frees VRAM for buffer copies: 84 → 74 ms per frame. At 512, VRAM drops from 5.6 to 4.9 GB and RAM by 0.8 GB, for about +1 fps in busy scenes and softer textures up close.
LEONIDA_FAST_FLOAT 1 RDNA forms of float operations: 73 → 71 ms. Shaders are translated again once.
LEONIDA_LAZY_LISTS 1 About 0.6 GB less committed memory.
LEONIDA_PORT_GUARD 1 avatarmanz's fix 6 (guard locks): 17.8 → 18.4 fps on the earlier base.
LEONIDA_PORT_JOURNAL 1 avatarmanz's fix 7 (descriptor heap sync started at the title's call): 17.8 → 18.5 fps on the earlier base.
LEONIDA_STAGING_RAM_RESERVE_MB 2048 Keeps 2 GB of physical RAM free from texture staging buffers.
LEONIDA_SMALL_BUFFER_POOL 0 Pooled blocks held about 0.5 GB of slack (3.2 GB of blocks for 2.7 GB in use).
LEONIDA_LATE_WAIT_LISTS 512 512 title lists in flight before waiting for the card (upstream: 256). Preparation 37.1 → 33.9 ms, same RAM.
LEONIDA_WINDOWS_BAR_MB 0 No Resizable BAR on PCIe 3.0, so no memory windows in CPU-visible VRAM.
LEONIDA_CARD_WINDOWS_MB 0 No windows in the card's shared memory: with 16 GB of RAM, its limit (half the RAM) filled within a minute on other PCs (0x8007000E).
LEONIDA_NO_WATCHDOG 1 The title's watchdog ended sessions on slow frames.
LEONIDA_SECTION_MB 16 Title physical pages in 16 MB sections (upstream: 111.6 → 94.4 ms per frame while walking).
LEONIDA_PIPELINE_WAIT_MS 10000 A new shader is waited for once instead of skipping its draws, so no objects are missing in cutscenes.
LEONIDA_DLSS_PRESET E CNN model, lighter on RTX 20 cards (softer).

For example, Series S rendering at 1280x720 with DLSS to 1080p:

scripts\play-S-720p.ps1 -Exe '<path to your dump executable>' -More @{
    LEONIDA_TEXTURE_BUDGET_MB = '3072'; LEONIDA_TEXTURE_MAX = '1024'; LEONIDA_FAST_FLOAT = '1'
    LEONIDA_LAZY_LISTS = '1'; LEONIDA_PORT_GUARD = '1'; LEONIDA_PORT_JOURNAL = '1'
    LEONIDA_STAGING_RAM_RESERVE_MB = '2048'; LEONIDA_SMALL_BUFFER_POOL = '0'; LEONIDA_LATE_WAIT_LISTS = '512'
    LEONIDA_WINDOWS_BAR_MB = '0'; LEONIDA_CARD_WINDOWS_MB = '0'; LEONIDA_NO_WATCHDOG = '1'
    LEONIDA_SECTION_MB = '16'; LEONIDA_PIPELINE_WAIT_MS = '10000'; LEONIDA_DLSS_PRESET = 'E'
}

Close other heavy applications before playing: with 16 GB of RAM, every gigabyte they hold is paged out during play.


Getting started

Requirements

  • Windows 10 or 11, x64.
  • A CPU with AVX2.
  • A Direct3D 12 GPU with shader model 6.6 and mesh shaders. NVIDIA RTX cards are the tested path; RTX 20 cards work.
  • 16 GB of RAM at least, with the recommended settings.
  • Rust. The toolchain version is pinned in rust-toolchain.toml, and rustup installs it by itself.
  • The MSVC build tools (Visual Studio Build Tools, "Desktop development with C++").
  • Your own dump of the game (Xbox Series build).

1. Clone and configure

git clone https://github.com/fauxn9/Project-Echidna
cd Project-Echidna
copy leonida.example.toml leonida.toml

Edit leonida.toml (it is git-ignored):

  • game_dir is your dump of the game;
  • cache_dir holds translated shaders and pipelines. Default: %LOCALAPPDATA%\leonida\cache;
  • data_dir holds the title's saves. Default: %LOCALAPPDATA%\leonida\data.

Every path must be outside the repository: the tools refuse otherwise. The environment variables LEONIDA_GAME_DIR, LEONIDA_CACHE_DIR and LEONIDA_DATA_DIR take precedence over the file, and LEONIDA_CONFIG picks another file. leonida config shows the resolved configuration and checks it.

2. Windows 10 only: a newer Direct3D 12

Windows 10's own Direct3D 12 stops at shader model 6.5 and refuses every translated pipeline. Run Get-D3D12.cmd once. It downloads Microsoft's D3D12 Agility SDK 1.614.1 (about 22 MB) from nuget.org and checks it against its SHA-256 and Microsoft's signature. leonida.exe then asks Windows for that runtime. Windows 11 needs nothing.

Run Get-NVIDIA-DLSS.cmd once (a double click is enough). It downloads NVIDIA's DLSS files, about 70 MB, from NVIDIA's own GitHub (NVIDIA/DLSS, NVIDIA-RTX/Streamline) into nvidia-sdk\, which is git-ignored. The next start builds the runtime again with DLSS in it.

Those files fall under NVIDIA's licences, which are saved beside them. This repository does not carry them and may not. A build with DLSS is for your own use, not for passing on. Without DLSS the game still runs, but its 720p picture is only stretched to the screen.

4. Build

The play scripts build the runtime by themselves on the first start (scripts\build-nvidia.ps1: the diag profile with diagnostics, the F1 settings menu and DLSS). For the fastest build, without diagnostics:

cargo build --locked --profile play -p leonida --features dlss    # thin LTO, no diagnostics

The dlss feature needs LEONIDA_DLSS_SDK to point at the files Get-NVIDIA-DLSS.cmd fetched.

5. Translate the shaders and build the pipelines (first time)

The play scripts do this before every start (-NoPrecompile skips it). By hand:

target\diag\leonida.exe shaders <the title's shader archives>   # every shader into the cache: 10-20 min, once per translator change
target\diag\leonida.exe warm --used                             # the pipelines earlier runs drew with: once per driver or build change

Both commands can be stopped and pick up where they left off. Runs write down the pipelines they meet (LEONIDA_PIPELINE_BOOK=1, set by the scripts), so the next start builds them ahead of time. warm without --used builds every pipeline the title ever created (about 40 minutes on the target PC).

6. Play

scripts\play-S-720p.ps1 -Exe '<path to your dump executable>'

Add the recommended settings with -More. In the game:

  • F1: settings menu. The arrow keys pick and change, Enter applies.
  • F3: numbers panel (frame times).
  • F4: in-game menu (DLSS sharpness, frame cap, screenshots, Lua mods).
  • Esc: pause, and gives the mouse back to Windows.

Resolution scripts

One script per console profile and render height, all taking the same switches as scripts\play-nvidia.ps1 (-Exe, -More, -NoPrecompile, -Adapter, -WindowsBarMB, -DryRun, ...):

Script Console World drawn at Notes
play-S-480p.ps1 / play-S-540p.ps1 Series S 853x480 / 960x540 softer; on the target PC with DLSS, 540p stops at start (the title's upscaler requires 720p on Series S)
play-S-720p.ps1 Series S 1280x720 used on the target PC, with DLSS to 1080p
play-S-1080p.ps1 Series S 1920x1080 stops at a breakpoint at start (reported upstream, also on 12 GB cards)
play-X-*.ps1 Series X 480p to 2160p much slower at the same height: the title uses the bigger console's detail, effects and memory budgets (about 13.5 GB of game memory: not advised with 16 GB of RAM)

Keyboard and mouse

The game only knows an Xbox controller, so the runtime maps keyboard and mouse to it, laid out as in GTA V on PC. A controller keeps working alongside at all times. Click in the window once to give it the mouse.

Key On foot In a vehicle
W A S D move accelerate, brake and reverse, steer
Mouse look look
Left / right button shoot / aim shoot from the vehicle / —
Space jump, climb handbrake
Left Shift / Left Ctrl run / crouch lean forward / back on a bike
F enter a vehicle leave it
E interact horn
Q take cover radio
R reload, melee —
Tab (hold) weapon wheel weapon wheel
C look behind look behind
M map map
Esc or P pause pause
Arrow keys, Enter, Backspace phone and menus phone and menus
Z HUD and objective HUD and objective

Where the runtime cannot tell whether you sit in a vehicle, Caps Lock switches between the on-foot and driving keys.

Command-line reference

leonida.exe is both the runtime and a set of tools:

Command What it does
leonida run <exe> --execute --console series-s Prepare, map, bind and start the title (--console series-x for the bigger profile). Without --execute, it stops after binding.
leonida shaders <paths> Translate every shader into the cache, so that no run has to.
leonida warm [--used] [--jobs N] [--limit N] [--again] Build the host pipelines the title created, so that the driver's disk cache has them before a run needs them.
leonida translate <paths> [--validate] [--pipelines] [--list] Run every shader through the translator and report what it cannot handle yet.
leonida shader-info <paths> [--disasm] Find shader containers and report their layout, or their decoded instructions.
leonida inspect <file> [--imports] [--exports] Summarise one PE image: headers, sections, imports, TLS, build id.
leonida census [paths] [--missing] Which imports of the title the runtime covers.
leonida replay ... Run a captured frame's GPU work again (diagnostics builds; see docs/replay.md).
leonida config Show the resolved configuration and check it.

How it works

The title is the console's own x86-64 executable. The runtime runs its original code natively inside its own process, replaces the console's system libraries with its own implementations, and translates its graphics work to Direct3D 12:

Part Role
crates/leonida-loader Maps, binds and runs the title's original x86-64 image natively. It emulates or patches the CPU instructions the host lacks (CLWB, RDPID, MWAITX, CLZERO).
crates/leonida-hle The Xbox system API surface the title imports, reimplemented.
crates/leonida-gpu D3D12.X command streams and GPU memory, translated onto host Direct3D 12. It keeps host copies of title memory up to date, submits the work and brings results back. The pipeline book and library behind warm live in its pipeline/ module.
crates/leonida-shader Xbox shader containers (DXBC/DXIL and precompiled RDNA 2 / GFX10 code) to host DXIL (emit/lower.rs).
crates/leonida-pipeline Offline conversion of your game data into host formats, with a content-addressed cache.
crates/leonida-menu, crates/leonida-lua The F4 in-game menu and sandboxed Lua 5.4 mods.
apps/leonida The executable and its command-line tools.

The hard part: unified memory

On the console, the CPU and the GPU share one memory: when the game writes a buffer, the GPU reads it directly. On a PC, the RTX 2060 has its own 6 GB. For each of about 40 submissions per frame, the runtime has to:

  1. Find what the game changed. Title memory is reserved with write watching: Windows keeps a dirty bit per 4 KiB page, and the runtime asks for it with GetWriteWatch (watch.rs).
  2. Copy the changed ranges to the card. Every buffer a draw uses has a persistent host copy (shadow.rs), and the ranges a submission reads are brought up to date before it runs.
  3. Submit and wait. Submitted lists run on the card and are waited for, so that the title's fence signals complete at once (queue.rs).
  4. Copy results back that the game may read (the relay).

These steps run one after the other: the card waits for the CPU to prepare, then the CPU waits for the card. That costs time on the CPU side. The bigger cost turned out to be on the card itself: about 70 ms of GPU work per frame, probably spent reading resources that sit in system RAM across PCIe 3.0. The roadmap starts there.


Where a frame goes

Fast profile, standard test save, full screen, median of 85-151 s runs, 13 runs (30 Nov 2026). The budget for 30 fps is 33.3 ms per frame.

Item Measured Source
Frame 60-81 ms, median about 66 ms (about 15 fps); dips to 4-10 fps at transitions frame line of the log
Submission thread, preparation 39-45 ms (52 ms in a slow run) frame line
... of which buffer copies 13-16 ms for 32-39 MB per frame frame line; shadow::wide in 17% of stack samples
... of which the driver (about 40 ExecuteCommandLists per frame) about 11-15 ms stack samples: nvwgf2umx 15-20%
... of which write watching about 5-9 ms stack samples: GetWriteWatch and ask_* 6-12%
... of which the heap pass 9-14 ms (buffers about 5.5, textures 1.4-7.5) "heap buffers pass" line
... of which waiting at present about 8 ms stack samples: WaitForSingleObject 11-13%
Card "busy" (something queued) 77-89%, about 50-55 ms per frame "card's clock" line
Card's own work per frame (1 Dec 2026, diagnostics build) median 69.7 ms, 36.5 ms best tenth, 84.3 ms worst tenth; about 21 submissions GPU timestamps around each submission (LEONIDA_CARD_SPANS=1)
Card load as nvidia-smi sees it SM 62%, memory 9%, 83 W of 160, 2,040 MHz: misleading, see above nvidia-smi dmon
System RAM used by the card (1 Dec 2026) 7.2 GB in use of a 7.5 GB shared budget diagnostics run
Relay (results coming back) waits for the card 35-41 ms per frame "relay" line
Game thread about 50% of its time in a Sleep(1) loop: it waits for the frame stack samples
RAM 17.4-17.8 GiB committed on a 16 GB PC memory log

Roadmap: what comes next

Done

  • Lighter descriptor heap pass (30 Nov 2026): 11.4 → about 5.5 ms per frame for its buffer-view part.
  • GUARD_BATCH ported from foxhound (30 Nov 2026). Its gain on the target PC is still to be measured.
  • Measured where a frame goes (above), and ranked every known lever by gain, RAM cost, risk and effort.
  • Reviewed the forks readmet3xt-lab/foxhound and OBERON-gg/miranda for what this fork does not have yet.
  • Phase 0: measured the card's own work (1 Dec 2026) with GPU timestamps around every submission, after a full pipeline warm: about 70 ms per frame. The card is the limit, not the CPU, so the submission-chain rework is on hold.

Now: finding where the card's 70 ms go

Phase 0 changed the plan. Two measurements come before any new code:

  1. Split the card's time by kind of work: the title's own command lists, our hashing and compare passes on buffer copies (about 480 per frame), and uploads. This needs timestamps per kind of list.
  2. Find which resources the card reads from system RAM: CPU-visible heaps, host copies, write-combined memory. The most-read ones can then move into VRAM, where about 1 GB of the 5.1 GB budget is free, without taking RAM from the PC.

What does not help for now:

  • A lower internal resolution: 540p stops at start on the Series S profile, whose upscaler requires 720p, and cutting effects already changed nothing.
  • DLSS Super Resolution: it only helps a card limited by pixels, which this one is not.

On hold: reworking the submission chain

Phase 0 showed the rework alone cannot reach 30 fps: even fed without a single gap, the card would stay near 70 ms per frame. Removing the gaps between submissions would at best bring a frame of the play build from about 66 ms to 55-70 ms. The steps stay planned for when the card's own work is under 33 ms. Each one lands behind its own LEONIDA_* switch, is tested alone, and is measured in-game before the next one:

  1. Overlap preparation and GPU work. Prepare submission N+1 while N runs, and ask the write watch alongside the first steps. The starting points are SUBMIT_SPLIT, ASK_FIRST and OFF_LINE from foxhound and VIctory-NVIDIA: upstream measured 53.1 → 50.5 ms. Here, 36-43 ms of preparation could partly overlap the card's work.
  2. Fewer synchronized submissions. Merge the about 40 ExecuteCommandLists per frame into a few, tracking which ranges each submission writes and reads, instead of waiting by default. Estimated gain 8-20 ms per frame, low confidence.
  3. An asynchronous relay. Copy results back only when the title really reads them, without blocking the rest.
  4. Fewer buffer copies. Today 32-39 MB per frame: skip unchanged pages and merge ranges. Estimated gain 4-8 ms.
  5. Batched write watching. Fewer GetWriteWatch calls. Estimated gain 2-4 ms.

Alongside: smaller items

Item Expected effect Origin
Memory map (LEONIDA_MEMORY_MAP=1): about 2 GB less RAM removes the paging dips, not the average upstream switch
PC_HOLES: a texture with no room goes into a hole of an existing card block before system memory, smallest hole first avoids 27 → 10 fps collapses when textures spill into RAM; lowers RAM foxhound 97f379e, b90bb90
CARD_BATCH: one dispatch for all compare passes of a resource about 320 fewer dispatches per frame, about 0.5-1 ms of CPU, plus part of the 5.3 ms of card time measured upstream foxhound 03cd747
Lock-free refresh checks (atomic epochs per page) 1-2 ms of submission thread miranda 617e77e
Descriptor tables in batches (foxhound v0.8.1) 3-5 ms, but about 2,100 lines to port foxhound 6c67166
Textures picked by index, the most variable part of the heap pass 1-4 ms (it ranges from 1.4 to 7.5 ms) Kachow
Reading the views back (about 4,500 slots per frame) 1-2 ms, needs to track when host copies are created and freed Kachow
Stability fixes: queued barriers freed too early, a presenter deadlock, black ground patches near water no frame-rate change, fewer crashes and glitches miranda 4de9435, 478e624; foxhound 39e33eb

Not planned

  • Anything that costs RAM for frame rate, such as a 256-320 MiB exact-buffer pool, or mimalloc (2-4 ms, but +1 GB of RAM).
  • Spinning waits (WAIT_SPIN): they keep one of the eight cores busy.
  • DLSS frame generation: RTX 20 cards do not have it.
  • Cutting more effects: measured, it gains nothing.

What to expect

Stage Average frame rate on the target PC
Today about 15 fps in busy scenes, 24-26 fps in calm ones
After the smaller items about 18-22 fps on average (low confidence)
A steady 30 fps only once the card's own work per frame drops below 33 ms; where its 70 ms go is being measured

Development

Build profiles

Profile What it is
dev debug builds of our crates, with dependencies optimized
release optimized, line tables only
diag release, used by scripts\build-nvidia.ps1 with the diagnostics feature (debug logs, frame capture, debugging switches)
play diag with thin LTO: the fastest build, without diagnostics

Tests

cargo test --release --locked -p leonida-gpu

Changes to how title memory is copied or watched come with stress tests that check no write is lost (for example no_write_to_views_is_lost_with_batched_guards).

Principles

  • RAM first. No change may trade RAM for frame rate on a 16 GB machine.
  • One change at a time, behind a LEONIDA_* switch that can turn it off, and documented where the switch is read.
  • Measured in-game on the target PC. Use several runs or the per-phase log lines: two identical runs differ by 2-4 fps.
  • Credit what is ported. A change taken from another fork names its commit and author in the code.

Diagnostics

  • Every LEONIDA_* switch is described in a comment where it is read.
  • LEONIDA_CARD_SPANS=1 (diagnostics builds) times the card's work per submission.
  • Frames can be captured and replayed outside the game (docs/replay.md).
  • docs/findings.md keeps the reasons and measurements behind the runtime's design. docs/architecture.md describes its structure.

Repository layout

apps/leonida/          the executable and its command-line tools
crates/
  leonida-core/        shared plumbing: configuration, paths, the asset-policy guard, logging
  leonida-formats/     platform data formats: texture layouts, compressed textures, audio codecs
  leonida-game/        everything specific to the title: containers, build identities, patches
  leonida-gpu/         the Direct3D 12 back end (host.rs, shadow.rs, watch.rs, draw.rs, queue.rs, pipeline/, ...)
  leonida-hle/         the Xbox system API surface the title imports
  leonida-loader/      runs the title's original x86-64 code natively, CPU instruction patches
  leonida-lua/         sandboxed Lua 5.4 mods
  leonida-menu/        the F4 in-game menu
  leonida-pe/          read-only analysis of PE32+ images and COFF import libraries
  leonida-pipeline/    offline conversion of your game data into host formats
  leonida-shader/      Xbox shader containers to host DXIL
docs/                  architecture, findings, replay, asset policy
scripts/               build and play scripts (NVIDIA, per console and resolution)
tests/                 test fixtures
xtask/                 repository maintenance (cargo xtask <command>)
Get-D3D12.cmd          the D3D12 Agility SDK for Windows 10
Get-NVIDIA-DLSS.cmd    NVIDIA's DLSS files (not redistributed)
leonida.example.toml   the configuration template

Credits

This is a tree of other people's work with more on top. Commits taken from elsewhere name their origin and author.


License

GPL-3.0-or-later, as VIctory. See LICENSE. The files it does not cover, a format table and the banner image, are named in docs/asset-policy.md.