Skip to content

d3d12 play-nvidia: frame generation with ray tracing, except Series X under 20 GB (D3D12-FG-WITH-RT) - #3230

Open
OreoFR wants to merge 6 commits into
ProjectLeonida:mainfrom
OreoFR:feat/fg-with-rt
Open

OreoFR wants to merge 6 commits into
ProjectLeonida:mainfrom
OreoFR:feat/fg-with-rt

Conversation

@OreoFR

@OreoFR OreoFR commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Item: D3D12-FG-WITH-RT (claimed in the coordination issue, #2570).

d3d12/scripts/play-nvidia.ps1 left frame generation off whenever ray tracing was on: DLSS FG, FSR 3 FG and the automatic 2x on RTX 40/50, with -RayTracing or -HardwareRT. The reason given was "0.1 frames a second together", a number from the software path that nobody had measured since. This PR allows frame generation with ray tracing, except on the Series X profile on cards with under 20 GB of video memory. There it stays off, with a message saying why.

What changes

  • Frame generation (DLSS, FSR 3, and the automatic 2x) is allowed with software or hardware ray tracing.
  • On the Series X profile with under 20 GB of VRAM ($vram, read as before from the driver's registry key), frame generation is left off. The message says it runs out of video memory there, and that -More @{LEONIDA_FG_WITH_RT='1'} turns it on anyway. Unknown VRAM (0) does not block.
  • When frame generation is kept with ray tracing, the script sets LEONIDA_FG_WITH_RT=1, so the runtime's own guard (fg.rs) lets it start. No Rust change. An explicit LEONIDA_FG_WITH_RT='0' in -More keeps it off.
  • The header comments, README.md and d3d12/docs/fork-ray-tracing.md now state the rule.

Measured

RTX 4070 Laptop 8 GB, driver 621.40, Core Ultra 7 155H. One run each, walking in the world.

Profile Ray tracing Upscaling / FG Rendered / shown fps Notes
Series S hardware DLSS, FG 2x (this branch, no forced variable, 300 s, main 8a9235d) 22-24 / 45-48 at the end frames generated in every world sample, no out-of-VRAM, no device removed
Series S hardware DLSS, FG 2x (LEONIDA_FG_WITH_RT=1 on main 45dc41f, 240 s) 21 / 43 frames generated
Series S software DLSS, FG 2x (forced, 240 s) 10-11 / 21 frames generated (1 fps the first 2 min while compiling)
Series X hardware DLSS quality, FG 2x (forced, 300 s) 5 no frame generated, Streamline eWarnOutOfVRAM: the case this PR keeps off
Series X hardware DLSS quality, no FG (240 s) 12-14 —

A player's 16 GB card (Series X, hardware RT, DLSS quality, FG 2x forced, 2-minute log): no out-of-VRAM, frames generated part of the time.

Tested

  • -DryRun through scripts\play-d3d12.ps1 on this PC:

    • Series S with hardware or software RT and -FrameGen 2: FG kept and LEONIDA_FG_WITH_RT=1 set.
    • Series X + hardware RT + -FrameGen 2 on 8 GB: FG removed and the message printed. With -More @{LEONIDA_FG_WITH_RT='1'}: kept. With '0' on Series S: off.
    • Starts without ray tracing, the default included: identical to main.
    • The threshold (now 20 GB) is covered by the dry-run test below.
  • tests/test_win_launchers.py, test_play_nvidia_menu_choice.py, test_docs_issue_template.py and test_docs_links.py pass; check_no_game_data.py passes on the three files.

  • The ≥300 s in-game run on this head merged with main is the first row of the table.

  • New tests/test_win_launchers.py::test_nvidia_frame_generation_with_ray_tracing runs the rule as dry runs with the card's memory stubbed in the registry:

    • Series S on 8 GB: kept, with LEONIDA_FG_WITH_RT=1.
    • Series X on 8 GB: off.
    • Series X on 16 GB: off. Series X on 24 GB: kept.
    • Series X on 8 GB with -More LEONIDA_FG_WITH_RT=1: kept.
    • LEONIDA_FG_WITH_RT=0: off.
    • Unknown memory: kept.
    • It fails on main's script and with the old 12 GB threshold (its 16 GB Series X case).
  • Larger cards: a 3090 (24 GB) passed hardware RT + DLSS frame generation on Series X and S (posted on launcher: full overhaul of the Python launcher (mockup look, sharp text, no white window, 5 languages, diagnostics, Python install) #3182). A player's 16 GB card generated frames on Series X.

  • MoonEyes' batch C (4060, Series S, FG 2x, 330 s, no RT) passed with this head.

Why 20 GB on Series X (was 12)

  • The player's RTX 5080 (16 GB), Series X, hardware RT, DLSS quality, FG 2x with LEONIDA_FG_WITH_RT=1, 7 minutes:
    • frames are generated and the game speed is normal (confirmed by the player);
    • about 5 minutes in, the process passes the card's budget (13.0 GB of 12.95, up to 14.2);
    • Streamline reports eWarnOutOfVRAM, and frames over 100 ms go from 8-15 to 46-53 a minute.
  • The 3090 (24 GB) reached 18.6 GB on the same profile.
  • 20 GB is just above that. 16 GB cards keep FG + RT on Series S, and get it on Series X with LEONIDA_FG_WITH_RT=1.
  • Two cards, one run each.

Ready, and why it was a draft

It was drafted after a player saw the game run too fast with frame generation and hardware RT. That came from the title's fixed 1/30 s step on builds before #3204. #3204 (merged) makes the game and camera clocks follow the measured frame time, so frame rate no longer changes game speed.

The same player's stutter on Series X was memory: 32 GB of RAM with a 26 GB page file, below what the Series X profile commits (~59 GB, d3d12/docs/windows-memory.md). It is not frame generation, and this PR does not block it. #3182's launcher warns about it instead.

main is merged in. Not done: AMD.

The launcher side is in #3182: it greys frame generation with hardware RT unless the Advanced field has LEONIDA_FG_WITH_RT=1.

AI-assisted (oreofr-agent, Claude).

🤖 Generated with Claude Code

… under 12 GB (D3D12-FG-WITH-RT)

Frame generation (DLSS's, FSR 3's and the automatic 2x on RTX 40/50) was left off whenever ray tracing was on
("0.1 frames a second", a measure of the software walk from before this renderer). It now runs with ray tracing,
software or hardware, except on the Series X profile with under 12 GB of video memory, where it is left off with
a message; unknown video memory does not block. When kept, LEONIDA_FG_WITH_RT=1 is set so the runtime's own guard
(fg.rs) starts it; -More LEONIDA_FG_WITH_RT='1' forces it everywhere, '0' keeps it off.

Measured on an RTX 4070 Laptop 8 GB, main 45dc41f, 2026-12-02, 240 s walks, one run each:
- Series S, -HardwareRT -FrameGen 2: 21 rendered / 43 shown fps once warm, frames generated, no device lost.
- Series S, -RayTracing -FrameGen 2: 10-11 rendered / 21 shown.
- Series X, -HardwareRT -Dlss quality -FrameGen 2: 5 fps, no generated frame, Streamline eWarnOutOfVRAM.
- A player's 16 GB card, Series X, same switches: no out-of-memory warning, frames generated part of the time.

DryRun checked (settings against origin/main): runs without ray tracing are identical; Series S with RT and
-FrameGen 2 gains LEONIDA_FRAME_GEN=2 and LEONIDA_FG_WITH_RT=1; Series X with RT on this 8 GB card leaves it off
with the message; video memory forced to 16, 12 and 0 GB keeps it, 11 GB leaves it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MoonEyes

MoonEyes commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Review (read of the diff on head eafa1af14, no run from me yet).

Logic: looks right.

  • $vram (line 387) and $console (line 404, then the F1 menu's LEONIDA_MENU_CONSOLE at line 633) are both set before the new block at line 691, so the Series X / under-12 GB test sees the menu's console choice.
  • The runtime guard in fg.rs (line 50) still needs LEONIDA_FG_WITH_RT=1; the else branch sets it, so frame generation really starts when the script allows it. LEONIDA_FG_WITH_RT=0 and =1 from -More both behave as the comment says.
  • FSR 3 frame generation now follows the same rule, and also with -HardwareRT (before, its own check only looked at LEONIDA_BVH_BUILDER). Good.
  • The automatic 2x on RTX 40/50 no longer skips -RayTracing; it still needs -Resolution/-Lowest, as before.

Points to look at

  1. The 12 GB threshold sits between one 8 GB card that ran out (n=1) and one 16 GB card with "frames generated part of the time". 10 to 12 GB cards are untested, and "part of the time" on 16 GB is not "works". Please say in the comment that 12 GB is a guess between those two points.
  2. fg.rs line 52 still warns "together they run at 0.1 frames a second". With the script now setting LEONIDA_FG_WITH_RT=1, that warning only shows when someone runs the runtime without the script, but the reason it gives is out of date (it was the software walk before this renderer). Worth a one-line follow-up, not a blocker here.
  3. All the measurements in the comment are on main 45dc41f95 with -More @{LEONIDA_FG_WITH_RT='1'}, not on this head through the script's own default. Since this is under d3d12/, it needs an in-game run on this head before merge: Series S with -HardwareRT -FrameGen 2 and no -More, 300 s in the world, 0 device lost, plus a check that the log says frames are generated.

AI-assisted (Claude Code), model: Claude Opus 5.5.

…ectLeonida#3230)

The comment now gives the RTX 3090 24 GB run (frames generated on both profiles, at most 14.4 GB used on
Series X), says 12 GB sits between the 8 GB card that ran out and the 16 GB one that did not, with 10-12 GB
cards untested, and quotes this head's own 300 s run without -More. Comment only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OreoFR

OreoFR commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. On 97eefdee4:

  1. 12 GB: the script's comment now says it is a guess between the 8 GB card that ran out and the 16 GB card that did not, with 10-12 GB cards untested. It also gives the RTX 3090 24 GB run from launcher: full overhaul of the Python launcher (mockup look, sharp text, no white window, 5 languages, diagnostics, Python install) #3182 (frames generated from about 10 s into the world on both profiles, at most 14.4 GB used on Series X) and notes that the runtime sizes part of its memory by the card's budget.
  2. fg.rs warning: left for a follow-up, as you suggest (no Rust change in this PR).
  3. Run on this head: done before opening, and it is the first row of the table in the description. eafa1af14 merged with main 8a9235d02, RTX 4070 Laptop 8 GB, Series S, -HardwareRT -FrameGen 2, no -More, 300 s walking in the world.
    • The script set LEONIDA_FG_WITH_RT=1 by itself.
    • Frames were generated (per=2) in every world sample.
    • 22-24 rendered / 45-48 shown at the end; no eWarnOutOfVRAM, no device lost. Log play-1202-221142, not posted.

Not covered yet: a player on an RTX 5080 (Series X, FG 2x, frame limit auto) reports the game running too fast with frame generation and hardware RT together, all the time; not with frame generation alone. Not reproduced here yet. Until that is understood, this PR should not merge, since it would turn the automatic 2x on with hardware RT for RTX 40/50 owners on Series X with 12 GB or more.

AI-assisted (oreofr-agent, Claude).

@OreoFR
OreoFR marked this pull request as draft December 2, 2026 21:31
OreoFR added a commit to OreoFR/leonida that referenced this pull request Dec 2, 2026
… is on

Reverts e9b947b (greyed only on Series X under 12 GB). A player (RTX 5080, Series X) reports the game
running too fast with frame generation and hardware RT together, never with frame generation alone, so
ProjectLeonida#3230 (which lifts the script's lock) is back to draft and the launcher follows main's script: with
hardware RT, frame generation is off, its controls greyed with the note 'Off with ray tracing for now.'

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fiestorra

Copy link
Copy Markdown
Contributor

VERIFY-3230 — Windows nativo: el script parsea y la suite de lanzadores pasa; la regla nueva no tiene test

Head (this PR)
Merge base b41763227 = current main
Merged onto main — merge-tree clean, git merge --no-ff clean

Ran

PowerShell parse of d3d12/scripts/play-nvidia.ps1: 0 errors
python -I tests/test_win_launchers.py:            Ran 9 tests — OK

No test covers the rule this PR adds. The tests in the branch (test_native_status_reaches_both_launchers…, test_spawn_failure_returns_nonzero, …) come from the stacked #3210/#3220 work; none of them exercises "frame generation is kept with ray tracing except on the Series X profile under 12 GB". So for this PR's own change this is red not constructible — and it is testable with the harness those other PRs use (a synthetic -RayTracing/-FrameGen invocation and an assertion on LEONIDA_FG_WITH_RT and the printed note).

The measured table in the body is the kind I want to see: it includes the case that fails (Series X, 8 GB, eWarnOutOfVRAM, no frame generated) next to the ones that work, and it says the 12 GB threshold is a guess between an 8 GB card that ran out and a 16 GB one that did not. That honesty is why I am not calling the change unsupported — the evidence is a run, not a hunch, with the gap named.

What I would still ask: a 10 TB… sorry, a 10–12 GB card is exactly the band the guess covers and the body says is untested; if a user in that band hits the same eWarnOutOfVRAM, the exception does not catch them and the symptom is the one this PR is trying to avoid (FG silently doing nothing). A LEONIDA_FG_WITH_RT note in the message, or checking the runtime's own out-of-VRAM warning, would make the failure visible rather than silent.

Stacked, again

The branch carries #3204's frame.rs, #3210's launcher exit codes and the HTTP/test changes of #3210/#3224/#3227/#3228 — main has none of it. Seventh stacked branch tonight.

What I could not test

  • The claim itself: that FG + ray tracing is usable at a given resolution. That needs the title and an RT-capable card; here there is a 4090 but no run.
  • The VRAM threshold: this card has 24 GB, so the Series X exception never fires here.

Written with an AI assistant.

@OreoFR

OreoFR commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the run.

  • Not stacked. The branch is main at 8a9235d02 (newer than b41763227) plus two commits that touch only d3d12/scripts/play-nvidia.ps1, README.md and d3d12/docs/fork-ray-tracing.md (git diff --stat origin/main...HEAD). d3d12: uncap rendering and use measured simulation steps (D3D12-UNCAPPED-SIMULATION) #3204, Preserve Windows D3D12 launch failure status #3210 and the HTTP/test changes you saw were already on main at that base; they are not in this diff.
  • A test for the rule: agreed. I will add a dry-run test of the rule in tests/test_win_launchers.py before this leaves draft. It will cover Series S with RT and -FrameGen 2 (LEONIDA_FG_WITH_RT=1 set), Series X under 12 GB (frame generation off and the note printed), and LEONIDA_FG_WITH_RT='1'/'0'.
  • 10-12 GB, silent failure: a fair point, noted for the same pass. Either say it in the message or surface Streamline's out-of-VRAM warning.

This PR is a draft for now: a player on an RTX 5080 reports the game running too fast with frame generation and hardware RT together. That is being investigated first.

AI-assisted (oreofr-agent, Claude).

@merzleckeier merzleckeier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 97eefdee. The new Series X guard at play-nvidia.ps1:697 uses the largest adapter’s VRAM (:385–392). The runtime uses LEONIDA_ADAPTER to select the adapter that will actually run (host.rs:1602–1634). In a sandboxed PowerShell dry run with Series X, -HardwareRT -FrameGen 2 and -Adapter "RTX 4070 Laptop", an 8 GiB registry fixture left frame generation off. Adding a separate 16 GiB registry entry made the exact same launch emit LEONIDA_FRAME_GEN=2 and LEONIDA_FG_WITH_RT=1, while LEONIDA_ADAPTER still named the 8 GiB card. An explicit LEONIDA_FG_WITH_RT=0 still worked.

The new guard should use the selected adapter’s budget, or use a conservative default if the selected adapter’s memory cannot be determined. This was a dry run with synthetic inputs, so it verifies the launcher policy only.

@MoonEyes

MoonEyes commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

RUN (in game, batch of five pull requests), each head merged with git merge --no-ff onto main ef35d683e, in one build: #3176 4c31594b5, #2657 c16b0424e, #2807 e2572082c, #3230 97eefdee4, #3247 3e5887f65. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, -PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (47 samples) median 15.8, mean 16.2
Rendered fps, last 120 s median 15.0
Time under 5 fps in the world 1 %

For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches today. These fps are a check that nothing fell over, not a measurement of a gain.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. #3247 has since moved to 3dc6c58b3, which only merges main (81efe4566) into the head above: git diff 3e5887f65 3dc6c58b3 leaves d3d12/scripts/play-nvidia.ps1 and tests/test_win_launchers.py unchanged. If another of these pull requests changes its head, this run no longer covers it.

Limits: one run; arrival in the world was driven by keys and not checked on pictures; -PrecompileUsed was used because main now precompiles every known pipeline by default (88,631 for a new executable, over an hour on this card). The default start was therefore not exercised, and the F1 SAVE AND RESTART path of #3247 was not exercised in game. An earlier attempt of this batch is not counted: the run script gave up waiting while that full precompile ran.

AI-assisted (Claude Code).

OreoFR and others added 2 commits December 3, 2026 00:47
…(review of ProjectLeonida#3230)

Series S keeps frame generation with hardware RT and sets LEONIDA_FG_WITH_RT=1; Series X under 12 GB leaves it
off unless -More LEONIDA_FG_WITH_RT=1; 12 GB or more, or an unknown size, keeps it; LEONIDA_FG_WITH_RT=0 leaves it
off. The card's memory is a stubbed registry value. Fails on main's script and without the 12 GB rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OreoFR
OreoFR marked this pull request as ready for review December 2, 2026 23:49
… 20 GB of video memory, not 12

A player's RTX 5080 (16 GB), Series X, hardware RT, DLSS quality, frame generation 2x with LEONIDA_FG_WITH_RT=1,
7 minutes: frames generated, then about 5 minutes in the process passed the card's budget (13.0 of 12.95 GB, up to
14.2), Streamline reported eWarnOutOfVRAM and frames over 100 ms went from 8-15 to 46-53 a minute. A 3090 reached
18.6 GB on the same profile. 20 GB is just above: 16 GB cards keep it on Series S, and on Series X with
LEONIDA_FG_WITH_RT=1. The dry-run test gains a 24 GB case; 16 GB on Series X is now off (fails at 12 GB).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OreoFR OreoFR changed the title d3d12 play-nvidia: frame generation with ray tracing, except Series X under 12 GB (D3D12-FG-WITH-RT) d3d12 play-nvidia: frame generation with ray tracing, except Series X under 20 GB (D3D12-FG-WITH-RT) Dec 2, 2026
…ftware or hardware)

The automatic 2x of RTX 40/50 cards (with -Resolution or -Lowest, the Series X default) came along with
-HardwareRT once ray tracing stopped removing frame generation. Turning ray tracing on must not turn frame
generation on: with ray tracing it runs only when asked for (-FrameGen, the F1 menu, LEONIDA_FRAME_GEN). The
dry-run test gains three automatic cases (hardware RT, software RT, none); it fails without the condition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants