Brings the D3D12 runtime branch (d3d12/, its launcher scripts and notes, and the pull requests reviewed and applied
on it) together with mandy's main.
Conflicts (67 files, none under d3d12/): docs/, make_game.py, runtime/, scripts/build_runtime.ps1, tests/ and
tools/. Every one takes main's side: main is where that code is maintained, and this branch's copies were older
states of the same files or the same pull requests in another form. tests/test_fspx_unpack.py is main's too, as it
tests main's tools/fspx_unpack.py. Nothing under d3d12/ is changed by the merge.
Checked before pushing: python -m compileall over make_game.py, tools and tests; make_game.py --help;
scripts/check_no_game_data.py over the files this adds to main; tests/test_text_write_line_endings.py. The
translator suite, the C++ runtime build and CI have not run on the result.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Verified the Windows check with Python 3.12: 509 standalone files passed with two workers. The seven changed or runner-related files passed on updated main. The .NET 8 build and diagnostics and the native BCPack checks passed with the prerequisite fixes, including #1771. CPU-only, AI-assisted testing.
The seed was kept when LEONIDA_PIPELINE_CACHE_DIR named the precompiled folder under another spelling (a
junction, or the \\.\ device prefix), although the runtime's std::filesystem checks see one folder and turn
the journal off. Ask Windows for each folder's final path (GetFinalPathNameByHandle, from the deepest
existing parent), which sees through junctions, symbolic links, substituted and mapped drives, 8.3 names and
the \\?\ and \\.\ prefixes; the spelled paths remain the fallback when the helper is not available.
Reported by TheGeogeo's agent (repro on #2481); the approach was suggested by OreoFR's agent. The test file
gains the \\.\ and junction cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts\play-d3d12.ps1 and d3d12\scripts\play-nvidia.ps1:
-Dlss quality|balanced|performance|ultra DLSS makes the output from 2/3,
0.6, 1/2 or 1/3 of its lines (Series X: 1440, 1296, 1080, 720)
-FrameGen 2..6 DLSS frame generation
-Aspect 21:9|32:9|W:H|auto, -PresentScale fit|stretch the window's shape
-DryRun the settings a start would run with, and nothing started
With none of them a start sets what it set before (Series X: 1440 lines and
the title's own upscaler).
On Series X the launcher puts the pieces together after the F1 menu's saved
choices are read: DLSS or the stretch there means LEONIDA_FSR_UPSCALER=1 and no
LEONIDA_OWN_UPSCALER, with render scale 2/3 unless one is set; frame generation
there turns DLSS on (or is left off without DLSS's files), since its depth and
motion vectors come from that upscale. A menu choice of DLSS without the files
falls back to the title's own upscaler on Series X.
F1 menu: RENDER SCALE names the DLSS modes, UPSCALER's last value is the
game's own on either console, and WINDOW SHAPE and PICTURE IN ANOTHER SHAPE
(live) are new.
The script's own $dlss is now $dlssOn: PowerShell does not tell it from the
-Dlss parameter. Checked with -DryRun over the parameter and menu
combinations; not run in the game.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
leonida_sm.exe started by default ended 2.4 s in with 0x80000003 from the title's main loop; the
next start, of leonida.exe, ran. One start each: not looked into yet, so it is not the default.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The user's call (2026-11-27): generated frames to play with while the rendered rate is under 30.
The driver's profile for leonida_sm.exe was on already; the launcher now starts that copy unless
-NoSmoothMotion is given (measurements are made with it). The rendered rate is what the window
title and the log give.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
boot.ps1 points the runtime at <OutDir>\pipeline-cache, so a boot never read the journal that
gta6rt --precompile-pipelines writes beside gta6rt.exe and compiled those pipelines again. When
pipeline_cache.d exists there, neither the shell nor -SetEnv/KEY= set LEONIDA_PIPELINE_JOURNAL_SEED_DIR,
and the boot's own journal is a different folder (the runtime turns the journal off for a seed that
overlaps its writable journal), pass it as the read-only seed and list it in the [boot] env lines.
tests/test_windows_boot_journal_seed.py runs boot.ps1 -DryRun against a temporary runtime folder
(Windows only; nothing is launched, no game files).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cs_pk_mul_lo_const runs 32 lanes that each store 16 bytes, 128 words, but
run_gpu_tests.py and check.py ran it without VKC_OUT_WORDS, so
vk_compute_test gave it the default 64 and lanes 16-31 wrote past the
buffer through its device address (GPU-AV:
VUID-RuntimeSpirv-PhysicalStorageBuffer64-11819). Both runners now pass
VKC_OUT_WORDS=128 (check.PK_MUL_LO_ENV), and the fixture's Run line
says so.
run_gpu_tests.py's dump rows (the bounds group, cs_heap_init,
cs_user_sgprs) showed the printed words whenever there were any. A run
that printed the right words and then exited non-zero (validation
errors) was a FAIL that showed only the expected words. dump_result now
reports "exit N: <output>" for a non-zero exit.
Found by kevincommits in the coordination issue (#1608).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ms_w64x_wave_loops: each wave loops while a wave-wide count is not 0, 5 iterations in wave 0 and 9 in
wave 1, so under --wave64-emulate the waves reach different numbers of workgroup barriers. Written after
stalls were reported with the serial form on an RTX 2070 SUPER (issue 1608). On an RTX 4080 (NVIDIA
621.24) it draws 4096/4096 pixels exact side by side and in series; that does not explain the stalls.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tests/test_mesh_serial_waves.py: the module shape of a program that
qualifies (64 invocations, the pass loop, the index from the built-in,
the exchange's own place, per-pass copies of the exports, one
OpSetMeshOutputsEXT), that every initialised Function variable is set
again per pass, and that ms_wave_info_s3 (LDS), a 32-thread program,
native wave64 and --mesh-compute are unchanged by the flag.
LEONIDA_MESH_SERIAL_WAVES=1 is read by scripts/run_gpu_tests.py, like the
other translation switches, and no longer by rdna2spirv.py itself.
docs/design.md and docs/testing.md say what the flag does and how it is
tested; conftest gives ms_w64x_wave_votes its 128-vertex PSV0.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ms_w64x_wave_votes: two waves take different branches, each with its own
ballot count (and a v_readfirstlane in the second), and the triangle's
vertices come from threads 0 and 1 of the first wave and thread 64 of the
second, so ms_tri's picture needs both waves to have run their own branch
with their own votes. It passes in the side-by-side form and with
--mesh-serial-waves on an RTX 4080 (NVIDIA 621.24).
A program with a store or an atomic to memory keeps the side-by-side
form, as one with LDS does: its waves could pass each other something.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Launcher (d3d12/scripts/play-nvidia.ps1, passed through by scripts/play-d3d12.ps1;
-NoPrecompile skips it): before the title starts, `leonida shaders` translates
every shader of the title's shader archive into the cache with the settings of
that start, and `leonida warm --used` makes the host pipelines earlier runs
drew with, in processes of their own. Runs write the title's pipelines down for
it (LEONIDA_PIPELINE_BOOK=1). Until now the first load of the world after a
change of the translator ran at 0.2 fps for a minute and came up half drawn
while 2,000 shaders were translated and their pipelines made. Measured here
(Ryzen 5 7600X, the machine busy with other builds): 25,663 shaders in 109 s,
226 of them with no translation (195 containers without a program, 26 wave64
programs without a 32-lane form, 5 others); 1,891 pipelines in about 150 s. A
second start finds them in the cache. The commands' log is kept quiet for the
step instead of redirected: Windows PowerShell 5.1 turns a native command's
redirected error stream into errors.
ambient.rs: LEONIDA_REFLECT_MOST is off unless set. On the renderer merged at
00698e1e8 the guard made the whole picture posterized and grey, sky and skin in
a few flat tones (run n2: all 411 recorded frames; with it off, run n3: none of
431). The program it follows is not only the reflections' there.
Cargo.toml: profile `play` (the diag build with thin LTO and one code
generation unit), to be measured against diag.
README: the table of Leonida's fixes follows the merged renderer (DLSS in place
of -Resolution native, LEONIDA_SHARPEN gone with the compose pass it lived in),
and a section on the precompile.
AI-assisted.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Upstream's four commits past 6a31e43 (5b36758, 9e7ab9d, 6395727, b190242;
GPL-3.0), brought in as a three-way merge: upstream's trees before and after
written under Leonida's names (crates leonida-*, LEONIDA_* settings) and the
difference merged onto Leonida's own changes. What comes with it, by its
authors:
- the renderer of codec-d/cool_fox f4b48ad (CGBJ) with trustno1-coder's NVIDIA
fixes on top (residency.rs, stretch.rs, the title's upscale dispatch);
- DLSS for the title's upscale, from avatarmanz/VIctory-7900XTX pull request
203 (feature dlss, LEONIDA_UPSCALE=dlss): the game renders its own 720p and
DLSS takes it to 1080p on the Series S profile;
- DLSS frame generation through NVIDIA Streamline (streamline.rs, fg.rs), an
F1 settings menu (host/menu.rs), LEONIDA_FPS_CAP, real ray tracing as an
option (LEONIDA_BVH_BUILDER=1: the structure builder runs on NVIDIA).
NVIDIA's own files (DLSS, Streamline) are not part of the repository:
d3d12/Get-NVIDIA-DLSS.cmd fetches them from NVIDIA's GitHub into
d3d12/nvidia-sdk/ (git-ignored).
Where both sides had changed the same lines:
- compose.rs is upstream's (planes drawn by a pixel shader into the back
buffer); Leonida's LEONIDA_SHARPEN lived in the compute pass it replaces
and is not in this commit (DLSS has its own sharpness setting).
- draw.rs keeps Leonida's slow-beat texture re-check (300 frames by default);
upstream's switch of the same name is dropped.
- ambient.rs keeps LEONIDA_AMBIENT_MOST and the reflection guard.
- play-nvidia.ps1 is upstream's with Leonida's defaults put back while rays
are off: strict indirect batches (INDIRECT_BATCH=1), the light stand-in
(AMBIENT=0.8, AMBIENT_MOST=2), ray walks ended at the root and the
ray-resolve skip list. With upstream's defaults (stand-in off, no skip
list) shade was black and the sky white in the world, and the card worked
33-50 ms a frame (run n1).
- scripts/play-d3d12.ps1 follows the new launcher: DLSS by default, a shader
cache of its own (cache-2), -NoDlss, -RayTracing, -Capture, -Log.
Builds with and without the dlss feature (cargo build --profile diag
-p leonida --features diagnostics[,dlss]). In the world on an RTX 4060 Ti 16 GB
(driver as installed) and a Ryzen 5 7600X: DLSS starts (1280x720 to
1920x1080), about 14 fps where it was 13.4. The picture is not right yet: a
posterized look in run n2 is being traced. AI-assisted.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The driver shows twice the frames the game renders on RTX 40/50 cards. The
script writes one per-application setting in the driver's profile store
through NVAPI (query, on, off); the setting's ID was found by
lepotane/VIctory-leonida (GPL-3.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured on an RTX 4060 Ti, Series S profile, the user's save: 11.8 fps without
-Quality (8.3 with it); skin and bodies stayed right in every burst frame.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- play-d3d12.ps1 / play-nvidia.ps1: -Resolution native renders at the title's
own 1920x1080 on Series S with neither title patch. A pinned render scale of
1 with the own upscaler forced stopped the title in its init (frame 0, twice).
- compose.rs: LEONIDA_SHARPEN (0.4) sharpens the game plane before the
interface goes over it, kept inside each pixel's neighbourhood (no halos).
- watch.rs: LEONIDA_PAGE_WRITES defaults to bits 1, 2 and 8: textures picked by
index that were uploaded before DirectStorage or a plain read filled them are
uploaded again (fxceless/victory-fork e4245f3: black faces and skin).
- draw.rs: LEONIDA_HEAP_RECHECK_EVERY (300 frames) keeps looking at uploaded
textures picked by index after the fixed schedule (fxceless, after RyanCase94).
- lower.rs: v_mac_legacy_f32 / v_mad_legacy_f32 fused with flushed sources as
RDNA 2 runs them (fxceless f6a09d3); new GPU test passes on hardware and WARP.
- ambient.rs: a reflection guard after CS_UpdateHistory (LEONIDA_REFLECT_MOST,
3) caps reflections at a multiple of the room's light and pulls colour spikes
to grey; the view's place from lepotane/VIctory-leonida.
Translator arithmetic and differential tests: 52 passed, 0 failed (RTX 4060 Ti).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What changed:
- victory/ is now d3d12/;
- its crates are leonida-* (leonida_* code paths);
- the program is leonida.exe;
- settings are LEONIDA_*, and the older VICTORY_* names still work through apps/leonida/src/leonida.rs;
- the config file is leonida.toml;
- log names and user-facing text say Leonida.
What did not change: lines that credit upstream projects or people, URLs, copyright notices and the
GPL-3.0 LICENSE. d3d12/README.md opens with a Leonida section that says the runtime grew from
Marvisak/VIctory through trustno1-coder/VIctory-NVIDIA. The rest of that README is labelled as
trustno1-coder's.
The launchers (scripts/play-d3d12.ps1, scripts/play-linux.sh), docs/linux.md and
scripts/sync_victory.py (prefix d3d12) follow the move. Future upstream merges will need a
mapping from upstream's names onto these.
Builds with `cargo build --profile diag -p leonida --features diagnostics`. The settings alias
tests pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
victory/ builds as leonida.exe ([[bin]] in apps/victory; the package keeps VIctory's name so upstream merges and cargo -p victory still work), the window caption reads Leonida, and the launchers (victory/scripts/play-nvidia.ps1 and play.ps1, scripts/play-d3d12.ps1, scripts/play-linux.sh) start leonida.exe; the Smooth Motion copy is leonida_sm.exe. VICTORY_* settings are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A wrapper over victory/scripts/play-nvidia.ps1: it builds victory/ (diag) when missing, keeps caches and saves under %LOCALAPPDATA%\Leonida\d3d12, and passes -SeriesX, -Quality, -Resolution, -Adapter and -More through. The Vulkan renderer stays scripts/play.ps1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Linux the D3D12 runtime (victory/) runs under Wine. Its Direct3D 12 now comes in the package, so
players download nothing else for D3D12.
- scripts/fetch_vkd3d_proton.py puts VKD3D-Proton 3.1's unmodified 64-bit d3d12.dll and
d3d12core.dll in the package. It also adds the LGPL-2.1 text and notice from the v3.1 tag and a
note on where the source is. Every download is checked against a pinned SHA-256. Standard
library only; Python 3.14 for compression.zstd.
- scripts/play-linux.sh installs the bundled DLLs into Leonida's own Wine prefix (no other prefix is
touched) and sets WINEDLLOVERRIDES=d3d12,d3d12core=n. It runs the runtime with the measured
NVIDIA defaults of play-nvidia.ps1.
- docs/linux.md describes the package and what is still untested: the launcher is syntax-checked
only; it has not run on a Linux machine yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- LEONIDA_ASPECT (21:9, 32:9, 43:18, any W:H or ratio from 1 to 4, or auto) widens the display mode
the runtime reports to the title, at the same height, and widens the title's window.
- LEONIDA_PRESENT_SCALE=fit|stretch: fit keeps the frame's shape, centred with black bars. It is
the default when LEONIDA_ASPECT is set; stretch, the old behaviour, is the default otherwise.
- The aspect math is in src/aspect_fit.h, with aspect_fit_test.
- docs/ultrawide.md describes how resolution flows from window to title to present, and what
needs the game running: whether the title renders wider at all, its FOV and its HUD.
- play.ps1 gets -Aspect and -PresentScale.
Built; aspect_fit_test passes. The bars have not been checked on screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every Gen.host_addr access (buffer, global_, scalar and BVH loads, stores and atomics) calls one
%guard_fn with its sign-extended 48-bit heap offset, kind and span. Below the arena's size it passes
after a compare; elsewhere the 4 KiB pages of its first and last byte are looked up in a two-level
page table (level 1 by offset bits 47..32, level 2 one bit per page). A refused load reads the zero
area, a refused store or atomic the dump area (an atomic returns 0), and the refusal is counted in
the guard header. Without the header's magic every access passes; without the flag the module is
unchanged byte for byte.
tools/address_guard.py is the Python reference of the table and the check. cs_address_guard is the
fixture of the translator test and of scripts/run_address_guard_gpu_test.py, which runs it on a heap
where every address it touches is real memory, so no run can fault.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up (MoonEyes): the InputScript help in boot.ps1 now says
each press is held 300 ms and that button@seconds:hold holds it longer.
The header comment in gameinput_script.h is wrapped at 120 like the rest
of the file. Comments only; no code change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The title's mfplat.dll imports bind to the host, and the host's
MFCreateSourceResolver fetches http, rtsp and other URLs over the
network. Port VIctory's media module (media.rs, GPL-3.0-or-later): a
proxy resolver that refuses anything but a local file with
MF_E_UNSUPPORTED_SCHEME (logged once per scheme and host), rewrites
console paths (GAME:, G:, T:, also as file: URLs) to their host files
through the new rt::fs::read_path, and forwards the rest to the host's
resolver. mfplat.dll stays a host module for LoadLibrary.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port VIctory's GameInput module (gameinput.rs, gameinput/dualsense.rs,
GPL-3.0-or-later) as shims/gameinput_xinput.cpp: XInput pads 0-3, a
wired DualSense over HID, the keyboard as its own device, and a keyboard
pad that stands in while no other pad is connected. Readings per change
with a 32-deep history, blocking and async device enumeration,
UnregisterCallback waiting for a running callback, FindDeviceFromId and
XInput rumble, all as VIctory runs the title.
It is built into gta6rt when the SDL3 shim is not (the main build has no
SDL3), instead of binding the import to the host's GameInput.dll, which
has no keyboard pad; LEONIDA_GAMEINPUT=host keeps that path and
LEONIDA_KEYBOARD_PAD=off drops the keyboard pad. Registered by name and
ordinal #1. gameinput_xinput_test runs it over a fake host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f0611b752 took the executable's addresses out of the code. Two behaviours
changed with it; the removal stays, the changes are now explicit:
- runtime/src/main.cpp: the watchdog kick runs again only with
LEONIDA_TITLE_WATCHDOG=0, as on main; LEONIDA_TITLE_WATCHDOG_KICK only
supplies the two RVAs it needs. Either variable alone leaves the
watchdog armed and the loader says so once (before this commit the kick
ran whenever LEONIDA_TITLE_WATCHDOG_KICK was set).
- scripts/windows-boot/boot.ps1 no longer has the game- and
session-state RVAs built in, so LEONIDA_PEEK has no default and the
RESULT states read "?" unless LEONIDA_GAME_STATE_RVA and
LEONIDA_SESSION_STATE_RVA are set. The script now warns when they are
not, and runtime/README.md (LEONIDA_PEEK, LEONIDA_TITLE_WATCHDOG and
_KICK rows), scripts/windows-boot/README.md and docs/first_run_ui.md
say so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict in runtime/shims/d3d12_xs_device.cpp, proxy_copy_descriptors_simple:
keep this branch's copy_null_rtv_marks call and main's fsdraw::enabled()
gate for the descriptor-copy diagnostic.
tools/rdna2spirv.py merged without a textual conflict, but #1662 on main
calls restore_dot4_inline_sel in the exact re-anchoring path, which this
branch had deleted. The merge puts main's function back so that call
resolves; the next commits reconcile it with the dot4 op_sel rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The title takes its console model from HKLM\Software\Microsoft\Windows NTCurrentVersion\OEM\ConsoleMode, not from XSystemGetDeviceType alone; a PC
has no such value. registry_oem.cpp (ported from VIctory's xsystem.rs)
answers RegOpenKeyW/RegOpenKeyExW/RegQueryValueExW/RegCloseKey for that
key with 0x64 (Series X; 0x60 with LEONIDA_DEVICE_TYPE=6) and passes every
other key to the host. advapi32.dll stays a host module for LoadLibrary.
Found on the real title: its render-target pool budget (0x4000000 or
0x5200000) is picked by this model. The title still stops at its pool
check (game_scarlett_master.exe+0x247af2d): it counts the back buffers
through its XMemAlloc hooks, which Leonida does not call yet.
Tested: registry_oem (new) and d3d12_title_memory pass; gta6rt binds the
four imports to the shim.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- test_tool_stdout_encoding: three scripts merged since this PR opened
(check_compute_journal_overlay.py and compute_workers_win.py with #2098,
corpus_watch.py with #817) get the same stdout guard as the tools here.
- test_runtime_paths: the runtime workflow's two path filters now include
tools/conformance/**, which runtime/CMakeLists.txt names. The change is
#1673's (xel1uz), carried here since #1673 duplicates this PR.
With it, test_tool_stdout_encoding, test_runner_calls_all_tests and
test_runtime_paths all pass on main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two conflicts:
- d3d12_com.cpp, note_direct_heap_indexing: main's console_descriptor_table_va(cbv_srv_uav_base_) for the tracked
table, with this branch's per-site once() flag instead of note_once on every draw.
- d3d12_vulkan_device.cpp, PipelineState::build_compute: this branch's body (build_compute_pipeline, journal, compile
helper). main's dev_status::Build around the compute create moves into build_compute_pipeline, next to the
pipeline_profile::DriverCall, so the status line still names the compute pipeline in the driver.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Extend #957's DPP VOPC compare to v_cmpx: the same lane selection, with the
result written to EXEC. v_cmpx prints no destination, so src0 is its first
operand. Only the forms where every lane writes its bit are taken, as for
v_cmp. 78 pipeline-library pixel shaders of 1.0.2.1 were refused for it; all
78 now translate and pass spirv-val.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bit-exact with VIctory's Rust decoder on all 105,845 BCPack chunks of the
1.0.2.1 package (BC1, BC3, BC4, BC5, BC6H, BC7; 16.4 GB decoded), about as
fast on one core (59-61 MB/s against 57).
Merge resolution: gta6rt no longer compiles src/bcpack_decode_stub.cpp,
which as an object file would have silently replaced the decoder in
gta6rt_bcpack; only dstorage_xs_test links the stub now. bcpack_decode.h
keeps both sides' notes; build_runtime.ps1 lists the union of sources
without the stub.
Tested: gta6rt builds with the Vulkan device; bcpack, bcpack_tables (with
local tables) and dstorage_xs pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>