Commit Graph

70 Commits

Author SHA1 Message Date
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
393901a5b8 Merge pull request #2900 from alpfilho/d3d12/series-s-native-pool
d3d12-loader: Series S above 720p gets the other consoles' memory budgets (D3D12-SERIES-S-NATIVE-BUDGETS)
2026-12-02 01:09:04 +00:00
4ccf3fed82 Merge pull request #2811 from thiefyzheng/docs/benchmark-4060-laptop-8gb
PORT-BR-DOC-4060-LAPTOP: port 8 GB laptop benchmark note
2026-12-02 00:48:02 +00:00
535308fe48 Merge pull request #2761 from merzleckeier/fix/1080-1440p-motion-blur-switch
d3d12: preserve explicit MotionBlur values in the 1080p–1440p preset
2026-12-02 00:47:52 +00:00
afe0b798f4 Launcher tests and docs for -PrecompileAll
- tests: -PrecompileAll is among the switches checked against play-d3d12.ps1,
  and it is passed only with the precompile on.
- README.md, docs/launcher.md, d3d12/README.md: the switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:30:37 -05:00
61a47216ce d3d12-loader: test the levers' entry, and a lowest scale alone reaches 1.0 on Series S
Review of 8677729c9 (KelboLive):

- resolution_levers, the loader's only entry to the levers (windows.rs), was not pinned: replacing its apply_levers
  call with nothing still passed. A test now calls it with the environment set under a lock and put back, with a
  hash that starts as the 1.0.2.1 build's and with another one, and with no lever set.
- A lowest scale with neither a pinned scale nor LEONIDA_OWN_UPSCALER (F1's LOWEST SCALE alone) still took the
  lowest as the ceiling. The title's own dynamic resolution rises to max(lowest, 1.0) on Series S whichever way it
  is reached, so a lowest scale now has a ceiling of 1.0 too.

Both shown to fail without the fix: dropping the apply_levers call fails the new entry test; the old ceiling fails the
lowest-alone case. cargo test --locked -p leonida-loader --lib with LEONIDA_GAME_DIR: 88 passed; clippy -D warnings
clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 16:45:24 -03:00
8677729c94 d3d12-loader: say where the pool's size sits in its row, and the thousandth above 2/3
Review of de550f7cb (imShangLi):

- The comment called the pool "the third" of the row at 0x6186250, while the patch is 0x18 further on, which reads as
  the fourth. Each row is an 8-byte header followed by its nine sizes from +8 (the copy reads [row + 0x8]), so
  0x6186268 is the third size. The comment says so now.
- The README said "above 2/3"; the code wants more than 2/3 + 0.001, so that Series S' own 2/3 (0.6667) keeps the
  console's budgets. The README says that now.

No code change. cargo test -p leonida-loader --lib hooks: 15 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 15:50:09 -03:00
de550f7cbf d3d12-loader: the Series S budgets follow the highest scale the title can reach
Review of 0cbc9e93a (KelboLive):

- The budgets followed the lowest scale, so -Lowest 720 on Series S (LEONIDA_RENDER_SCALE_MIN=0.6667) got none.
  The title's own upscaler stores its minimum at 0x28f1e78 and its maximum at 0x28f1e87 as max(minimum, f()). f() at
  0x1fb4300 is 1.0 on Series S and 2/3 elsewhere. So with that upscaler forced and no pinned scale, Series S may
  render up to 1.0 whatever the lowest. The budgets now follow the ceiling:
  - a pinned scale is its own ceiling;
  - the own upscaler with no pinned scale has a ceiling of 1.0, as with -Lowest or the F1 menu's OWN UPSCALER;
  - with neither, the ceiling is the lowest asked for.
- The call sites are covered now. resolution_levers reads the environment (Levers::from_env), checks the build and
  calls apply_levers. the_levers_give_series_s_its_budgets_for_the_highest_scale_it_can_reach runs apply_levers on
  an image buffer for -Resolution 1080, -Lowest 1080, -Lowest 720, the own upscaler alone, pinned 2/3, a pinned
  scale over a lowest one, and FSR alone. It fails when the budgets are dropped from apply_levers, and with the old
  floor rule.

cargo test -p leonida-loader --lib: 87 passed. cargo clippy -p leonida-loader --all-targets -- -D warnings: clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:21:31 -03:00
0cbc9e93ab d3d12-loader: the Series S budgets for -Lowest too, both or neither, and a test that they land
Review of 29016670a (KelboLive):

- The budgets were applied only for a pinned LEONIDA_RENDER_SCALE. -Lowest 1080 on Series S sets
  LEONIDA_RENDER_SCALE_MIN to 1.0, and the title renders at or above it. The minimum path now applies them too.
- They are written by series_s_budgets through apply_all, so a build where one place differs keeps the console's
  own pair instead of a raised pool alone.
- the_series_s_budgets_are_written_both_or_neither writes them into an image buffer:
  - both are written at 1.0 and at 0.75, and neither at 2/3 or 0.5;
  - neither is written when the heap's place holds other bytes.
  With the helper made to write nothing, it fails.
- The game-step test has its doc comment back. The threshold test is named for both budgets.
- The README says -Lowest is covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:52:57 -03:00
29016670a0 d3d12-loader: Series S above 720p gets the other consoles' memory budgets (D3D12-SERIES-S-NATIVE-BUDGETS)
Series S at render scale 1.0 (1080p, `-SeriesS -Resolution 1080`, `play-S-1080p.ps1`) stopped the title at its own
breakpoint as soon as it started. The README listed it as "does not work yet". The title sizes two memory budgets per
console, both for Series S' own 2/3 scale, and at 1.0 each in turn is too small:

- The render-target pool, the third of nine pool sizes in the per-console table in .rdata: 1277 MiB on Series S,
  2199 MiB on the others. Its allocator treats a failed allocation as fatal, and a 1 MiB one failed.
- A heap counted in 64 KiB pages, `mov eax, 0x1290` then `cmovne` with 0x2c60: 297 MiB on Series S, 710 MiB on the
  others. A check compares a 432 MiB resource with it and stops at a breakpoint.

With a pinned render scale above 2/3, resolution_levers now writes the other consoles' sizes into both places. Only
Series S' row and its immediate change; the other consoles already hold such a scale. The retail-bytes test checks
both places and the other consoles' pool size.

RTX 3060, driver 621.40: Series S at 1080p ran five minutes into the world, rendering 1920x1080, at 11-22 fps, with
no crash. Before, it stopped about 8 s in, once at each budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:39:16 -03:00
8edf0c8429 Verify explicit motion-blur forwarding and document Series X scales 2026-12-01 15:57:57 +01: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
9ddc22e99c Merge remote-tracking branch 'origin/main' into push/main-1130 2026-12-01 00:21:36 -05:00
43489ce3bd The title's watchdog is quieted by default: a stall of its main thread past 30 s is not ended as a crash
The loader's watchdog patches (from leonida-perf, after ZigZagBoi1/ScarlettPort) were opt-in
(`LEONIDA_NO_WATCHDOG` set); they now apply unless `LEONIDA_NO_WATCHDOG=0`. Each is still checked
against the 1.0.2.1 build's hash and the bytes it replaces. The title ends its process by a write to
address 0 when its main thread has not advanced for 30 one-second ticks, which a long load or the
driver compiling can reach on a PC.

Default on as trustno1-coder/VIctory-NVIDIA aee4c45a (through KyleS98/VIctory-Neo b686df1, GPL-3.0)
quiets the title's watchdog by default; those set the watchdog's own quit flag twice a second, the
patches here skip its fault instead.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: the loader's
the_watchdog_is_quieted_unless_told_not_to test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 00:21:36 -05:00
5dd6d444f0 Merge pull request #2589 from MoonEyes/port/nv-vram-target-reserve-settle
Render-target reserve expires once the targets settle (LEONIDA_CARD_ROOM_FOR_TARGETS_SETTLE_MS, off by default)
2026-12-01 05:36:03 +01:00
3a780e4bfc docs: port RTX 4060 Laptop benchmark note 2026-12-01 00:33:07 +00: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
fc48622c2b A launcher for the title's dynamic resolution between 1080 and 1440 lines; the one-frame black floor was the camera
scripts\play-X-1080-1440p.ps1 starts Series X with -Lowest 1080: the title's own dynamic resolution picks the
height between 1080 and 1440 lines (output 1440p), about 13% shorter frames than play-X-1440p.ps1 on an
RTX 4060 Ti (57.0 and 59.6 ms against 66.0 and 67.9).

Findings: the one-frame dark cells of the recorded turns (d220, d226) are a dark wall crossing a cell between two
bright views in a fast turn, not a renderer fault; and frame generation's motion vectors on Series X are in the
units the title gives its own FidelityFX upscale (pixels, scale [1, 1], depth inverted, near 10,000, far 0.15).

AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64), Ryzen 5 7600X: the launcher parses; the findings
come from recorded runs d155, d174, d175, d194, d220 and d226.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 09:49:53 -05:00
22cd4ae248 Merge branch 'main' into d3d12-bar-windows-warning 2026-11-30 13:22:26 +01:00
71cccc04cf Merge ProjectLeonida/mandy main into port/nv-vram-target-reserve-settle
# Conflicts:
#	d3d12/README.md
2026-11-30 07:24:26 +00:00
f389d4a89b README: rows for the pads read the moment they change, the game step's ceiling and the scripts told 59
The three ports of 998fcbcac and 936843f59 in the table of what was fixed, with their switches, tests and the
forks they came from (voidopcode/vilocity 3eda937; kylepelham/El1xr 9372c47f; trustno1-coder/VIctory-NVIDIA PR #65
and El1xr's sim_target.rs).

AI-assisted (Claude).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 00:08:54 -05:00
300a5f4e1f Merge ProjectLeonida/mandy main into port/nv-vram-target-reserve-settle
# Conflicts:
#	d3d12/README.md
2026-11-30 03:22:28 +00:00
1341d658b7 Translator: saturating float-to-int, SCC of shift-adds, the division fix-up's zeros; BC7 rotation; null CBVs; freed 32-bit memory forgotten
Ported from voidopcode/vilocity's batch of 2026-11-30 (each checked against Leonida's own code first):
- v_cvt_{i32,u32,flr_i32,rpi_i32}_f32 clamp their operand before the DXIL conversion, NaN to 0 and past
  the range to its top, as RDNA 2 does (LEONIDA_CVT_SATURATE, on); s_lshl{1..4}_add_u32 set SCC to the
  carry of the 64-bit sum (LEONIDA_LSHL_ADD_SCC, on). ReTerryDavis/ReVIctory a892756, 9c99926, through
  vilocity eaa934e.
- v_div_fixup_f32 resolves 0/y and x/inf before a NaN quotient's infinity (LEONIDA_DIV_FIXUP_ZERO_FIRST,
  on). cool_fox 2b2b00fa, VIctory-NVIDIA feb90ade, through vilocity 83bcc2a. (Its s_min/s_max SCC half
  was in Leonida already.)
- BCPack BC7: control bits 4:3 rotate channels in modes 4 and 5 only. fxceless/victory-fork 06702fe8,
  through vilocity 4365d81. (Its dictionary half was in Leonida since trustno1 f9de61c5.)
- A constant buffer view made with no description is a null view, and a draw's table nulls that slot.
  makmatvey, Marvisak/VIctory#2449, VIctory-NVIDIA 8d2d77c4, through vilocity 12cf6fb.
- XMemFreeDefault's 32-bit path tells the GPU side before it releases the reservation. ZigZagBoi1/
  ScarlettPort 745d6f3, through vilocity ed024d5.

Findings: LEONIDA_WC_PARTS_NO_BACK measured and dropped (0.0 MB ever in such parts, d128);
LEONIDA_TEXTURE_HASH_BACKOFF measured by turns (frame -1.2 ms, submitting thread -2.75 ms, d118).

Tests: float_to_integer_conversions_saturate, scalar_shift_adds_set_scc_to_their_carry,
division_fixup_puts_zeros_before_a_nan_quotient (the whole valu suite, 44 passed, on an RTX 4060 Ti,
driver 616.64, and on WARP); bc7_rotation_is_only_of_modes_4_and_5; a_null_constant_view_replaces_the_
view_there_before (to run with the next build).

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:14:02 -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
b8bd371116 Image stores keep infinities; a loader relocation fix; the texture hash backoff switch; key-to-frame stamps
- Translator: with LEONIDA_NAN_SCRUB=1 the floats an image store writes keep an infinity, as on the console, and
  only NaN becomes 0 there (LEONIDA_NAN_SCRUB_STORE_INF=0: held at 65504 as before). The water's plain transmission
  volumetrics store an infinity for "no surface along this ray"; held at 65504 it was a surface 65 km off (a black
  disc toward the sun). After voidopcode/vilocity 767369a (GPL-3.0). Colours a pixel program writes are held as
  before. Test the_nan_scrub_keeps_the_integer_bits_an_image_store_writes (card and WARP) updated; it passes.
- Loader: dir64_relocations reads whole entries of a block only and no page whose entry's place passes 4 GiB
  (after edsuuu/VI-BR-PORT df2b835d7); test a_malformed_relocation_block_gives_nothing.
- Textures: LEONIDA_TEXTURE_HASH_BACKOFF (off unless asked; by turns under LEONIDA_AB): a guarded texture whose last
  4 looks behind the guard found it as it was takes one of every 16 of its turns (after kylepelham/El1xr d9fc89a4,
  GPL-3.0). A frame hashed 38 to 40 MB of such textures and found 0.0 changes the guard had not seen (run d69).
  Test a_quiet_texture_takes_one_turn_in_n.
- Diagnostics: a recorded frame's present time (frames-times.txt in the capture folder) and a log line when the
  scripted keys change, for the time from a key to the first frame that shows it.
- findings: the busiest faulting stores are the kind LEONIDA_WRITE_SITES rewrites; its notes are keyed by the
  executable's hash.

Four recorded tours with this build (runs d76, d77, d87, d96): no one-frame dark floor, no white flash; the plain
tour on a cleared driver cache (d96) has no one-frame glitch at all.

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 19:21:03 -05:00
20174a9405 Merge ProjectLeonida/mandy main into port/nv-vram-target-reserve-settle
# Conflicts:
#	d3d12/README.md
2026-11-29 23:20:23 +00: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
f61e5e8933 Merge ProjectLeonida/mandy main into port/nv-vram-target-reserve-settle
# Conflicts:
#	d3d12/README.md
2026-11-29 19:18:03 +00: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
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
9e3218f0e9 Merge remote-tracking branch 'origin/main' into next 2026-11-29 11:01:42 -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
c34cec72ee Merge pull request #2593 from Bloh09/fix/ci-main-red-tests 2026-11-29 13:44:04 +01:00
e567c5cbb9 Merge ProjectLeonida/mandy main into port/nv-vram-target-reserve-settle
# Conflicts:
#	d3d12/README.md
2026-11-29 12:21:09 +00:00
8fb9748788 Picked writes on; partly mapped and painted textures read again sooner; watched copies noted at a list's close
- LEONIDA_PICKED_WRITES now 1 by default (0 off): buffers shaders write
  through views they pick from the heap are declared, so no refresh puts
  title memory's older bytes over them (aki-gta6/aki-runtime 975f161 turned
  its own on for skinned characters' torn and flashing triangles). In turns
  of 4 s standing it cost nothing to see (frame median -0.02 +-0.75 ms, card
  +0.06 +-0.45, submitting thread +0.08 +-0.47) and found 60 of 575 buffers
  so written; a recorded tour of 598 frames had no fault. LEONIDA_AB can
  turn it now.
- LEONIDA_PARTIAL_WRITTEN (on): a partly mapped texture is read again the
  frame after the guards see a write to it, not up to 30 frames later (blocks
  of noise on a close-up's shirt there). Moving, in turns of 4 s: frame
  median -0.45 +-1.58 ms, card -0.47 +-0.44. After trustno1-coder/
  VIctory-NVIDIA dbba4ad7 (101Leafy).
- LEONIDA_PAINTED_EVERY (8 frames): a texture picked by index that a look
  found changed with nothing told of it is looked at on that beat for good,
  and at its memory under any slot. After trustno1-coder/VIctory-NVIDIA
  cbf5d68d and 76db3ec3 (Chris James).
- Whether a copy is asked about ahead is noted when its list closes
  (Fronts::watched) instead of asked of every copy at every submission.
  After ReZOnGithub/VIctory-lap 2a31a14.

AI-assisted (Claude). Tested on an RTX 4060 Ti, driver 616.64: unit tests
(partial_due, front_tests) and the A/Bs above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 06:26:31 -05:00
b589e0fe0b BC7 textures from DirectStorage decoded as Microsoft's decoder does: 73 % of their blocks were wrong
The BC7 dictionary's entries are read with all 32 index slots in order: in
every entry but the first, the word after the index widths (the widths again)
is pixel 0's index. The decoder skipped that word, so every stored index sat
one pixel early, and a block predicted from a wrong entry was wrong, as was
every block predicted from it in turn.

Each reading passed its own unit test, so it was settled against Microsoft's
decoder (the GDK's BCPack.dll, used on this PC only, never in the repository):
the title's own streams, saved as DirectStorage hands them over with the new
LEONIDA_BCPACK_DUMP=<folder> (local only), were unpacked by the DLL and by
this decoder. Of 381 BC7 streams (2,866,176 blocks), 2,101,646 blocks were
unlike the DLL's before and none now. BC1 (400 streams), BC3, BC5 (120) and
BC6 were alike already. (Blocks packed by the DLL's own compressor never use
the dictionary, which only blocks before a stream's 255th can reach.)

After trustno1-coder/VIctory-NVIDIA f9de61c5 (GPL-3.0).

AI-assisted (Claude). Tested on an RTX 4060 Ti, driver 616.64: leonida-formats
unit tests, and the comparison above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 05:46:33 -05:00
7b907de523 Submitting-thread ports from VIctory-lap, and lists' scratch in the card's memory (-0.9 to -1.7 ms of card a frame)
From ReZOnGithub/VIctory-lap (GPL-3.0-or-later), each with its switch, on as
there, and its check mode where it has one:
- LEONIDA_LIST_FRONTS (0ced255): what a list's steps refresh is found once,
  when the list closes, instead of twice per submission on the submitting
  thread. Standing: that thread worked -0.81 +-0.27 ms a frame.
- LEONIDA_FRONTS_LEAN (91ca3fd, with 9ea4cac's single-list join): the fronts
  joined without a table of their copies, let go on the reaper. -0.68 +-0.27.
  join_keys now folds a refresh of no bytes as front_spans does; the test
  covers such refreshes.
- LEONIDA_SEND_TAKE_BESIDE (003e55a): a submission's own bytes copied on the
  kept threads while its list is recorded, waited for before it closes.
  -0.54 +-0.33. (shadow::wide split into wide_queue and wide_help.)
- LEONIDA_HURRY (ac97e48): what the submitting thread stands at is translated
  first, above normal. It never fired here; on for scenes where it does.
Check modes, moving: 78,426 fronts and 21,883 takes (49.6 GB) compared, 0
that differed.

LEONIDA_SCRATCH_CARD: lists' scratch memory (tables' constant buffers made
afresh, root constant buffers, the batch pass's job table) in the card's own
memory the CPU maps (GPU upload heap) instead of upload memory in the PC's,
whose every first read crossed the bus. Card busy -1.70 +-0.41 ms a frame
moving, -0.92 +-0.44 standing (frame mean -1.47 +-0.65). On where the card's
budget is 9 GiB or more.

A/B phase lines now give the card's busy time and the submitting thread's
work a frame; LEONIDA_PICKED_WRITES can be turned by LEONIDA_AB.

AI-assisted (Claude). Tested on an RTX 4060 Ti 16 GB, driver 616.64, Ryzen 5
7600X: named unit tests, both check modes in play, A/Bs moving and standing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 05:18:12 -05:00
431e33ec8a Merge ProjectLeonida/mandy main into port/nv-vram-target-reserve-settle
# Conflicts:
#	d3d12/README.md
2026-11-29 09:48:48 +00:00
bb6c88b672 Frame generation tags each frame's own G-buffer pass; where the frame goes, measured
Frame generation (G-buffer path): the title also fills a 960x960 pass that looks like
its G-buffer (a probe's), and the pass recorded last was tagged, recorded at once on the
thin threads before the present of the frame before was served: four switches in four
seconds standing, each a generated frame from another pass's depth and motion vectors.
Now each host list carries the pass it bound to its submission (HostList::mark_gbuffer,
taken in Host::submit), and a present tags the largest one submitted before it; a frame
whose only such pass is under half the last one's area keeps the last. Standing with 2x
(2026-11-29): no switch in the whole run, the probe pass passed over twice, the picture
without the interface tagged on 300 of 300 presents.

XMemVirtualAlloc logs the protections of placeholder parts too (it returned before): the
title's 32-bit graphics heap is five parts, GPU read-only, write-combined executable,
garlic and cached GPU read-write.

Diagnostics (no change unless asked for):
- LEONIDA_INDIRECT_RUNS=1 counts the title's indirect executions by what comes between
  them: 13,000 a frame, all of one record with no count buffer, between two of one
  pipeline 1.7 tables, 0.9 views and 0.9 constants set.
- LEONIDA_AB switches LEONIDA_EXP_EMPTY_INDIRECT (an empty execution after each mesh one:
  +0.67 +-0.77 ms, so merging executions would save nothing), LEONIDA_EXP_MESH_SKIP
  (every mesh draw left out: -7.7 ms median of 38 pairs, the frame still about 50 ms,
  held by the submitting thread) and LEONIDA_EXP_MESH_ONE_PIXEL (-0.3 +-0.3 ms).

docs/findings.md: where the frame goes at the launcher's default (card 56 ms, submit
thread 55-65 ms, 530-600 ms of CPU a frame), what a copy-free native runtime would
change (D33T0X/Native-Runtime compared: 0.4-0.83 s world frames in its own notes),
copy-back elision (446 ms a frame of list steps here, nothing elided) and card-side
windows (57.0 -> 66.2 ms) measured and not taken, and the defrag program still refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 02:47:58 -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
3fbfcc6f8d Merge upstream/main into fix/ci-main-red-tests
Resolved conflicts in bench_translate.py, export_old_pr_manifest.py,
pc_prompt_glyphs.py and xbox_prompt_glyphs.py by taking main's
errors=replace guards (#2590). Dropped CI-STDOUT-GUARD-NEW-TOOLS.
2026-11-28 19:40:09 -08:00
9c2e37fa84 Frame generation: the picture without the interface (kBufferTypeHUDLessColor), copied in front of the title's interface composite
On Series X the title presents one plane with its interface drawn into it, so frame generation had only the
picture with the interface and dragged it along in the generated frames. Before the title's interface composite
(one triangle, one instance of vertex 0602c2384acbb3b2 and pixel a78d088fa55aa495) into a texture it presents, the
plane is copied into one of two textures of ours in the draw's list (one copy a list, the list marked); when that
list is submitted the copy is noted, and the present after it tags the first copy of the presented texture as
kBufferTypeHUDLessColor (eValidUntilPresent, a copy's destination, the plane's size). A present with tags and no
copy removes an older one with a null tag. LEONIDA_FG_HUDLESS (on; 0 off); while frame generation is off (not
started, or the amount at 1) draws ask one atomic and nothing is copied or made. Log lines: "the picture without
the interface" (first copy, first tag, the textures made, and every 300 presents copies, tagged, missing,
overwritten, composites, others).

Ported from trustno1-coder/VIctory-NVIDIA 1d0fa87 (GPL-3.0-or-later): its streamline.rs INTERFACE_COMPOSITE,
before_target_draw, hudless_texture, hudless_submitted, hudless_for and draw.rs before_shown_target. Unlike it, a
copy whose texture of ours a later copy went into before its present is not tagged.

Tested: the new fg::hudless_tests (composite match, the copies' bookkeeping, presented textures, the switch) and
cargo build --profile diag -p leonida --features diagnostics,dlss,mimalloc. Not run in the title yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 22:26:50 -05:00
7fc9f95869 READMEs: the sample mask (OMSetSampleMaskX) followed since 2026-11-28; whether it ends the plant flicker is not confirmed yet
Measured with the merged build at the waterside save: masked pipelines made and used, 28 to 30 refused pipelines as
without it, none for memory, no device removal, nothing broken in the picture (two starts of the branch, one of the
merge).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 21:22:07 -05:00
bf574cf31a docs: links and the clone line follow the README rewrite (CI-README-REWRITE-LINKS) 2026-11-28 17:31:06 -08: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