Commit Graph

746 Commits

Author SHA1 Message Date
43af833d19 Merge remote-tracking branch 'origin/main' into carry/hwrt-2972
# Conflicts:
#	d3d12/docs/switches.md
2026-12-02 07:40:14 +01:00
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
f37c4a87d6 Merge pull request #2756 from IgorAntunes66/pr/seriesx-dlss-black-world
d3d12: leave FidelityFX maximum-size vtable patch off by default (D3D12-SERIESX-FSR-MAX-SCALED)
2026-12-02 05:52:36 +00:00
5b005f8bb9 d3d12/docs/switches.md: list LEONIDA_FSR_MAX_SCALED
The merge queue's tests found the page out of date once this branch met main.
Regenerated with tools/d3d12_switches.py after merging main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 06:31:19 +01:00
87ef956700 Merge remote-tracking branch 'origin/main' into pr2756fix 2026-12-02 06:30:45 +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
8422def759 Merge pull request #3032 from enlight3d/cold-start-wait-clock
d3d12: time each begin and end of a pipeline wait under its count's lock (D3D12-COLD-START-SKIPS follow-up)
2026-12-02 03:16:02 +00:00
4b735e5556 d3d12: time each begin and end of a pipeline wait under its count's lock (D3D12-COLD-START-SKIPS follow-up)
After a wait, wait_in read the clock once, before taking the lock of the
frame's count and that of the pipeline's own count, and told both ends
that time. A thread stopped between the read and the lock had its end
told after events with later times, and Waited took the order it was
told as the order of the times (review of pull request 3000):

- andrew-ai: A waits 0-20 ms, B 10-85 ms; with A's end told after B's,
  a wait at 86 ms was left 80 ms of 100 instead of 15, and a pipeline
  both waited for was charged 20 ms instead of 85;
- merzleckeier: A waits 0-10 ms, B 40-50; with A's end, read at 10,
  told after B began, B was left 60 ms instead of 90, the frame had 50
  left instead of 80, and the pipeline was charged 50 instead of 20.

Each begin and end is now timed under the lock of the count it goes
into, through a seam (trait Waiting: the clock and the wait; Real in
the title), so a count is told them in the order of their times. Waited
keeps the latest time it has seen and takes an older one as that: an end
gives back nothing, a begin counts nothing twice. The frame's end is
timed right after the pipeline's, before the log lines.

A wait still counts until its end is timed: a thread stopped after its
wait and before it reads the time counts as waiting meanwhile (test
a_wait_counts_until_its_end_is_timed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 03:31:18 +01: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
5922f9fc5b Merge pull request #2663 from zmasi/fix/d3d12-depth-bounds-test-flake
d3d12-gpu: keep depth stage active on WARP for bounds-only pipelines (D3D12-DEPTH-BOUNDS-TEST-FLAKE)
2026-12-02 00:48:56 +00:00
4b67b07045 Merge pull request #2931 from Mykolas009/d3d12/f1-dlss-rebuild
d3d12: the DLSS build is asked for once NVIDIA's SDK is here, whatever the switches (D3D12-F1-DLSS-REBUILD)
2026-12-02 00:48:23 +00:00
97ed89073a Merge pull request #2894 from lixonik/fix/glyphs-connected-xbox-pad
d3d12-hle: avoid PlayStation live glyphs when Xbox pad is connected
2026-12-02 00:48:12 +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
923a4e98f2 d3d12 hwrt: an AABB geometry's range ends with its last box
The shadow lookup and refresh asked for count * max(stride, 24) bytes, past the last box
(two boxes at 0 and 64: 128 bytes where 88 are used). aabb_span takes (count - 1) * stride + 24
with checked arithmetic; a test covers the last box ending at a buffer's end and overflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 01:32:06 +01:00
5a8e1db178 Merge remote-tracking branch 'origin/main' into d3d12-hardware-ray-tracing
# Conflicts:
#	d3d12/crates/leonida-gpu/src/descriptor/host.rs
#	d3d12/docs/switches.md
2026-12-02 01:20:51 +01:00
ce08fea0af Merge pull request #3000 from enlight3d/cold-start-skips
d3d12: the threads of a frame share its pipeline wait budget and none is left with nothing (D3D12-COLD-START-SKIPS)
2026-12-02 00:03:59 +00:00
3a38a050d8 d3d12 hwrt: review addendum (one capability gate, AABB strides, TLAS layout, copy modes)
- One gate for both halves: supported() also asks for shader model 6.6, and the translator is
  told inline ray tracing runs (set_host_inline_rt) only once the DXR manager is made.
- AABB geometries take stride 0 (packed 24-byte boxes) and multiples of 8 of 24 or more, as
  DXR does; others are refused.
- A TLAS of instances by pointer (ARRAY_OF_POINTERS) is not built: the remap reads 64-byte
  instances in a row.
- Structure copies other than clone and compact are not done (said once).
- A TLAS clone points the heap slots that view the destination at the shared structure.
- The points not fixed here are listed in fork-ray-tracing.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 00:40:30 +01:00
2705632c56 Merge pull request #2852 from Kal0s-design/fix/page-writes-per-heap
d3d12-gpu: physical-page writes reach every view heap's texture pass (D3D12-GPU-PAGE-WRITES-PER-HEAP)
2026-12-01 23:12:32 +00:00
d6baf3528d Merge pull request #2857 from djrolfes/djrolfes/gpu-pool-small-unlock-grow
gpu/pool/small: release pool mutex during CreateHeap block growth (D3D12-POOL-SMALL-GROW-UNLOCKED)
2026-12-01 23:12:28 +00:00
9cedb84c93 d3d12 hwrt: review fixes (transform opcodes, no hardware path without DXR 1.1, cleanup)
- rq_op: 187 is CandidateWorldToObject3x4 and 188 CommittedObjectToWorld3x4 (they were
  swapped; checked against dxc 10.0.26100). the_ray_query_opcodes_are_dxils pins all 35.
- Hardware ray tracing runs only where it can: hwrt::active() (asked for, and a DXR 1.1
  manager made) gates the HLE module, the left-out passes, the copy-back rule and the counters;
  the translator lifts loops only when the host says it runs inline ray tracing
  (set_host_inline_rt, in host_settings and so in the shader cache's key). Elsewhere the title
  keeps its own XboxBvhBuilder.dll and the software walk.
- No env write: builder_allowed() is LEONIDA_BVH_BUILDER=1 and not hwrt::active().
- dxr.rs removed (nothing bound its wrappers); TLAS views are kept out of the list views only
  with the path on; the off16 diagnostics and the xmem log lines are gone.
- as_sizes split out of alloc_or_reuse_as, with a test; the known gaps are in
  fork-ray-tracing.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 00:01:01 +01:00
913b88b905 Merge pull request #2884 from lixonik/fix/timeline-stall-test-parallel-flake
d3d12-gpu: stabilize global stall routing test under parallel diagnostics runs
2026-12-01 22:35:46 +00:00
f4c312a1b6 Merge pull request #2788 from bobcatchris/perf/d3d12-bdd-unique-compact
D3D12-SHADER-BDD-UNIQUE-COMPACT: open-addressing unique table for the BDD nodes (-3 % wall, DXIL identical)
2026-12-01 22:35:37 +00:00
b511bfec36 Merge pull request #2882 from lixonik/fix/shader-build-runtime-manifest-dir
d3d12-shader: read CARGO_MANIFEST_DIR at runtime in build.rs
2026-12-01 22:35:34 +00:00
9196ad1146 Merge pull request #2858 from Kal0s-design/fix/console-insn-checked-ranges
d3d12-loader: console_insn range checks don't overflow at the top of memory (D3D12-LOADER-CONSOLE-INSN-CHECKED-RANGES)
2026-12-01 22:35:30 +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
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
7c69bc8b19 d3d12: the threads of a frame share its pipeline wait budget and none is left with nothing (D3D12-COLD-START-SKIPS)
The shared frame budget was a reservation: the first recording thread to
wait in a frame took all that was left of it, and every other thread of
that frame (and any thread still on an older frame) got nothing, so its
draw went out without a wait and was dropped as not made. On first starts
(no pipeline book) 400 to 3,600 draws, dispatches and indirect executions
a frame were dropped at the arrival in the world, and the character's
head, drawn by a pass the title runs once, stayed missing for the run.

- The frame's waits are counted once over the threads that wait at the
  same time: what passed while at least one thread waited. A thread that
  begins to wait while others do is left what is left at that count, so
  waits that overlap still cost the frame its budget once; the time a
  thread records between two waits is not counted; a thread on an older
  frame joins the current frame's waits and opens no budget of its own
  (#2601). On by default; LEONIDA_PIPELINE_WAIT_DEADLINE=0 reserves the
  frame's budget as before (no effect with LEONIDA_PIPELINE_WAIT_SHARED=0);
  LEONIDA_AB can turn it while the title runs.
- A pipeline's own budget (LEONIDA_PIPELINE_WAIT_ONCE) is charged the same
  way, the real time once, not the threads' times added up, whatever the
  sharing of the frame's budget (LEONIDA_PIPELINE_WAIT_ONCE=0 turns that
  budget off).
- The queue a wait moves its pipeline forward in and the budget a
  pipeline's waits count against are passed in, so that tests cover them;
  one line tells the rules in use at the first wait.

AI-assisted: Claude Code (Claude Opus 5.5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 23:10:50 +01: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
c9c5cc589f d3d12-hle: handle mirrored Sony pads in connected_pad, test Host::observe, and update docs 2026-12-02 00:01:18 +03:00
9867afb74e Merge remote-tracking branch 'origin/main' into HEAD 2026-12-01 23:55:12 +03:00
1fff691295 Merge pull request #2873 from kirigayakazima/fix/d3d12-clippy-workspace-clean
d3d12: fix remaining workspace clippy warnings
2026-12-01 21:54:04 +01:00
9b3b78b5d8 Merge pull request #2824 from Kal0s-design/fix/xasync-composite-terminate
d3d12-hle: terminating a composite task queue cancels only its own tasks (D3D12-HLE-XTASKQUEUE-COMPOSITE-TERMINATE)
2026-12-01 21:53:51 +01:00
bc332322eb Merge pull request #2862 from djrolfes/djrolfes/shader-sampler-handle-cache
shader/emit: cache immediate sampler handles in entry block (D3D12-SHADER-SAMPLER-HANDLE-CACHE)
2026-12-01 21:53:38 +01:00
1e3e316c5e Merge pull request #2861 from djrolfes/djrolfes/shader-bounded-extensions
shader/opt: extend Module::bounded() to zero-identity Add/Sub and budgeted acyclic Phi (D3D12-SHADER-BOUNDED-EXTENSIONS)
2026-12-01 21:34:22 +01:00
66c79286f6 Merge pull request #2860 from djrolfes/djrolfes/shader-wide-builder-bounds
shader/lower: preserve builder_bounds root header size guard when WIDE loads are enabled (D3D12-SHADER-WIDE-BUILDER-BOUNDS)
2026-12-01 21:22:22 +01: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
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
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
7ab2e6d3f8 Merge remote-tracking branch 'origin/main' into fix/series-s-f1-dlss 2026-12-01 13:47:17 -05:00
0b1f6b5887 d3d12: preserve explicit render scale on F1 restart 2026-12-01 13:47:17 -05:00
60f7dcd904 Merge pull request #2826 from enlight3d/reaper-bounded-queue
D3D12-REAPER-BOUNDED-QUEUE: bound the reaper's line (LEONIDA_REAPER_LIMIT)
2026-12-01 19:37:13 +01:00
ebb9ecb983 d3d12: honor saved DLSS at stock Series S resolution 2026-12-01 13:30:30 -05:00
9f0d351cc8 Merge pull request #2880 from alpfilho/d3d12/menu-last-choice-wins
d3d12: the last choice wins between the command line and the F1 menu (D3D12-MENU-LAST-CHOICE-WINS)
2026-12-01 18:38:35 +01:00
597e2d9226 Merge remote-tracking branch 'origin/main' into reaper-bounded-queue
d3d12/docs/switches.md regenerated with tools/d3d12_switches.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 18:30:24 +01: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
3dd1bf4204 Merge pull request #2904 from ProjectLeonida/fix/ambient-green-blue-probes
gpu: drop neon green and blue garbage from the probe resolve on request
2026-12-01 12:14:36 -05:00
7be7711c8e Merge remote-tracking branch 'origin/main' into reaper-bounded-queue
d3d12/docs/switches.md regenerated with tools/d3d12_switches.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 18:12:31 +01:00
3d8ea1031b Merge pull request #2874 from kirigayakazima/fix/d3d12-core-empty-env-fallback
d3d12-core: ignore empty user-dir and log env vars
2026-12-01 18:12:30 +01:00