Skip to content

d3d12: the DLSS build is asked for once NVIDIA's SDK is here, whatever the switches (D3D12-F1-DLSS-REBUILD) - #2931

Merged
aslan2142 merged 3 commits into
ProjectLeonida:mainfrom
Mykolas009:d3d12/f1-dlss-rebuild
Dec 2, 2026
Merged

aslan2142 merged 3 commits into
ProjectLeonida:mainfrom
Mykolas009:d3d12/f1-dlss-rebuild

Conversation

@Mykolas009

@Mykolas009 Mykolas009 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: D3D12-F1-DLSS-REBUILD (#2570 (comment)), from the finding #2570 (comment)

What and why

d3d12/scripts/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 (SAVE AND RESTART) therefore asked for no build: with a build noted as made without DLSS (built-with.txt without dlss) and NVIDIA's SDK installed afterwards, every such start fell back from DLSS. get-nvidia-sdks.ps1 ends with "The next start of scripts\play-nvidia.ps1 builds the layer with DLSS"; that held only for some switches. #2922 covers the handoff once the build has DLSS; this is the step before it.

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, and are part of this change:

  • 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.

The gate follows (second commit): scripts/game-gate.ps1 refuses to run without a build so that none is made inside a run. With the change above, a build noted as made without DLSS would be made again inside the run by starts that did not ask for it before (the gate's default Series X start among them), after the gate wrote down the exe's hash. The gate now refuses that run as well and names the build script; not with -NoDlss in -PlayArgs and not without cargo, when the play script makes no build. One sentence in docs/game_gate.md says so.

Tested

Windows 11 Pro (build 26300), Windows PowerShell 5.1, Python 3.14.3. No game files and no GPU involved.

  • python -I tests/test_play_nvidia_menu_choice.py: 16 pass with this change (on main ab374c7). The new test, test_the_dlss_build_is_asked_for_once_its_sdk_is_here_whatever_the_switches, is ten cases of launcher dry runs against a synthetic folder, with a stand-in cargo on a PATH filtered of any other so the PC's own does not decide, and one more run for a note whose exe is gone. On main's launcher six of the ten fail (the five that expect the build and the one without cargo); the four that describe behaviour this change leaves alone pass there.
  • A real start (not a dry run) against the same kind of folder, with a stand-in build-nvidia.ps1 that only writes the build's note: the launcher calls it, reads the note again and goes on with "Series S, DLSS"; with cargo off the PATH it says so and goes on with the build that is here. (By hand; the start then stops where it needs the real leonida.exe.)
  • tests/test_win_launchers.py and tests/test_leonida_launcher.py pass; tools/d3d12_switches.py --check is clean (no new switch); scripts/check_no_game_data.py on both files is clean.
  • The gate's guard, with PowerShell 7.7.0: its own lines against a synthetic folder in eleven cases (a build noted without DLSS, with the SDK and cargo: refused, also beside -NoDlss:$false or another switch; -NoDlss spelled out, shortened or with :$true, a build with DLSS, no SDK, no cargo, no note: let through), and the whole script twice: it refuses before anything starts (exit 1, no run folder), and with a build noted as made with DLSS it goes on as before (run.json carries built_with; the run ends at once with ERROR not_started, there being no game in the folder). tests/test_game_gate.py and the thirteen tests/test_docs_*.py pass.
  • Not tested: a real rebuild with NVIDIA's SDK through build-nvidia.ps1 (this PC does not have the SDK; the check calls the script exactly as before), and a gate run with the game.

GPUs tested: n/a (launcher logic). The PC: NVIDIA GeForce RTX 5060 8 GB, driver 610.88, Windows 11 Pro.

AI-assisted: yes. Written and tested with Claude Code (Claude Fable 5.2). The diff was audited by a separate read-only reviewer agent (Claude Fable 5.2), twice before opening and once more for the second commit; its first pass turned a second check behind the menu into this change of the one existing check, and the gate's guard is its second pass's point.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (not applicable: no translator change)

🤖 Generated with Claude Code

…r 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#2570, 1 Dec 2026).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@KelboLive KelboLive 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.

Good fix: the rebuild is now keyed to the SDK lib alone (play-nvidia.ps1:129-131), with -NoDlss still the opt-out, and the no-SDK, -NoDlss and no-cargo paths fall back as before (the no-cargo case now continues with the existing build rather than stopping). The switch precedence is untouched — $wantDlss and the menu block at :529-641 still decide runtime use, so a DLSS-capable binary does not mean DLSS runs.

Red/green is solid: the new test fails 6/10 on ab374c7d5 and the suite is 16/16 here, with the -NoDlss case failing when the -not $NoDlss conjunct is removed. Merge with current main (including #2922) is clean and green, and the launcher tests plus switches.md check pass.

One thing before merge: scripts/game-gate.ps1:125-136 records exe_sha16/built_with before launching, so this change can rebuild leonida.exe during a gate run and leave run.json describing the previous binary — the body already flags it. Either add the guard you mentioned or file it as a follow-up, but it should not be left implicit, since the gate is the thing we use to compare builds.

Minor: the dry run reports the rebuild a real start would make, which is slightly optimistic if the build then fails — acceptable, just worth knowing.

@merzleckeier

Copy link
Copy Markdown
Contributor

Measured launcher build and restart sequencing at 5586f9b0 on 99a29d10 with PowerShell 7.4.21 on Linux. I exercised the unmodified launcher outside -DryRun in 12 synthetic cases per tree. A stub build-nvidia.ps1 records its invocation and updates the build note, then a stub executable records the settings actually passed at launch.

  • Two saved-DLSS F1 restarts at -Resolution 720: main launched stretch twice without a build. The PR called the builder once before the first launch, then both launches selected dlss.
  • Typed -Resolution 720 still selected the own upscaler after the build. With no cargo and a usable existing executable, the PR printed its new warning and launched stretch. No SDK, -NoDlss, release build and already-featured build avoided unnecessary rebuilds. Missing runtime DLL still selected stretch after the stub build.
  • Combined with d3d12: preserve explicit MotionBlur values in the 1080p–1440p preset #2761 (8edf0c84), the actual Series X preset with explicit -MotionBlur:$false called the builder and launched at 2560×1440 with a 0.75 minimum scale and four motion-blur skips. Bare -MotionBlur preserved the same output/scale with zero skips.

The adapted stock menu suite ran 16 test methods per tree. Main failed six subtests in the new build-selection method, and the PR alone and combined passed all 16 methods. This checks launcher control flow and settings at synthetic boundaries. Real SDK compilation and the game gate were outside scope. AI-assisted (Codex).

…LSS (D3D12-F1-DLSS-REBUILD)

The gate refuses to run without a build, because the play script would make
it inside the run. Since the change before this one, play-nvidia.ps1 also
makes a build noted as made without DLSS again once NVIDIA's SDK is there,
whatever the start's switches ask for: on such a checkout that build too
would be made inside the run, after the gate wrote down the exe's hash and
what it was built with. The gate now refuses that run as well and names the
build script. Not with -NoDlss in -PlayArgs (shortened or with :$true too)
and not without cargo: the play script makes no build then.

That commit's message calls this guard a follow-up, for want of PowerShell 7
on the PC it was written on; it has been installed since, and this is it.

Checked with PowerShell 7.7.0: the guard's own lines against a synthetic
folder, eleven cases; and the whole script twice. With a build noted as made
without DLSS and the SDK there it refuses before anything starts (exit 1, no
run folder). With a build noted as made with DLSS it goes on as before:
run.json carries built_with, and the run ends at once with ERROR not_started,
there being no game in the folder.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Mykolas009

Copy link
Copy Markdown
Contributor Author

Thanks for checking it. The guard is in now (218b032): scripts/game-gate.ps1 refuses a build noted as made without DLSS when NVIDIA's SDK is there (not with -NoDlss in -PlayArgs, not without cargo), with a sentence in docs/game_gate.md. Checked with PowerShell 7.7.0: eleven cases of the guard's own lines, and the whole script once refusing before anything starts and once going on. On the dry run: agreed, it shows the start that a build which succeeds leads to. AI-assisted (Claude Code).

@andrew-ai

Copy link
Copy Markdown

The new gate check on 218b0328b rejects one valid spelling of the opt-out. With -PlayArgs '-NoDlss: $true' (space after the colon), PowerShell 7.6.9 binds the actual scripts/play-d3d12.ps1 switch to true, but the gate refuses the run and asks for a DLSS rebuild. Removing the space makes the same request pass. The guard at scripts/game-gate.ps1:65 looks for the colon immediately followed by the literal boolean.

I exercised the whole gate against a synthetic SDK marker, an existing diagnostics-only build stamp and cargo on PATH. A sentinel at the first process lookup stopped accepted cases before a run started. Separately, I ran the real play wrapper in dry-run mode with a stub inner launcher to record the forwarded switch. No game files were used.

PlayArgs NoDlss forwarded Gate on this head
empty false refused
-NoDlss, -NoD, or -NoDlss:$true true allowed
-NoDlss:$false or -NoDlss: $false false refused
-NoDlss: $true true refused

The preceding commit 5586f9b00 allowed all seven cases. All 16 tests in tests/test_play_nvidia_menu_choice.py passed on the current head. Please cover the spaced true and false forms in a gate regression test when adjusting the preflight. Coordination claim. AI-assisted with OpenAI Codex (GPT-6).

@merzleckeier

Copy link
Copy Markdown
Contributor

The gate also treats a quoted adapter name as the DLSS opt-out. I reproduced this on 218b0328b merged into 1fff69129 with PowerShell 7.4.21 on Linux.

I ran the actual gate, generated launch.ps1, and both launcher scripts with a synthetic SDK marker, cargo on PATH and an existing diagnostics build. The gate refused -Adapter 'Fixture Adapter' as expected. With -Adapter 'Fixture -NoDlss Adapter', it wrote run.json, then the launcher invoked the builder. The result was the same with an actual -NoDlss:$false appended. Both cases repeated in fresh fixture directories.

In both accepted cases, run.json recorded e94908b2283560fd and diagnostics. The stub builder replaced the synthetic binary and updated the stamp to diagnostics,dlss. The process-start sentinel then saw e941749932f84722 and the full quoted string as the adapter name. Bare -NoDlss kept the original hash. The spaced-true opt-out exercises the converse mismatch.

The guard at scripts/game-gate.ps1:65 is matching the raw argument string. Please include a quoted argument containing -NoDlss in the gate regression test and make the preflight follow the switch that PowerShell binds.

Synthetic inputs only. The builder and final process start were replaced by test doubles. MEASURED, AI-assisted with OpenAI Codex and independent raw-log verification.

…D12-F1-DLSS-REBUILD)

The preflight added in 218b032 read -NoDlss out of -PlayArgs with a pattern over
the text. Two reviews of the pull request showed where that goes wrong:

- `-NoDlss: $true`, a space after the colon, binds true, and the gate refused the
  run and asked for a DLSS rebuild (andrew-ai, PowerShell 7.6.9);
- `-Adapter 'Fixture -NoDlss Adapter'` binds no switch, and the gate let the run
  go on into a build inside the run (merzleckeier, PowerShell 7.4.21).

The gate now asks PowerShell itself: Test-NoDlssBound takes the param block of
scripts\play-d3d12.ps1 and lets it bind the arguments the launch line gives the
script (-Game, -Data, -More, then -PlayArgs); nothing of the play script runs.
The first thing the probe writes is the answer, so text behind a `;` in
-PlayArgs cannot stand in for it. Arguments PowerShell cannot bind (an ambiguous
-No, a switch that does not exist, a value outside a ValidateSet) count as
-NoDlss not said, as the start itself fails on them, and the refusal then says
that they did not bind and with which error. The probe is reached only when the
build's note, the SDK and cargo already say the play script would build.

tests/test_game_gate.py takes the function out of the script and puts 19 lines of
-PlayArgs to PowerShell 7 against the real play script's parameters: bare,
shortened, :$true, : $true, :$false, : $false, alone and among other switches,
the quoted adapter name alone, with -NoDlss:$false and with a real -NoDlss, an
argument that does not bind, and a `; $true` behind the arguments (skipped where
there is no pwsh). A second test holds that no pattern is matched against
-PlayArgs any more.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@merzleckeier

Copy link
Copy Markdown
Contributor

The revised preflight fixes the quoted-adapter and spaced-true cases in the full gate.

I reran the actual gate, generated launch.ps1, and both launcher scripts on 9fc7de03e3397516f12217e38c93db47c05bf8fc integrated onto main c4ca5761508f136c5530482093bb3053b0bad4fa, using PowerShell 7.4.21 on Linux. The fixture supplied an SDK marker, cargo, and an existing diagnostics build.

  • The gate refused -Adapter 'Fixture -NoDlss Adapter' both alone and with -NoDlss:$false. It also refused spaced false, a normal adapter name without the switch, and the empty case. All six refusals happened before run.json was written.
  • The six true opt-out cases reached the process-start sentinel. They included -NoDlss: $true, a case-insensitive abbreviation, Series S with spaced true, and the quoted adapter plus a real true switch. All six recorded the same executable hash and feature stamp that the attempted launch used.

The main control reached the sentinel in all 12 cases. None of the 24 cases invoked the stub builder. The stock gate test file passed 24/24 on main and 26/26 on the PR. This covers the selected literal argument forms, with synthetic inputs and a test double at the final process start.

AI-assisted local testing, independently checked against the raw data.

@aslan2142
aslan2142 added this pull request to the merge queue Dec 2, 2026
Merged via the queue into ProjectLeonida:main with commit 4b67b07 Dec 2, 2026
6 checks passed
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.

5 participants