Commit Graph

93 Commits

Author SHA1 Message Date
daf7242f2e Merge remote-tracking branch 'origin/main' into carry/hwrt-2972
# Conflicts:
#	d3d12/scripts/play-nvidia.ps1
#	scripts/play-d3d12.ps1
2026-12-02 06:57:33 +01:00
0ae5a2664b Merge pull request #2986 from TheStonedGamer/precompile-all
d3d12: opt-in precompile of every known pipeline (-PrecompileAll); never-drawn pipelines stay out of the library
2026-12-02 05:13:18 +00:00
32f0fe3ad9 leonida warm: only pipelines drawn with go into the pipeline library
With -PrecompileAll every known pipeline is made (some 88,000 against 4,000
drawn with). Those never drawn with now stay in the driver's cache alone and
are kept out of the pipeline library: the driver checks an entry of its own
cache against the pipeline asked for and compiles again where they differ,
while a library entry is taken as it was stored.

With them in the library (1.5 GB, 91,525 entries) the device was removed
twice during a burst of first loads in a new place (RTX 3060, driver 621.40):
no hang, no page fault, the library file whole. With them kept out, a run of
the same settings stayed up. The cause inside the driver is not known.

The rule is into_library(), with a unit test that fails without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:30:37 -05:00
c6f253705d Launcher: option to precompile every known pipeline (-PrecompileAll)
The precompile makes only the pipelines earlier runs drew with (warm --used).
-PrecompileAll (launcher: "Precompile every pipeline", off by default) makes
every pipeline the title has created, as foxhound's launcher does: fewer
stalls in places not drawn in yet, at the cost of an hour or more and
gigabytes the first time. Kept across the F1 menu's restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:30:37 -05:00
3fdfbaa46f d3d12: hardware ray tracing on DXR 1.1 (LEONIDA_HW_RT, off: a trial)
In place of -RayTracing (the title's structure builder and software traversal as translated
shaders): the title's XboxBvhBuilder calls become host DXR 1.1 bottom and top levels, and the
traversal loops of its trace programs become inline ray queries.

Ported from trustno1-coder/VIctory-NVIDIA (its #3706; from Leslie-d-a/VIctory-NVIDIA-HWRT 61e389e0
and 5f55bca8, original by dakisback2 ecc49d5b and 72f8316a), GPL-3.0, and fitted to this tree:

- leonida-shader: emit/rayquery.rs wired into lower.rs (the plan, the handles, TLAS root SRVs
  t230..t241, the analyses that leave the lifted loops out). A program in the paired form is not
  lifted. With LEONIDA_HW_RT=1 the node test of a loop left unlifted misses every node
  (emit/intersect.rs bvh_miss): the console structures are never written then.
- leonida-gpu: hwrt.rs (and dxr.rs for its records); list::external with a LEONIDA_THIN op for the
  structure work at its place in a title list; the TLAS views in the descriptor heaps;
  Deferred::held; the ray queries in the shader cache's entries; counters in the frame log.
- leonida-hle: modules/xboxbvh.rs replaces the exports of the title's XboxBvhBuilder.dll when on.
- With it on the light stand-in stands aside and the passes left out without structures run.
  Shader writes are not all copied back as VIctory-NVIDIA does (LEONIDA_HW_RT_COPY_BACK=1 asks for
  it): here that stretched and flickered textures and cost 30 to 45 ms a frame.
- F1: HARDWARE RAY TRACING (TRIAL); play scripts: -HardwareRT (frame generation left off with it,
  as with -RayTracing); launcher: a checkbox. Docs: fork-ray-tracing.md, README.md, switches.md.

One PC (RTX 4070 12 GB, driver 621.40, Series X profile, no frame generation): 22 to 25 frames a
second against 6 with -RayTracing; the run ended after six minutes with the card's memory full.

Co-authored-by: dakisback2 <90546900+dakisback2@users.noreply.github.com>
Co-authored-by: Leslie-d-a <70692092+Leslie-d-a@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 23:04:12 +01:00
5586f9b003 d3d12: the DLSS build is asked for once NVIDIA's SDK is here, whatever the switches (D3D12-F1-DLSS-REBUILD)
play-nvidia.ps1 made the layer again with DLSS only when the start's own
switches wanted DLSS ($wantDlss), and it decides that before it reads the
F1 menu's saved settings. A DLSS choice the menu saved behind a replayed
-Resolution (the menu's SAVE AND RESTART) therefore asked for no build: with
a build noted as made without DLSS and NVIDIA's SDK installed afterwards,
every such start fell back from DLSS. get-nvidia-sdks.ps1 says the next
start builds the layer with DLSS; that held only for some switches.

The check now follows the SDK alone: a diag build noted as made without DLSS
is made again when nvsdk_ngx_d.lib is here, unless -NoDlss. It stays the one
check it was; no second one behind the menu.

Two things follow from asking more starts for that build:
- without cargo such a start no longer stops with "No build and no cargo":
  it says DLSS waits for cargo and runs the build that is here (a start with
  no build at all still stops, as before);
- a dry run, which builds nothing, says that a start builds first and prints
  the settings of the start after it; it printed the settings from before
  the build without a word.

Test: tests/test_play_nvidia_menu_choice.py, ten cases of launcher dry runs
against a synthetic folder with a stand-in cargo on the PATH (no game files,
no GPU), and one more run for a note whose exe is gone. On main six of the
ten fail (the five that expect the build and the one without cargo); with
this change all pass.

Not in this change: scripts/game-gate.ps1 refuses to run without a build so
that none is made inside a run. A build noted as made without DLSS, with the
SDK there, is now made again by starts that did not ask for it before (the
gate's default Series X start among them), inside the run. A guard there is
a follow-up: the gate needs PowerShell 7, which the PC this was written on
does not have.

Found by ubiquitarianism (ProjectLeonida/mandy#2570, 1 Dec 2026).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 21:38:29 +02:00
0b1f6b5887 d3d12: preserve explicit render scale on F1 restart 2026-12-01 13:47:17 -05:00
ebb9ecb983 d3d12: honor saved DLSS at stock Series S resolution 2026-12-01 13:30:30 -05:00
8e1d4000a8 d3d12: -More's values in the menu report, -Dlss replaces the lowest scale, a tidier menu file write
Review of 3a3f38325 (aslan2142):

- The values -More sets were not in what the menu was compared with. A replaced value printed "-> (unset)", a value
  equal to the menu's was reported as replaced, and an empty menu value set by -More was not reported. They are
  overlaid now.
- -Dlss now also sets LEONIDA_RENDER_SCALE_MIN and LEONIDA_OUTPUT in $switchSettings, as -Resolution and -Lowest do,
  so a typed DLSS mode replaces a saved lowest scale.
- play-d3d12.ps1's -SmoothMotion is named -SmoothMotion/-NoSmoothMotion in the report, as -SeriesS is.
- The menu file is not read again to tell whether a value left it. After a failed write, only a temporary file this
  start wrote is removed; whatever already stood at that name is left alone.

Tests: 14. With the launcher of 3a3f38325, 4 fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:48:08 -03:00
3a3f383250 d3d12: a typed frame generation replaces the menu's other one; the restart replays -NoFrameGen
Review of cf15c2c6e (merzleckeier, full launcher with the final start mocked):

- A saved LEONIDA_FSR_FRAMEGEN=1 undid a typed -FrameGen 2. The launcher keeps FSR 3's frame generation when both are
  set and drops DLSS's. The two are one choice, so -FrameGen now also sets LEONIDA_FSR_FRAMEGEN and -FsrFrameGen also
  sets LEONIDA_FRAME_GEN in $switchSettings. A typed one replaces the menu's other.
- LEONIDA_MENU_ARGS left -NoFrameGen out, as main does, so SAVE AND RESTART turned frame generation on. It is
  replayed now.

Tests: 12 (two new). With the launcher of cf15c2c6e, the two new ones fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:09:20 -03:00
cf15c2c6ed d3d12: a typed switch wins over the F1 menu, not a value that changed (D3D12-MENU-LAST-CHOICE-WINS)
Review of the first version: a value that differs from the last start's command line was taken for the user's new
choice. That lost an explicit flag on the first start after an upgrade, never let the same flag typed again win, and
dropped a menu value the command line never mentioned when leonida-launch.txt lacked the key. The menu file was also
rewritten before the history, so a failed history write had already lost a saved choice.

Now the rule follows what the user typed:
- A switch typed for this start wins over the menu's saved value of each setting it makes. The menu file drops that
  value, so F1 shows the command line's. scripts\play-d3d12.ps1 passes the switches typed there as -Typed, so its
  Series X default and -Lowest 1080 leave the menu's choice standing. A start by hand counts its own switches, and
  -More wins like a typed switch.
- Every other setting keeps the menu's value.
- The menu's SAVE AND RESTART adds -MenuRestart to the switches it replays (LEONIDA_MENU_ARGS), so there the menu's
  values, saved after those switches, win.

leonida-launch.txt is gone. The menu file is written to a temporary file and moved over the old one, and only when a
value leaves it. If that fails, the start runs with the command line's values and the file stays whole.

Tests: 10 cases, among them the same switch typed again, an untyped default, a setting no switch makes, the restart,
a start by hand, -More and a menu file that cannot be written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:20:54 -03:00
c8eea9466f d3d12: the last choice wins between the command line and the F1 menu (D3D12-MENU-LAST-CHOICE-WINS)
play-nvidia.ps1 applied leonida-settings.txt (what F1 saved) over the command line at every start. An empty value
there removed what the command line set, so a later -Resolution, -Dlss or -SeriesS was lost without a word.

Now leonida-launch.txt (git-ignored) keeps what the last start's command line made:
- A setting this command line makes otherwise than that start's did wins. The menu file drops its value, so F1
  shows and saves the new one.
- A setting it makes as before keeps the menu's value, the newer choice.
- Each start says which values came from the menu and which the command line replaced.
- A dry run writes neither file.

The F1 menu gets the native render scale (1, which -Resolution makes at the output's height) and the dynamic
resolution's lowest scale (LEONIDA_RENDER_SCALE_MIN, from -Lowest).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:16:56 -03:00
93e65d91ca launcher: enable water transmission
From #2617. Confirmed in Boat on the RX 6800.
2026-12-01 08:15:15 -05:00
d22cd3b6bb The precompile puts its pipelines into the pipeline library, which the game loads them from
The precompile (`leonida warm`) left the pipelines it made to the driver's own cache on disk, and the
game's runs did not take them from it: right after a precompile that had made them, 1,100 to 2,300
pipelines were "being made" in the first world frames (runs d257, d285, d286, d287), compiled again at
a few to thirty a second while frames took 2 to 10 s (the launcher waits up to 10 s a frame for a
pipeline), and in d287 none of the driver's cache files was written in the four minutes the game
compiled 1,700 pipelines. The game loads pipelines from the pipeline library (a run of 2026-11-27:
2,338 loaded, none made), which it writes only at a run's normal end, and the library on this PC was
last written on 2026-11-29: every change of the translator since meant minutes of compiling in the
world at the next start.

After making them, the precompile now puts those of this translation that are not in the library yet
into it, in one process of its own (`warm --store`): with the library and the static sampler list in
use before its device is made, as the game has them, each pipeline is loaded by the name the game looks
it up by or made (from the driver's cache the processes before filled) and stored; then the library is
written. They are noted in `library-done.txt` only once it is written; a store that fails leaves things
as they were. `LEONIDA_WARM_LIBRARY=0` leaves the library alone, as before.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: type-checked; checked in a run of the
game right after this commit (see the next one).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 00:51:55 -05:00
5b1bd688c5 Launcher: the driver-cache note keeps the files a precompile left alone
The launcher notes NVIDIA's cache files its precompile wrote, with their sizes, and makes every pipeline again when
one is gone or smaller at the next start. The note was replaced by the files each precompile touched: one with
nothing to make touched a single file, and a set moved aside since (the 4 GB file of one warm process was full, so
its 600 pipelines were compiled in the game at every start) was no longer looked for: the next start compiled all
4,875 in the game (run d278). Now the files written are noted at their sizes beside those noted before, and the old
note goes only after pipelines were made again.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: the script parses; run d279 found the moved set
by the restored note and made the pipelines again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 21:37:59 -05:00
cd9fe51a9c Merge pull request #2752 from alpfilho/d3d12/borderless-fullscreen
d3d12: Alt+Enter switches to borderless fullscreen instead of freezing the picture (D3D12-BORDERLESS-FULLSCREEN)
2026-11-30 18:53:54 -05:00
4929a0e99d Merge feat/live-prompts: button prompts follow a device switch during play 2026-11-30 18:48:36 -05:00
8d48f19239 Launcher: a driver shader cache emptied since the last precompile is told by size too
The precompile notes which of NVIDIA's cache files it wrote, and makes
every pipeline again when one of them is gone. After the full files were
moved aside, the driver made files of the same names anew, small, before
the precompile looked: nothing was made again, and the game compiled in the
world (run d256, frames of up to 5.9 s). The files are noted with their
sizes now, and one smaller than noted counts as emptied as well (lines
without a size, from before, are looked at by name as before).

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: the
launcher's next start in run d257.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 16:36:57 -05:00
2a880c31da Merge pull request #2612 from TheGeogeo/d3d12-bar-windows-warning
d3d12: LEONIDA_WINDOWS_BAR_MB says once that it does nothing without resizable BAR (D3D12-BAR-WINDOWS-WARNING)
2026-11-30 17:49:40 +01:00
d985409b61 d3d12: Alt+Enter switches to borderless fullscreen instead of freezing the picture (D3D12-BORDERLESS-FULLSCREEN)
Alt+Enter went to DXGI's own exclusive fullscreen, for which nothing here makes the buffers
again: the picture froze and the screen stayed black. The presenter now turns DXGI's Alt+Enter
off (MakeWindowAssociation with DXGI_MWA_NO_ALT_ENTER, on the swap chain's own factory), and
the title window's procedure in lifecycle.rs handles the key itself:

- Alt+Enter takes the title's window without its frame over the whole of its monitor, and the
  next one gives back its frame and its place. A held key's repeats do nothing, and the
  character it makes (a beep) does not reach the title.
- Going back gives back only the frame and edge styles, so a window made borderless before it
  was first shown stays shown.
- LEONIDA_FULLSCREEN=1 (the launchers' -Fullscreen, or FULLSCREEN (NO BORDER) in the F1 menu)
  makes the window borderless from the start.

The swap chain is not made again: its picture is scaled to the window as before
(LEONIDA_PRESENT_SCALE). Two tests send the keys to a window of their own.

The idea is VIctory's (trustno1-coder/VIctory-NVIDIA has a borderless fullscreen); the code is
written for leonida-hle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 13:38:40 -03:00
22cd4ae248 Merge branch 'main' into d3d12-bar-windows-warning 2026-11-30 13:22:26 +01:00
be3f75821a Merge current main to recheck launcher CI
Bring the launcher change onto the current base, including the F16 reference test fix from #2633.
2026-11-30 12:24:34 +01:00
d367675c70 d3d12: index heap buffer spans as slots change (on in play-nvidia) 2026-11-30 05:51:58 -05:00
fe77ea5a47 Launcher: the list ahead of each frame recorded by two threads on NVIDIA (LEONIDA_AHEAD_SPLIT=1)
Main left it off for the RX 6800 it was measured on. On an RTX 4060 Ti with a Ryzen 5 7600X, standing, by turns of
4 s with the three other helper switches (runs whab1 and whab2): the frame's median -0.22 (+-0.29) and -0.73 (+-0.39)
ms, its mean -0.65 and -0.66. The wider pools did nothing and half the processors refreshing copies made the frame
slower; those stay off.

AI-assisted (Claude). Tested on an RTX 4060 Ti 16 GB, driver 616.64, Ryzen 5 7600X.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 03:15:17 -05:00
31439e0b40 Launcher: the button prompts' tool run by python before py, and two minutes at most
The launcher took the first of py and python, and on a PC whose py is the Python install manager's alias
(WindowsApps\py.exe) that first run waited for an answer: a start from a window nobody types in (a script's)
stood still before the title for 10 minutes, with 0 s of the processor's time, until py was ended. Now python is
tried first (the same manager's alias ran the tool in about a second there), the tool runs as a process of its own
that is ended with its children after two minutes, and the title then keeps its Xbox glyphs, as when there is no
Python.

AI-assisted (Claude). Tested on Windows 11 with the Python install manager: the launcher parses, and python runs the
tool's --help in 1 s; a start from a script went on once the waiting py was ended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 00:37:11 -05:00
ce8118dfb2 Merge origin/main into next: the twin bias with the alias cast's cast serials
Conflicts in descriptor/host.rs only, where main's twin bias (1bb188cf5) and PR #2660's alias cast (merged into
next as d9a75eb8f) changed the same view-making calls: make_twinned (main) is make_twinned_info (next), which also
gives the cast serial. Kept both: make_twinned_info clears the twin bias first and returns (kept, cast serial);
every maker takes the bias right after it (make_at, make_listed's new records with the bias in the record's stride
word, the slot maker that writes the stride with the bias once the view is made) and keeps the cast serial as next
did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 23:47:55 -05:00
54374cf53e Button prompts that follow a device switch during play
tools/live_prompt_glyphs.py builds ps_live_prompt_glyphs.gfx over the
title's glyph movie on the player's PC: each Main_Button_N sprite holds the
PlayStation and the keyboard picture (the first keyboard piece named k),
and the title's ActionScript block gets three static Number slots on Main
(lnLo, lnFamily, lnHi, the outer two sentinels), four static methods that
show the pad or the keyboard pieces when a prompt is made and on each frame
while it is on the stage, and a call from SpriteAsset's constructor, the
base of exactly the 38 symbol classes. Everything added is in try blocks.
tools/abc_file.py reads and writes ABC byte for byte. Both sets and the
code fit the 28,148 bytes with 1,057 to spare on the user's movie.

leonida-hle serves the live movie for a PlayStation pad or the keyboard
(unless LEONIDA_PROMPTS forces a family; LEONIDA_PROMPTS_LIVE=0 restores
one family's movie, LEONIDA_PROMPTS_PAD=xbox keeps a keyboard start on the
keyboard movie), with lnFamily's default set to the family in use, then a
below-normal thread finds the slots by their sentinels through
ReadProcessMemory and writes each change of the active family.

prompt_glyph_movies.py builds the live movie too (only over the title's).
Tested: the added code checked path by path and run in an interpreter over
fake display objects, the sentinel scan and writes on a fake heap. Not yet
run in the title.
2026-11-29 22:24:55 -05:00
1d22590b9f d3d12: a title write forgets only the copies refreshed ahead it touches (LEONIDA_COPY_SCOPED, on in play-nvidia)
A title buffer copy or a copy at its place in a submission's steps forgot
every copy refreshed ahead, so the refreshes behind it were gathered, asked
about and flushed again. With LEONIDA_COPY_SCOPED=1 (and the submission's one
asking) it forgets only those whose range touches the bytes written or a page
the title shows at another address (inplace::shown_anywhere_else); past 256
such pages it forgets all. Steps that run our code still forget all. RX 6800,
from a new game (run ab-06, LEONIDA_AB by turns of 4 s, 185 world phases): the
frame -2.2 ms (+-1.0) median, -2.5 (+-1.2) mean; ~13 scoped forgettings a
frame kept ~1,600 copies. The frame-rate line counts them.
2026-11-29 22:07:42 -05:00
95bc33f6e2 Built-in keyboard prompts, and both prompt movies built for every player
tools/pc_prompt_glyphs.py draws its own key caps, arrow keys and mouse in
code when --glyphs is not given (no pictures, Pillow or font), with the keys
of the runtime's on-foot table, each inside the outline of the Xbox glyph it
replaces and covering no more of the canvas (measured on the user's movie,
numbers only). tools/prompt_glyph_movies.py builds pc_ and ps_prompt_glyphs.gfx
over the title's movie (standalone if data.rpf cannot be read) into
d3d12/target, where leonida.exe looks; play-nvidia.ps1 runs it before a start
and make_game.py in its runtime stage. A movie the player made is never
touched or shadowed; its own are stamped and rebuilt only when inputs change.
2026-11-29 21:49:50 -05:00
54b811aae4 Launcher: quiet textures hashed one turn in 16 (LEONIDA_TEXTURE_HASH_BACKOFF=1)
A texture whose bytes hashed the same four turns running is hashed one turn in 16 (texture.rs, since
b8bd37111). By turns of 4 s standing at the waterside save, Series X, render scale from 0.75, frame
generation off, two runs (d118): the frame's median -1.67 +-0.81 and -0.76 +-0.82 ms, the submitting
thread -2.88 +-0.50 and -2.62 +-0.49. A recorded tour with it on (d121) showed no texture late or wrong:
the three frames the scan flagged are the camera passing through the player's head on the fast turn back.
'0' in -More gives the old hashing back.

AI-assisted (Claude). Tested on an RTX 4060 Ti 16 GB, driver 616.64, Ryzen 5 7600X.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 21:17:48 -05:00
182d0c1746 play-nvidia: quick window finds and renderer port 2 on by default
LEONIDA_QUICK_FIND_WINDOWS: RX 6800, two sessions from a new game (runs ab-02
and ab-03, LEONIDA_AB by turns of 4 s): the frame -2.4 and -0.9 ms median.
LEONIDA_PORT_DESCRIPTORS: the boat mission (run ab-04): the frame -3.4 ms
(+-1.4) median; the player saw no flicker and no black textures.
2026-11-29 20:51:42 -05:00
0eab02a8bc Terrain mesh dispatches run their X with Y, Z of 1; three particle emitters paired; latency from present to present
- Indirect mesh dispatch records run as [X, 1, 1], as the console reads them (X alone). The terrain's tessellation
  writes (X, 0, 0), which D3D12 drops: the near ground was in depth but missing from the G-buffer, black with white
  specks on dirt and sand edges up close. The single clamp (indirect.rs), the batched one (indirect/batch.rs) and the
  bench's (indirect/bench.rs); unfilled slots (X past 65,535) still run empty. From VIctory-NVIDIA 216bca9
  (invismann), through voidopcode/vilocity 41bccf0 (GPL-3.0-or-later). Tests on WARP:
  warp_window_leaves_unfilled_slots_empty_and_uncharged feeds (519, 0, 0); warp_batch_clamps_as_the_clamp_of_one_does
  checks [X, 1, 1] for every mesh record; both pass.
- Launcher: the model emitters CS_Emit_Dynamic_Model_Skinned, _AttachMesh and CS_Emit_Dynamic_Model (particles from
  a character's body) take the paired form (LEONIDA_PAIRED_FOR); translated alone none translates for 32-lane host
  waves and all three do paired. After voidopcode/vilocity 324fe01, 4244b51.
- Launcher: the files of NVIDIA's shader cache a precompile writes are noted; if one is gone at the next start (the
  cache emptied by hand, or a full one moved aside) the pipelines are made again instead of being compiled in the
  game (runs d76, d96: up to 480 ms a frame waiting for pipelines).
- The line: "frames waited from the title's present to ours" each second (after vilocity c04fdd7): the latency the
  line adds between the title and the screen.
- findings: the frame rate measured against the PC's own load (a restart brought back background programs: 17.3 ->
  12.8 frames a second for one build); LEONIDA_WRITE_SITES measured on/off/off/on: faults -1,000 a frame, the frame
  unchanged, left unset.

AI-assisted (Claude). Tested on an RTX 4060 Ti, driver 616.64, Ryzen 5 7600X, Windows 11 (Series X profile, 1440p).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 20:00:09 -05:00
dc64c3685f Six list threads by default; findings: the title's stores that change nothing, the aliased views' copies
- play-nvidia.ps1: LEONIDA_THIN_THREADS=6. Two of eight list threads parked by turns of 4 s (LEONIDA_THIN_PARK),
  standing at one save, two runs: the frame's median -0.83 +-0.16 ms (d69) and -0.94 +-0.52 (d73), the
  submitting thread -0.49 +-0.12 and -0.74 +-0.62.
- findings: the fault handler is entered 2,400 to 2,950 times a frame, of which some 2,000 are single stores done
  beside the guards, most of them storing what the memory already holds; the loader's rewrite of such places
  (LEONIDA_WRITE_SITES) is not set by the launcher and is the next thing to measure.
- findings: the copies behind aliased views could go with relaxed format casting (driver 616.64 has it).

AI-assisted (Claude). Tested on an RTX 4060 Ti, driver 616.64, Ryzen 5 7600X, Windows 11 (Series X profile, 1440p).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:09:28 -05:00
fcc044cdc4 Merge current main after CI fixture fixes 2026-11-29 21:07:01 +01:00
d927eb1906 Merge remote-tracking branch 'origin/main' into next 2026-11-29 14:22:35 -05:00
9899a98012 List threads' passes from VIctory-lap and RAZDA4A-XEN; LDS subtracts as compare-exchange loops; the particle programs paired
- Shader translator: an atomic subtract on group-shared memory (ds_sub_u32, or an add of 0 - x) is a
  compare-exchange loop, in the plain and the paired lowering, as NVIDIA's compiler refused it (driver 621.40, the
  rain particles' pipeline never made), from voidopcode/vilocity 5c8149f. Tests
  lds_subtracts_return_the_old_value_and_subtract (the card) and lds_subtracts_are_atomic_across_waves (the card and
  WARP) pass on an RTX 4060 Ti; a retranslation and warm-up (run d63) refused no pipeline.
- play-nvidia.ps1 names the two particle programs dropped in every run (5e3dd99e0f067aee, 57f1b81de55c2842) in
  LEONIDA_PAIRED_FOR: translated alone with their reasons said, the paired form takes both (60 and 71 branches
  taken wave-wide). Not yet seen in a tour.
- A view of a table read in place that the list brought up to date stays so while the list's epoch stands
  (LEONIDA_ENTRY_ONCE, VIctory-lap 1d52e85; on): by turns of 4 s standing the frame's median -1.59 +-0.39,
  -0.70 +-0.31 and -0.55 +-0.27 ms in three clean runs (d56, d62); a tour with it on (d60) flagged nothing new.
- The empty host lists a title list gets at its submission come reset and closed from the thread that recycles run
  lists, not closed by the line's thread (LEONIDA_CLOSED_AHEAD, on; 3.6 % of the line's samples, profile
  submit-d61): 77 % of them so in run d63.
- Off unless asked for, measured or to be: per-thread caches of table entries' views and placed views' shapes
  (LEONIDA_VIEW_CACHE) and of placed textures found empty (LEONIDA_ALIAS_QUICK), VIctory-lap 242d0c6; tables made
  afresh known by what they hold (LEONIDA_CONTENT_TABLES, the idea of crossducking/RAZDA4A-XEN's wave 15; two runs
  said opposite things); a list keeping its dynamic slots' resources once (LEONIDA_KEEP_BY_LIST, VIctory-lap
  1641cb6). Each counts itself on the frame lines.
- findings: what the submitting thread and the list threads do (profiles), the walls in run d54, the four switches'
  runs.

AI-assisted (Claude). Tested on an RTX 4060 Ti, driver 616.64, Ryzen 5 7600X, Windows 11 (Series X profile, 1440p).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 14:22:15 -05:00
c0e16af856 Preserve motion blur when restarting from the settings menu
D3D12-MOTION-BLUR-RESTART. AI-assisted with OpenAI Codex (GPT-6).
2026-11-29 20:11:32 +01:00
f7a4e75bf8 Merge pull request #2615 from alpfilho/d3d12/fsr3-framegen
d3d12: FSR 3 frame generation for cards without DLSS frame generation (D3D12-FSR3-FRAMEGEN)
2026-11-29 20:00:10 +01:00
52db6f8d42 Exact float min/max/median rewrites; the guards' shared lock in the launcher; streaming spans; presents' pacing measured
- Shader translator: a float maximum or minimum with a constant that is not a zero leaves out the test for two
  zeros (LEONIDA_MINMAX_NONZERO), and the median of a value and two normal constants is a clamp
  (LEONIDA_MED3_CLAMP), from trustno1-coder/VIctory-NVIDIA d08360e3 (mizzied). Both store the same bits: test
  float_max_min_and_med3_with_constants_store_the_same_bits_rewritten, on the card and on WARP, over signed zeros,
  denormals, NaNs and infinities. Retranslated and warmed in run d53 with no failure.
- play-nvidia.ps1 sets LEONIDA_PORT_GUARD=1 (renderer port 6): in turns of 4 s standing (runs d50, 147 phases) the
  frame's median -0.47 +-0.18 ms, the submitting thread -0.58 +-0.11.
- DirectStorage requests are told apart in a timeline: reading the source, inflating, unpacking BCPack.
- findings: the present smoother costs nothing by turns (runs d52: frame median -0.14 +-0.42 and -0.33 +-0.34 ms,
  the jitter of the title's presents from a median of 8.7 ms to 6.6 and 7.5); where the two walls stand.

AI-assisted (Claude). Tested on an RTX 4060 Ti, driver 616.64, Ryzen 5 7600X, Windows 11 (Series X profile, 1440p).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 12:54:50 -05:00
877c0d14a8 d3d12: BAR-windows note at info level, names GPU upload heaps, and the decision covers the off case (review)
- The note is info, not a warning: the launcher sets the cap by default on
  PCs under 48 GB, so it shows on every one without resizable BAR.
- It names the real condition (GPU upload heaps: resizable BAR, and a
  Windows and driver that offer them), as the doc comments do.
- mapped_windows asks for support only when a cap is set, so its "off" case
  is the one the code takes, and the test checks that support is not asked.
- The launcher's history comment and the README say "unless the card has
  under 6 GB" (an unknown size counts as large).
2026-11-29 17:36:49 +01:00
0bc6e21a10 The decal heap's relocations run, paired with the programs that move its blocks; capture by size
- The paired form takes a group of several console waves where every s_barrier is one each wave
  passes once whichever way it goes (emit::barriers_on_every_way: the block dominates every end
  and is in no loop); its LDS accesses are then fenced instead of waiting for the group, and it
  lowers ds_read2st64/ds_write2st64, the atomics with the old value back and ds_cmpst_rtn_b32.
  CS_DefragHeap_ComputeRelocations (02384a60fda6f2d0), dropped every frame before, now runs.
- A program named in LEONIDA_PAIRED_FOR takes the paired form before its own translation, so
  the launcher's names reach the five programs that move the heap's blocks (they copy
  overlapping 1 KB blocks, and in 32-lane halves one half stored over what the other had not
  read yet: white blotches there). The launcher names all six.
- LEONIDA_DUMP_SIZE=<w>x<h>[,..]: only targets of those sizes are saved with
  LEONIDA_DUMP_TARGETS (a frame renders some 380 targets, 61 at the screen's size; saving all
  took 11 s a frame).
- docs/findings.md: what a timeline of three frames shows (the card idle 22 ms a frame behind
  DirectStorage, texture refreshes and the submitting thread; 76 ms a frame of waits for the
  guards' lock).

After voidopcode/vilocity add4873 (GPL-3.0-or-later).

AI-assisted (Claude). Tested on an RTX 4060 Ti, driver 616.64: the paired-form tests (18,
those that run on the card included) and a new one for groups of several waves; a warm-up
start and a recorded tour (runs d46, d47): the relocations and the mover in use translated
and bound, only the two particle programs refused, no removed device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:30:58 -05:00
804280d803 Fork ports of 2026-11-29: faces, texture copies into title memory, the paired forms, switches by turns
Picture:
- Cutscene faces with only their eyes and teeth since the LDS bounds: the 25 face programs
  (the face network's operations, the normals rebuilt from blend shapes) keep their LDS
  accesses unbounded, by name and in the cache's key (LEONIDA_LDS_BOUNDS_EXEMPT; trustno1-coder
  9eb44fa6, Victorywillbeours222). Six of them run in the waterside tour.
- Copies and resolves into textures the title fills go back into title memory once their list
  has run, only the subresources written and of them the 4 KiB pages that change
  (LEONIDA_COPY_BACK, on; voidopcode/vilocity ee93826): a view the title places over that
  memory was made from bytes the copy never reached (faces in blocks of colour, clothes in
  another texture's). 9,216 copies (52 MB) in a run of 8 minutes; by turns the frame's median
  -0.33 +-0.50 and +0.34 +-0.25 ms.
- A list's prelude leaves out its upload of a texture another list wrote on the host GPU and
  submitted first (LEONIDA_UPLOAD_GUARD; trustno1-coder e530c003, aventureroestelar-source),
  noted only while the texture is still the title's.
- A texture asked for as reserved (levels on demand) is no longer cut from the pool, where it
  was never reserved and was made whole again (aki-gta6/aki-runtime ad214cd, KeethSmith).
- The launcher names all 33 programs the chain gave an approximate form in LEONIDA_PAIRED_FOR
  (timing runs d39: 1.98 ms of card a frame against 2.31 for the eleven before; tours d37, d38
  with nothing broken), and keeps device-removed data to the faulting address (d35: the card
  83 % busy against 89 % with breadcrumbs, the frames alike).

Shader translator (one re-translation): global stores count as UAV writes for early depth
(trustno1 788fe236); a sum of high halves is not taken for a wave reduction (Bebrik229); SDWA
sign-extended selects; mesh loops leave at their own exit at the limit instead of a `ret`
(LEONIDA_MESH_LOOP_EXITS, trustno1 6bbb6bca); readers indexed once per lowering (trustno1
7cc0d153, 101Leafy); raw FSSM records (XDAT 0x0c) read (fuzeofficial, via MiniVI 96e788c7).

Submitting thread, by turns of 4 s standing (runs d41, d43):
- Two lock passes, off by default (`=1` on): slot writes past the heap's lock of placed views
  (LEONIDA_SPANS_QUICK; Belobug a284ca7 via readmet3xt 96dfd9bb8, trustno1 #1937) and the
  texture queue's lock spared by marks (LEONIDA_QUEUE_MARKS; readmet3xt-lab b377071). Here no
  one waited for those locks: the submitting thread +0.12 to +0.30 ms a frame with them.
  `crate::asked!` is `toggled!` off by default.
- 8 parts joined against 2 (LEONIDA_JOIN_PARTS_AB): with 8 the frame -3.09 +-0.51 and -3.03
  +-0.26 ms, so the launcher's 8 stays. The write-watch asking joined across 8 MiB against
  256 KiB (LEONIDA_ASK_GAP_KB, _AB): with 8 MiB the card -1.08 +-0.50 and -1.14 +-0.22 ms busy.

AI-assisted (Claude). Tested on an RTX 4060 Ti, driver 616.64: the named unit tests of each
port (shader 12, gpu 11, texback and resource 36), a warm-up start (the same three programs
refused as before, no device removed), the turns above and recorded tours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:01:18 -05:00
865f6c24e3 d3d12: FSR 3 frame generation for cards without DLSS frame generation (D3D12-FSR3-FRAMEGEN)
DLSS frame generation runs on RTX 40 and 50 cards only. LEONIDA_FSR_FRAMEGEN=1 (the
launchers' -FsrFrameGen, or the F1 menu) presents through AMD FidelityFX's frame
interpolation swap chain instead: one generated frame between two of the title's, on RTX 20
and 30 cards and on any other D3D12 card.

- fsr.rs (new): loads amd_fidelityfx_loader_dx12.dll and amd_fidelityfx_framegeneration_dx12.dll
  from LEONIDA_FIDELITYFX_DIR (d3d12\amd-sdk\FidelityFX\bin by default) once WinVerifyTrust
  finds both signed, makes the swap chain, and before each present dispatches the prepare
  step with the depth, motion vectors, render size, jitter and camera range fg.rs collects for
  DLSS. The title's colour without the interface goes in when the frame is one composed plane.
  Not made while Streamline's frame generation is active.
- fg.rs: the inputs are collected while either frame generation is on (collecting()), and
  inputs_for_present() hands them to fsr.rs.
- host.rs: the swap chain comes from fsr.rs when it is on, and it is told before ResizeBuffers.
- The F1 menu has FSR 3 FRAME GEN 2X; it can be turned off and on while the game runs.
- play-nvidia.ps1 / play-d3d12.ps1: -FsrFrameGen and -FidelityFxDir; FSR frame generation is
  off with ray tracing, and LEONIDA_TEXTURE_ROOM_PERCENT defaults to 80 with it, since it holds
  1.5 to 2 GB of video memory.

Ported and adapted from trustno1-coder/VIctory-NVIDIA crates/victory-gpu/src/streamline/fsr.rs
(29d8dbf, GPL-3.0); credited in d3d12/README.md and the module's notes. AMD's DLLs are not in the
repository: the user puts them in the folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 12:43:22 -03:00
df5780ab51 d3d12: LEONIDA_WINDOWS_BAR_MB says once that it does nothing without resizable BAR (D3D12-BAR-WINDOWS-WARNING)
Title memory windows can only go to card memory the CPU maps when the card
has GPU upload heaps (resizable BAR, and a system and driver that offer it).
Without them the launcher still set 3072 on PCs under 48 GB of RAM and printed
"up to 3 GB", and every window asked the card's budget (two
QueryVideoMemoryInfo calls) before finding out the heap was not there.

window_mapped_for now checks for that memory first and logs once that the cap
does nothing. The launcher's line says the cap needs resizable BAR, and its
header and the README give the real default (under 48 GB of RAM, a card of
6 GB or more) instead of "under 24 GB".
2026-11-29 15:28:55 +01:00
cc0f662a70 Launcher: the approximate temporal resolves, sun shadow masks and light clusters in the paired form
Eight compute programs the translator gives an approximate form on 32-lane
hosts (each half-wave its own results) go in LEONIDA_PAIRED_FOR beside the
launcher's three: the four opaque temporal resolves, CS_GenerateShadowMasks
and its hair variant, and the two light-cluster passes. On two recorded
tours of one build from one save, approximate against paired, the player's
cap came out black as if in shadow in sunlight with the approximate forms
and lit with the paired ones; indoors both were alike. Only the named
programs are translated again.

AI-assisted (Claude). Tested on an RTX 4060 Ti, driver 616.64.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 06:57:09 -05:00
c553782c81 Decoration bake uploads can go ahead behind a gate in the card's queue (LEONIDA_BAKE_AHEAD, off: no gain measured)
The bake's synchronous upload was the one submission waited for in play: 0.2 a
frame, 20 to 60 ms each on a list thread. With LEONIDA_BAKE_AHEAD=1 the uploads
go as a flight of their own, a thread of ours shows the slots once the card has
run them, and the list with the bake's draw waits at a fence in the card's
queue (Host::execute_gated, HostList::wait_gate) that opens then. No submission
made the card wait at it on a tour, the tour's 546 frames had no fault, and two
moving A/Bs (33 pairs each) showed the frame the same, so it stays off.
A GPU test checks the order (and fails with TEST_NO_GATE=1).

Lists run synchronously are counted by caller (diagnostics). The frame
generation cap stays at 28: six starts gave rendered frames of 72 to 76 ms
whatever the cap, with the most even pacing at 28.

AI-assisted (Claude). Tested on an RTX 4060 Ti, driver 616.64.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 04:37:52 -05:00
e4973b5db6 Dynamic resolution by default: the title's own, between 1080 and 1440 lines
LEONIDA_RENDER_SCALE_MIN (the loader's hooks.rs) sets only the lowest scale of the
title's own upscaler (the immediate at rva 0x28f1e7e) and leaves the scale above it to
the title's dynamic resolution; a valid LEONIDA_RENDER_SCALE still holds one scale.
The launchers take it as -Lowest <height>; scripts\play-d3d12.ps1 now starts Series X
with -Lowest 1080 (a 2560x1440 output, 1080 to 1440 lines rendered) instead of
-Resolution 1440, which still holds 1440.

Same save, RTX 4060 Ti, frame generation off, two series (2026-11-29): median frame
57.0 and 59.6 ms against 66.0 and 67.9 held at 1440; the title's choice sat at its
1080 floor there. A recorded tour at the floor: no device removal, no new pipeline
refusals; the frames the scan flagged are camera turns into the sun.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 01:49:59 -05:00
89b8a57022 Launcher: the decals' tile classification (1f1fbd86759b3da2) in the paired form too: 2.3-2.9 ms of the frame
The paired form (a host thread runs two console lanes, no group barriers) takes that program from 2.9 ms to 0.03 in
the timing runs, and leaving it out in turns took 2.3 ms off the frame. It waited for a comparison with projected
decals in view. At the waterside save the decals in view are the player's (grime on the arms and the shirt): left
out by turns in one still view they go (run ds). In a start with the paired form they are there as in a start
without it, nothing blocky, and the standard moves of each start show the same 6 one-frame blips (runs pf0, pf1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:57:34 -05:00
0a325350e4 Merge origin/main into next 2026-11-28 20:19:25 -05:00
504ea0e418 Ghosting and blocky smears on camera turns: the title's motion blur is left out by default (-MotionBlur brings it back)
The title blurs by the movement of one frame. At this port's 12-14 frames a second its smears are twice as long as at
the console's 30, and its tile-based passes paste blocks of an older picture on camera turns: the ghosting and blocky
glitches the user reported. The launcher now adds the blur's first pass, the downsample (CS_MotionBlurDownSample*,
four variants), to LEONIDA_SKIP_PIPELINES, so the later passes find no movement and blur nothing; -MotionBlur (also on
scripts/play-d3d12.ps1) keeps it.

Measured at the waterside save with camera turns recorded (2026-11-28): with the blur, framescan flags a smear at the
end of every turn and trees streak in blocks (runs mb1, hz1); leaving out its first pass for the whole run (mbo1,
mbo2), no smear in any turn and no stale blocks. Leaving out a later pass instead is wrong: without
PS_MotionBlurLowRes the composite pastes stale tiles of an older view, without PS_MotionBlurProcessNeighborhood old
movement stays in its tiles (in-run A/B, mb1). As voidopcode/vilocity a0aa988 (GPL-3.0) found, clean in 670 frames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:19:23 -05:00