Commit Graph

15118 Commits

Author SHA1 Message Date
13127c76db Fail semantic runs without a completed unittest verdict
Retain process tracking and interrupt/timeout handling from main.
2026-11-27 23:41:32 +00:00
d442851972 Merge remote-tracking branch 'mandy/main' into merge/mandy-main 2026-11-27 17:58:49 -05:00
00131bb85e main keeps its own runtime, tools and tests; the branch's variants stay on port/d3d12-nvidia
After the merge the tree held this branch's older states of files main maintains. Run against main's code,
tests/test_acphal_abi.py and 11 of the 15 translator tests that differed failed, and the C++ runtime would have
been built from two generations of its sources. So that the merge cannot break what main builds and tests:

- runtime/ is main's, file for file (68 files only this branch had are not carried over);
- every file under tools/, tests/ and docs/ that both sides have is main's (80 files);
- ten translator tests only this branch has, which test rules main's translator does not have, and their
  fixtures are left out.

What main gains: d3d12/ (the Rust D3D12 runtime), its launchers and helpers (Launcher.bat, scripts/play*.ps1,
play-linux.sh, port_ctl.py, smooth-motion.ps1, fetch_vkd3d_proton.py, sync_victory.py), mods/example_lua, eleven
notes under docs/, seven tools and the tests that pass with main's code, the README's sections and credits, and
the "Runtime traps" section of AGENTS.md. Everything left out here is on the branch port/d3d12-nvidia.

Checked: compileall; make_game.py --help; check_no_game_data.py over every file this adds to main; the
line-ending, docs-encoding, CI-registration and docs tests; each test file that differs from main, on its own.
Not run: the whole translator suite, the C++ build, cargo over d3d12/ after the merge (d3d12/ is byte for byte the
branch's), CI.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 17:58:38 -05:00
587bb6f5ac Merge pull request #2447 from DadaCap/w64-one-lane-fold
wave64_emulate_opt: fold a region at most one lane of the wave runs (SHADER-W64-ONE-LANE-FOLD)
2026-11-27 23:51:05 +01:00
eac96d744c Merge branch 'port/d3d12-nvidia' into merge/mandy-main 2026-11-27 17:50:38 -05:00
b87abdef57 Merge mandy's main into port/d3d12-nvidia
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>
2026-11-27 17:50:37 -05:00
3e4d890c56 Merge pull request #2435 from quartz-heron-58/mesh-serial-waves
rdna2spirv: --mesh-serial-waves, an emulated mesh program's waves one after the other (SHADER-W64-MESH-SERIAL-WAVES)
2026-11-27 23:50:27 +01:00
ee215edf9f Merge branch 'port/aki' into port/d3d12-nvidia
What was taken from aki-gta6/aki-runtime (Aki-Developer, GPL-3.0): the frame line's reasons for dropped draws,
descriptor tables' slots given back as soon as the card has run a flight, four small faults (a pipeline build that
panics, a stale texture read-back, a fence of a removed device, tables of split submissions), the two-plane
composer's NaN and 10-bit output, a pipeline's skip-list answer kept, and in the translator the pixel colours held
to the console's HDR range and LEONIDA_PAIRED_LANES=exact.

Conflicts: draw.rs takes host::table_slots at its three places; host.rs keeps both sides, and table_slots ends in
wait_for_slots (8cc5193ec) instead of settling at once, so LEONIDA_DYNAMIC_WAIT=1 and its counts still apply.
TablesHeld's maps take the state's hasher.

Checked: cargo check --profile diag -p leonida --features diagnostics,mimalloc. Not run in the game yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 17:13:24 -05:00
1411b6ca38 Shader translator: pixel colours held to the console's HDR range; LEONIDA_PAIRED_LANES=exact tries the paired form before anything approximate
Every translator change taken from aki-runtime is in this one commit: the
translator's source is part of the shader cache key, so every shader is
translated again once after it (the launcher's precompile does it at the
next start: minutes).

1. Pixel colour outputs held to [-65024, 65024] (emit/lower.rs clamp_hdr;
   LEONIDA_HDR_CLAMP=0: written as they are, as before). The title renders
   light into R9G9B9E5 targets, which clamp at 65408 on the console; the
   host stand-in is a 16-bit float target, where a value past 65504 is
   stored as infinity, and the title's tonemap makes black of it (the black
   sun, black glitter on water and bright sky, in aki-runtime's runs).
   LEONIDA_NAN_SCRUB already held an infinity the program computed; a
   finite value too large for the target was still stored as one. A NaN
   becomes the maximum, unless LEONIDA_NAN_SCRUB made it 0 first (the
   launcher's setting). On by default, as there. Only colour targets, not
   depth; the view's format is not known to the translation, so a 32-bit
   float colour target is held too.
   From aki-gta6/aki-runtime 01f6f31.

2. LEONIDA_PAIRED_LANES=exact (emit/mod.rs): once the forms that are exact
   without a group barrier have refused a console wave64 compute program,
   the paired form is tried, before the exact forms that cost barriers and
   before each host half-wave is given results of its own ("local waves
   (APPROXIMATE)"). aki-runtime fe9c736 does this by default (about 30 of
   the title's programs take the paired form there on a 32-lane card);
   here the paired form is asked only where the wave-wide form would be,
   so those programs run approximately. The new test shows one: a console
   wave's OR inside a lane branch is by default an OR of each half.
   Opt-in, not the default: this tree's paired form of the water programs
   still draws blocks, it takes 32-bit float sums in the host's order
   where theirs refuses them unless told the guest mode, and none of it has
   run in the game. Not counted over the title's shaders here.

Already here from their paired work: a reduction's unseen partial sums
stand as zero (59e298a: paired.rs unseen_after, from Vice-Tay 5e588e8), the
rules of what the form takes (spilled programs, groups that fill their
waves, the LDS operations, the group rendezvous), the FP64 constant sums.
Not taken: their replay of FP32 reductions in the console's order
(paired_fp32.rs; needs AKI_WAVE_PAIRS_FP32 there and their notes say the
water's blocks are the same with it).

Files: leonida-shader/src/emit/lower.rs, mod.rs, paired_tests.rs,
wave64_tests.rs (a fixture made visible to paired_tests).
Tests: emit::barycentric_tests::a_pixel_colour_output_is_held_to_the_consoles_hdr_range,
emit::paired_tests::the_paired_form_before_the_approximate_ones_when_asked,
the_switch_reads_its_modes. The translator's suite on the card was not run
(the game was running), apart from the 14 tests of barycentric_tests.

From aki-gta6/aki-runtime 01f6f31 and fe9c736 (Aki-Developer), GPL-3.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 17:09:21 -05:00
bbbdf1f383 README: the list of what was taken from aki-runtime
The credit line names each thing ported from aki-gta6/aki-runtime (Aki-Developer, GPL-3.0); the commits carry the
hashes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 17:09:19 -05:00
84e728faff Merge branch 'port/mandy-prs' into port/d3d12-nvidia 2026-11-27 17:06:33 -05:00
d56ce02d21 NVIDIA launcher: the title's UI and fullscreen resolution follow LEONIDA_OUTPUT
With the output at 2560x1440 the title's settings.xml still said 0x0 for its UI (as the console: 3840x2160)
and the weapon wheel and menus came out half again too big. The launcher writes the output size into
uiResolution and resolutionFullscreen before the start (the first file is kept as settings.xml.original).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 17:03:48 -05:00
4688b03da3 A pipeline keeps its skip-list answer (LEONIDA_SKIP_KEPT=0: looked up at every draw, as before)
Every draw, dispatch and indirect execution asks whether the skip list (LEONIDA_SKIP_PIPELINES; the launcher puts the
seven water programs on it) leaves its pipeline out, on the threads that record lists, and each ask hashed the hash
string of every shader of the pipeline and looked it up. The list is read once and a pipeline's shaders do not
change, so the pipeline keeps the answer in a byte (pipeline.rs kept_answer): about 9,500 draws a frame ask with
one load each. Diagnostics builds only, as the skip list is (they are the builds played).

Not taken from the same commit: its tune.rs (numeric switches of the copy path read again from a file while the
title runs). Leonida's switches made with toggled! are flipped while it runs through LEONIDA_AB, and the F1 menu
holds the rest.

Files: pipeline.rs. Test: pipeline::kept_tests::an_answer_is_asked_for_once_and_kept. Not run in the game yet, and
its share of a frame is not measured.

From aki-gta6/aki-runtime f8cdc2d (Aki-Developer), GPL-3.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 17:03:15 -05:00
36ac0f4631 Two planes are composed into 10 bits a channel while Streamline presents (LEONIDA_PRESENT_10BIT=0: 8, as before)
DLSS frame generation makes its frames from the swap chain's picture. The two-plane presentation (Series S: the
scene and the interface) was composed into R8G8B8A8, and generated frames of an 8-bit picture came out in bands
(sky, skin) in aki-runtime's runs of 2026-11-27; composed into R10G10B10A2 the bands were gone there. Here the same
while frame generation's Streamline is started (fg::active). If the swap chain refuses the format once, 8 bits are
composed from then on, with a warning.

Not taken: their conversion of a single presented plane into 10 bits (bdcb503's ps_one). A single plane is copied
in the title's own format here (swap_format), which is 10 bits or more where the title has them, and an 8-bit
plane gains no levels by being copied into 10.

Files: host.rs (planes_format, present_tenbit, two places in present_planes). Test:
host::relay_tests::two_planes_are_composed_into_10_bits_under_streamline_only (the choice; the composing itself needs a
card with Streamline). Not run in the game yet.

From aki-gta6/aki-runtime 2f43f8b and bdcb503 (Aki-Developer), GPL-3.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 17:01:42 -05:00
eb96d2570f NVIDIA launcher: the lighter title settings are opt-in; the profiler picks threads by their start too
Measured like for like at the save (three minutes of the idle camera each, Series X, 2026-11-27): 92.5 ms a
frame and 6,353 draws with the console's settings.xml, 90.9-101.7 ms and 6,636-7,079 draws with aki-runtime's
lighter set, and 338-350 draws a frame dropped for want of a pipeline against 191. The earlier figure in
8576e3d5c (7,700-9,500 draws to 3,100-4,800) compared a night drive over a bridge with the save and was wrong.
LEONIDA_TITLE_GRAPHICS='performance' writes the set; the default leaves the file as the title wrote it.

LEONIDA_PROFILE_ONLY also matches a thread's start (module+rva), for the title's own threads, which have no name.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:58:28 -05:00
a8d2f48e37 Two-plane composer: a NaN no longer comes out black (LEONIDA_COMPOSE_NAN=0: saturate, as before)
saturate() makes a NaN 0: black specks and a black sun where the upscaler or frame generation handed one over (sun
glints on water). The composer's pixel program clamps through a test on the bits instead (NaN and +infinity 1, negative
and -infinity 0), which the compiler cannot fold away as it may x != x. Only the two-plane presentation composes
(Series S); with the sharpening on, a NaN in the scene already came out as its neighbours' darkest, so this is for the
interface plane, its alpha, and LEONIDA_SHARPEN=0.

Files: compose.rs. Test: compose::source_tests (the program compiles both ways and the two differ; no card needed).
Not run in the game yet.

From aki-gta6/aki-runtime 33c21b9 (Aki-Developer), GPL-3.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:55:07 -05:00
89a08ac2f2 Four small faults: a pipeline build that panics, a stale texture read-back, a fence that never arrives, tables of split submissions
- pipeline/make.rs: a host pipeline whose build panics (a shader the
  translator trips over) counts as refused, its waiters are woken and
  the worker goes on. Before, the worker's thread ended with the entry
  never made: its draws waited out their budget every frame, and each
  such pipeline cost a worker. LEONIDA_PIPELINE_PANIC_CATCH=0: as before.
  (fxceless/victory-fork 46da5ee, pull request 1353.)
- texback.rs, host.rs texture_written: a list that writes a texture again
  whose registered read-back went stale (the title reused or remapped the
  memory the texture tiles into) registers it anew; the stale one was
  kept and then dropped, so the title read what was there before.
  LEONIDA_BACK_RENEW=0: kept, as before. (fxceless 86d446b, 1376.)
- host.rs: the two background threads that wait on the host's fence (the
  late helper, the relay) stop the run with a report when the wait fails
  or the fence says u64::MAX, a removed device, instead of landing
  flights the card never ran. LEONIDA_FENCE_CHECK=0: go on, as before.
  (fxceless d036cea, 1366.)
- queue.rs submit_split: the lists that ran at once give their tables'
  slots back then, as in submit_cut. Only reached with
  LEONIDA_CUT_WAITS=0, so no switch of its own. (fxceless af23c65, 1320.)

Already here from the same commit: slots given back only to the heap
that gave them (descriptor/host.rs release_many_for, LoverCatys d843417),
the pinned alias texture (resource.rs Held/alias_of), the compare slice
near a copy's start (shadow.rs, saturating_sub).

Tests: pipeline::make::tests::a_panicking_pipeline_is_refused_and_the_worker_continues,
texback::tests::a_stale_readback_is_registered_again,
host::relay_tests::a_removed_devices_fence_value_is_not_reached.
Nothing of it has run in the game yet.

From aki-gta6/aki-runtime d9d1341 (Aki-Developer), GPL-3.0, which
carried these from the pull requests named.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:52:05 -05:00
4ad46cfc62 Descriptor tables' slots come back when the card has run a flight, and a refused table reaps finished flights before it waits
A flight's dynamic descriptor slots were given back at the end of its
landing, after its copies back and read-backs (milliseconds a flight).
Only the card reads them, so they are given back at the landing's start
(host.rs release_flown_tables, in relay_land and in the settle without
the relay). LEONIDA_TABLES_EARLY=0: at the end, as before.

A table that finds no slots (draw.rs: tables, the root views' one-slot
tables) asked again only after settle_for_fence, which under the relay
waits, with the submission lock held, until every flight has landed.
Now it first gives back the slots of the flights in the line the card
has already run (release_finished_tables: no wait; taken under the
line's lock, let go of after it) and asks again; only then does it
wait. LEONIDA_SLOT_SETTLE=0 leaves the wait out (the table is refused
and its draw dropped): aki-runtime runs that way, after measuring
90-120 ms frames against 55 with this wait and two others on (their
handoff of 2026-11-27; which of the three it was is not isolated).
Here the wait stays on by default, as before; the frame line now says
how many tables a frame got slots the first way and how many waited
("tables without slots at first: ..."), so a run shows whether it ever
happens.

Not taken from the same commit: the ring split in regions by table size
(descriptor/ring.rs). Leonida's ring is searched by per-thread leases of
512 slots over a bit set (XaviFortes 13e1f5e), so its tables do not
interleave the way theirs did; "table: free slots apart" in the frame
line says if that changes. Compute dispatches waiting for their pipeline
(fork pull request 1312): not taken, one of the three waits above, and
the launcher's LEONIDA_PIPELINE_WAIT_MS=10000 waits once a pipeline.

Nothing of it has run in the game yet.

Files: host.rs (the four functions above, two calls), draw.rs (three
calls of host::table_slots, State::tables_taken + TablesHeld), list.rs
(Detached::take_tables), drops.rs (the two counts, a test).

From aki-gta6/aki-runtime d9d1341 (Aki-Developer), GPL-3.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:50:23 -05:00
9df168ecbf README: what was taken from aki-runtime (Aki-Developer)
The credit named the port as shared for reference; the first port from it is in (the dropped draws by reason,
aki-gta6/aki-runtime d9d1341, GPL-3.0), so the line says what was taken.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:45:30 -05:00
186de43ca9 The frame line names why draws were dropped: left out on purpose apart from not meant
Every draw, mesh dispatch, dispatch and indirect execution that does not
run on the host is counted by its reason (drops.rs): skip list, structure
builder off (both on purpose), pipeline not made yet, pipeline refused,
a descriptor table that found the ring full / its free slots apart /
refused without a search, a failed bind, other. The frame line of
leonida_gpu::host says them per frame after "dropped N without a host
pipeline (M being made) and K indirect" (that text is unchanged:
scripts/port_ctl.py reads it), e.g. "of both per frame: left out on
purpose 307.0 (skip list 7.0, structure builder off 300.0), not meant
0.0". The F3 panel's DROPPED shows those not meant only.

The diagnostics lines by pipeline named only skips and missing pipelines;
a draw whose pipeline was made and whose table or bind failed had no line.
In a run of 2026-11-25 (logs/save-ref1.log) 304-310 of about 310 dropped
a frame were stages of the ray-tracing structure builder, which is off.

No switch: counting only. Nothing of it has run in the game yet.

Files: drops.rs (new), draw.rs (the counting at each place a draw or
dispatch gives up), list.rs (indirect executions), host.rs (frame line),
host/panel.rs, pipeline.rs + pipeline/make.rs (why a pipeline is not
there), descriptor/host.rs (HostHeap::refusal, new, nothing else touched).
Tests: drops::tests (5).

From aki-gta6/aki-runtime d9d1341 (Aki-Developer), GPL-3.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:45:11 -05:00
34e33d3ddc Merge pull request #2509 from OreoFR/consolidate/eight-gb-world
d3d12: merge bundle of eight open runtime PRs, conflicts fixed (#2020 #2166 #1851 #2465 #1705 #2117 #2012 #407)
2026-11-27 22:42:07 +01:00
8576e3d5cb NVIDIA launcher: the lighter set of the title's own graphics settings is written before each start
The title keeps its graphics settings in storage\settings\settings.xml and writes its console defaults
back whenever it exits by itself: ray-traced dynamic shadows, two samples of screen-space occlusion,
motion blur, full detail and grass distances. The launcher now writes the lighter set aki-runtime uses
(Aki-Developer: Apply-LowVramSettings.ps1 and docs/session-2026-11-26.md of aki-gta6/aki-runtime, GPL-3.0)
and keeps the first file as settings.xml.original. On the Series X profile the same road went from
7,700-9,500 draws a frame to 3,100-4,800 and the submitting thread's preparing from 40-45 ms to 25-34
(2026-11-27). -More @{LEONIDA_TITLE_GRAPHICS='keep'} leaves the file alone.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:39:55 -05:00
18521da367 Merge branch 'port/forks-1600' into port/d3d12-nvidia 2026-11-27 16:34:35 -05:00
466dfb7dae d3d12: the staging queues' comment above their fields after the #407 merge (comment only)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 22:33:41 +01:00
68827f4742 Title memory by address: a page given its place at a submission remembers when it was taken (LEONIDA_PLACE_TAKEN=0: as before)
What was wrong: `Memory::place` gives a page of a packed structure the
builder came to its place in an arena at the list's submission and sends
its bytes up (`take`), but left the page's `taken` at 0, "never". The next
`Memory::bring` of that page therefore found it stale whatever the write
watch said, took all of title memory's bytes and sent the whole page up
again (`merge` with `never`, `resend`), over what the builder had made of
them on the card meanwhile: a structure unpacked there went back to its
packed bytes, built nodes sharing the page to the title's.

What changes: `place` asks the write watch for the page before the bytes go
up (`watch::writes`, as `bring` does; from the journal if the submission
asked ahead for it) and keeps that asking's number as the page's `taken`.
A later `bring` then takes only what the title wrote since, a dword at a
time, and resends nothing whole. What the title writes between the asking
and the copy is in the copy and is found written again by the next asking:
taken twice, lost never.

Where it applies: `place` is reached only from `land`, which only a builder
dispatch defers (`LEONIDA_BVH_BUILDER=1`, the launcher's -RayTracing). With
ray tracing off, as the launcher starts the title by default, nothing
changes. It costs one asking for each page placed, on the thread that
submits.

LEONIDA_PLACE_TAKEN: on unless 0.

From TaynanGT/Vice-Tay a33271f ("Remember write-watch stamps for placed GPU
pages (#342)", co-authored there by urielbeaupre), GPL-3.0: the same lines,
for the same function, which this tree has unchanged.

No test of its own: it needs an arena on the card, title memory under the
write watch and a builder's page. Checked: `cargo check --profile diag -p
leonida --features diagnostics,mimalloc` (the 10 warnings of leonida-gpu from
before); `memory::tests` (2 passed). Not run in the game, and not with ray
tracing on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:32:41 -05:00
8cc5193ec1 Dynamic descriptor slots: a draw that finds none can wait for the next landing without the submission lock (LEONIDA_DYNAMIC_WAIT=1; off by default)
What it is about: a table made afresh, a root SRV and a root UAV take
dynamic slots of the view heap (`State::tables`, `root_srv_table`,
`root_uav`). When none is free the recording thread settled everything in
the air (`settle_for_fence`) and asked again. The slots come back flight by
flight, when the thread that lands flights is done with one
(`Detached::release_tables`), and that thread never takes the submission
lock; the settle waits for all of them and keeps that lock meanwhile, so the
submitting thread stands at it with submissions ready.

What changes: the three places go through `host::wait_for_slots`. Without
the switch it does what they did (settle, ask again), and counts. With
LEONIDA_DYNAMIC_WAIT=1 and the relay on, the thread first waits for
landings without the lock, asking again after each (`take_after_landings`),
until it has its slots or nothing is in the air and nothing is being landed
(no slot can come back that way then); only then the settle as before. A
frame-rate line says, when any draw found no slot: how many per frame, the
time they waited, how many had their slots after a landing, how many
settled, how many went without.

Off by default, and for a reason: nothing here has run in the game, and
whether a draw of this title finds no slot at all with the launcher's
524,288 dynamic slots is not known. The line says it ("dynamic descriptor
slots: per frame ... draws found none"); if it never appears the switch has
nothing to do. A diagnostics build turns it on and off while the title runs
(LEONIDA_AB=<seconds>,LEONIDA_DYNAMIC_WAIT).

What it is aimed at: the submitting thread's wait for the submission lock
in frames where slots run out (not a line of the CPU profile of 2026-11-27,
which shows running time; the frame-rate lines' "waiting for the submission
lock" and the new line are the ones to read).

From fxceless/victory-fork 52dfd12 ("Ray-tracing fixes and a lock stall
fix; README says where ray tracing is"), GPL-3.0: `wait_for_slots`,
`dynamic_wait` and the line, as there. Measured there on a GeForce RTX 4070
at 9,000 to 11,000 draws: 0.64 settles a frame of 19.7 ms each, frames with
one 92.7 ms against 68.1 ms. Not as in the source: the asking is a function
of its own that a test can call; the lowest count of free slots is not kept
(two shared counters written at every table made, on eight threads); and
f299fba's later parts (translation paused while slots are short, slots
given back at the start of a landing, `=alt`) are not here.

New test `host::dynamic_wait_tests`: the asking stops with its slots, asks
again after each landing and no more, looks at the air before it asks, and
stops when the air was empty at an asking that found none.

Checked: `cargo check --profile diag -p leonida --features diagnostics,mimalloc`
and without `diagnostics` (the 10 and 18 warnings of leonida-gpu from
before); the test passes. Not run in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:30:28 -05:00
956a1fc94e Lists' scratch memory: a chunk's address on the card is asked once, when the chunk is made
`HostList::scratch` and `scratch_held` took a reference to the chunk's
buffer and asked it for its GPU address every time a list took scratch
memory: for every constant buffer of a table made afresh
(`State::tables`), every root constant buffer copied because it is not on
256 bytes (`fill_scratch`), the rectangles' corners and the indirect
tables. A buffer has one address for as long as it lives, so `Chunk` keeps
it (`gpu`, asked in `take_chunk`), and a piece's address is the chunk's plus
its offset. `scratch`, which hands no buffer out, takes no reference to it
any more; `scratch_held` takes the one its descriptor slot keeps, as before.
A piece bigger than a chunk has a buffer to itself and asks it once, as
before. `scratch_at` (the copies at their place, `host/place.rs`) gives what
it gave. Same addresses; a pure saving.

What it is aimed at (CPU profile of 2026-11-27, Series X profile, about 9,500
draws a frame): `State::bind` on the threads that record lists, the part
that makes tables afresh and binds root constant buffers. A small part of
it: two calls into the buffer and a counted reference less for each piece.

From maren-halv/VIctory-DXR e0e549a ("perf: sync 40+ FPS raster wins
(9b958c9) ..."), GPL-3.0: the idea of its `State::scratch_base` (the scratch
buffer's address kept per list). Here it is kept with the chunk instead, so
that every list that takes the chunk from the spare ones has it and nothing
has to be forgotten when a list moves to its next chunk.

New test `host::scratch_address_tests` (on the host's card): the addresses
`scratch` and `scratch_held` give are the buffer's own plus the pieces
before them, and a piece bigger than a chunk is at its own buffer's. It
compiles; it was NOT run, because the title was running on the card and
tests on the card were not to be run meanwhile.

Checked: `cargo check --profile diag -p leonida --features diagnostics,mimalloc`
(the 10 warnings of leonida-gpu from before); `cargo test -p leonida-gpu
--features diagnostics --lib --no-run` builds. Not run in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:27:18 -05:00
cce11849ad Pipelines: which root SRVs a shader reads with a bias is known with the pipeline, not asked at every draw
`State::bind` went through a stage's user data (up to 64 words) for every
root SRV of every draw, to see whether the shader adds the bytes its raw
view begins early by (a word of the kind `USER_VIEW_BIAS` for the title's
root parameter). The answer depends on the shader alone: `Stage` has it as a
bit for each of its root SRVs (`root_srvs_biased`), worked out when the
pipeline is made (`biased_root_srvs`), and the draw reads the bit
(`Stage::root_srv_biased`). Past 64 root SRVs, which no root signature has
room for, the stage asks the user data as before. Same answers; a pure
saving.

What it is aimed at (CPU profile of 2026-11-27, Series X profile, about 9,500
draws a frame, 1,600 root SRVs recorded a frame and more bound and left out
by the state cache): the part of `State::bind` that is its own (listed under
`prepare_for`, 32 %), on the threads that record lists. A small part of it.

From maren-halv/VIctory-DXR e0e549a ("perf: sync 40+ FPS raster wins
(9b958c9) ..."), GPL-3.0: its `Stage::root_srv_biased` mask, the same idea
and layout, written for this tree (the mask is made from the stage's own
list of root SRVs, with a function a test can call, and the stage falls back
to the scan past 64).

New test `pipeline::host::tests::the_root_srvs_read_with_a_bias_are_those_a_draw_found`:
the mask against the scan a draw did, for words of other kinds and other
parameters, no words, no root SRVs, and more than 64.

Checked: `cargo check --profile diag -p leonida --features diagnostics,mimalloc`
(the 10 warnings of leonida-gpu from before); the test passes. Not run in
the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:23:56 -05:00
d06b2be257 Read backs: a list's read-back buffers are kept for the next read backs of their sizes (LEONIDA_READ_BACK_POOL=0: as before)
What was slow: a read back is recorded into a buffer of ours in read-back
memory. There are two kinds: a texture the title copies into a buffer of its
own (`list::read_back`), and a texture shaders wrote that the title reads on
the CPU, copied when the list closes (`texback`, from `HostList::close`).
Each buffer was a committed resource made for the one copy, on the thread
that records or closes the list, and released when the list was reset. In
the CPU profile of 2026-11-27 (Series X profile, about 9,500 draws a frame)
`Host::read_back_buffer` was 5 % of the running time of the threads that
record lists, and `HostList::close` 5 % of the submitting thread's.

What changes: with the switch a read-back buffer is made in whole 64 KiB
(`read_back_size`; a buffer of its own takes whole 64 KiB of the card's
address space either way). When a list is reset or dropped its buffers go to
a table (`give_read_backs`, from `Deferred`'s drop), and
`Host::read_back_buffer` takes one of the size from there before it makes
one. The table is the one the scratch chunks already use (`Spare`); it keeps
64 MiB at most (16 MiB on a PC with little memory) and is emptied when host
memory is pressured, with the spare scratch chunks.

Why a buffer in the table is nobody's: a list's read-backs are read when its
submission has run (`read_backs`, which copies the texels out under the
list's lock), a list is reset only after its last submission finished, and a
buffer goes to the table only then, and only if the list's reference to it
is the last one (`sole`: the count the resource itself gives). One made
without the switch (an A/B run) is not kept.

What differs with it on, besides who makes the buffers: the bytes of a
buffer its copy does not write (the padding of rows) are what the buffer
held before, not zeros; nothing of ours reads them. A frame-rate line says
how many were made, taken, kept and let go.

LEONIDA_READ_BACK_POOL: on unless 0; a diagnostics build turns it on and off
while the title runs (LEONIDA_AB=<seconds>,LEONIDA_READ_BACK_POOL).

Leonida's own, from its profile; no other project's code.

Checked: `cargo check --profile diag -p leonida --features diagnostics,mimalloc`
and without `diagnostics` (the 10 and 18 warnings of leonida-gpu from before,
none new). New tests `host::read_back_pool_tests`: the sizes; and, on the
host's card, a list's buffer is not the next read back's while the list
holds it, is the next one's of its size once the list is reset, once, and is
not kept if something else still names it. Also run: `late_tests`,
`texback::`, `spare::` (7 passed). Not run in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:21:23 -05:00
6d40be2b88 AddressHash: a key handed over as bytes is hashed eight bytes a step, not one
`AddressHash::write` took a step (a rotation, a multiplication, a fold) for
every byte. Keys that are integers or tuples of them never come that way,
but an array does: the standard library hands `[u32; 3]` over as its length
and then its twelve bytes at once. That is the key of the views a list made
(`descriptor::host::ListViews::made`: a descriptor record's tag, index and
generation), asked twice in `HostHeap::make_listed` for every slot of every
table a list makes afresh, and again by `listed_view` and `note_listed`:
thirteen steps each time. Now three: the length, eight bytes, and the four
left together with their number (so a key is not the longer key that ends
in zeros). Same tables, same contents; only the hash values differ.

What it is aimed at (CPU profile of 2026-11-27, Series X profile, about 9,500
draws a frame): `descriptor::host::HostHeap::make_listed`, 25 % of
`State::bind` on the threads that record lists.

Leonida's own; no other project's code.

New test `host::address_hash_tests::a_record_of_three_words_is_hashed_a_word_at_a_time`:
the standard library hands a record over as said (it fails if that changes),
the hash is the three steps done by hand, records that differ in any one bit
hash apart, bytes left over count, and 4,096 records of one tag spread.

Checked: `cargo check --profile diag -p leonida --features diagnostics,mimalloc`
(the 10 warnings of leonida-gpu from before); `cargo test -p leonida-gpu
--features diagnostics --lib address_hash_tests`: 2 passed. Not run in the
game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:17:32 -05:00
e65692ad63 Merge #407 into consolidate/eight-gb-world
# Conflicts:
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-27 22:17:05 +01:00
bab63563a8 Merge #2012 into consolidate/eight-gb-world
# Conflicts:
#	runtime/CMakeLists.txt
2026-11-27 22:16:46 +01:00
f47ca265bd Merge #2117 into consolidate/eight-gb-world 2026-11-27 22:16:30 +01:00
75151be1da Merge #1705 into consolidate/eight-gb-world 2026-11-27 22:16:29 +01:00
048eeed509 Merge #2465 into consolidate/eight-gb-world 2026-11-27 22:16:28 +01:00
6014cb1c84 Merge #1851 into consolidate/eight-gb-world 2026-11-27 22:16:27 +01:00
00f317f0c7 Merge #2166 into consolidate/eight-gb-world 2026-11-27 22:16:26 +01:00
c20733f622 Merge #2020 into consolidate/eight-gb-world 2026-11-27 22:16:26 +01:00
46f0ef36d4 Lists: the tables asked at every draw that still used the standard hash are keyed by AddressHash
A list's texture states, its depth twins, the textures it brings up to date,
their aliases, its root SRV and root UAV slots, and the submitting thread's
set of staging buffers refreshed are keyed by addresses of ours or other
integers and asked at every draw (`ensure_state` and `twin_use` for every
texture a draw reads or writes, its targets and its depth; `defer_texture`;
`root_srv_table`, `root_uav`). They were the last of the list's per-draw
tables on the standard library's SipHash; the others (`refreshed`, `filled`,
`gpu_written`, `bound`, `fresh_tables`, the list views) already use the
repository's AddressHash. Same contents and results: nothing reads these
tables in an order that matters, and the order was random per table before.

What it is aimed at (CPU profile of 2026-11-27, Series X profile, about 9,500
draws a frame): `draw::readable` (18 % of `State::bind` on the threads that
record lists) and the states `prepare_for` asks for after it, which take a
list's `states` and `twins` at each texture; and `Batch::refresh_textures` on
the submitting thread.

New test `host::address_hash_tests`: the keys these tables hold (host copies
16 bytes to 64 KiB apart, root views with and without the bit for a view
that begins early, fills) hash apart and spread. Measured there, for 4,096
keys in as many places: 1.1 to 2.1 keys looked at to find one (chance: 1.5),
the fullest place 22 keys for copies 16 bytes apart. Not as even as SipHash
for keys a few bytes apart; the tables are a list's own and small.

From DoubleGhosty/cool_fox 74eda3b ("Lists: the per-draw maps keyed by address
use AddressHash, not SipHash"), GPL-3.0-or-later. Beyond the source: the
list's `texture_aliases` and the submission batch's `textures`, which this
tree has and are keyed the same way.

Checked: `cargo check --profile diag -p leonida --features diagnostics,mimalloc`
(the 10 warnings of leonida-gpu from before, none new); `cargo test -p
leonida-gpu --features diagnostics --lib address_hash_tests`: 1 passed. Not run
in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 16:12:49 -05:00
d21d9fb875 README: credit Aki-Developer for sharing aki-runtime
At the maintainer's request. Nothing from aki-runtime is in the tree yet: the repository could not be
read from this PC (private; the stored GitHub credentials are refused), so the line says what was
shared, not what was used.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:58:58 -05:00
77e4e85ff4 NVIDIA launcher: Series X outputs 2560x1440 itself, windows in the card's memory under 48 GB of RAM, LEONIDA_PLACED_TITLE on
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:57:07 -05:00
31e42e6f48 Merge branch 'port/forks-1425' into port/d3d12-nvidia 2026-11-27 15:54:09 -05:00
4565dfb874 PR #2429: docs(restofworld): clean truncated merge remnant and update decoder status links
From https://github.com/ProjectLeonida/mandy/pull/2429 (head f6397802c5), applied as a reviewed patch.

Co-authored-by: Andretuta <Andretuta@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:48:44 -05:00
fe63ca4642 PR #1435: instance_lists: ask report_paths for the report-path guard (INSTANCE-LISTS-SHARED-REPORT-PATH)
From https://github.com/ProjectLeonida/mandy/pull/1435 (head 7fb61fe3f0), applied as a reviewed patch.

Co-authored-by: Dashhhhhhhh <Dashhhhhhhh@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:48:44 -05:00
63c9b3af8a PR #1434: skin_streams: ask report_paths for the report-path guard (SKIN-STREAMS-SHARED-REPORT-PATH)
From https://github.com/ProjectLeonida/mandy/pull/1434 (head 97b1ac40b0), applied as a reviewed patch.

Co-authored-by: Dashhhhhhhh <Dashhhhhhhh@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:48:43 -05:00
12f2b6e005 PR #1430: bink_index: ask report_paths for the report-path guard (BINK-INDEX-SHARED-REPORT-PATH)
From https://github.com/ProjectLeonida/mandy/pull/1430 (head fb43ae7e5a), applied as a reviewed patch.

Co-authored-by: Dashhhhhhhh <Dashhhhhhhh@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:48:43 -05:00
e2a18e20bb PR #1084: anim tools: use shared report path guard
From https://github.com/ProjectLeonida/mandy/pull/1084 (head eac7353ec7), applied as a reviewed patch.

Co-authored-by: j-weiner <j-weiner@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:48:42 -05:00
f13eab3fc6 PR #889: world_index: restore write mode before unlink on replace failure and publish mode (WORLD-INDEX-STAGE-CLEANUP)
From https://github.com/ProjectLeonida/mandy/pull/889 (head 4822bcf9de), applied as a reviewed patch.

Co-authored-by: trigger337 <trigger337@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:48:42 -05:00
b72b9b2cd4 PR #859: navmesh_tile_obj: restore write mode before unlink on replace failure and publish mode (NAVMESH-TILE-OBJ-STAGE-CLEANUP)
From https://github.com/ProjectLeonida/mandy/pull/859 (head 9c0c09382d), applied as a reviewed patch.

Co-authored-by: trigger337 <trigger337@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:48:41 -05:00
efba22c1ce PR #838: world_lights_paths: restore write mode before unlink on replace failure and publish mode (WORLD-LIGHTS-STAGE-CLEANUP)
From https://github.com/ProjectLeonida/mandy/pull/838 (head 09bbad3cca), applied as a reviewed patch.

Co-authored-by: trigger337 <trigger337@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:48:40 -05:00