FidelityFX: DLSS frame generation on frames the title upscales (stacked on #1704) #1715

Open
github-bot wants to merge 5 commits from github-bot/gh-1715 into main AGit
Owner

@⁠marquezinii on GitHub · 2026-11-24 21:08 UTC · original
marquezinii:gpu/dlss-frame-generation → main · +3359 −68 · 11 files · 5 commits · open

Stacked on #1704 (DLSS upscaling), which is stacked on #1868, all on main at 940d32f. Only the last commit (6aaec93) is new here.

What

With VICTORY_DLSS_FG=<n> beside VICTORY_DLSS_DIR, DLSS frame generation (DLSS-G) adds n frames between the presented ones: 1 for 2x, 2 for 3x, 3 for 4x on GPUs that offer multi frame generation. It needs an RTX 40 or newer and hardware-accelerated GPU scheduling. Streamline reports when either is missing, and the log says frame generation is unavailable.

The title asks for no frame generation, so the inputs come from the title's upscale.

  • Inputs. At each DLSS upscale, depth and motion vectors are tagged as eOnlyValidNow, so Streamline copies them on the list. The title may reuse them before the present. The frame's constants are the upscale's.
  • Swap chain. #1704 now makes the presenter's swap chain from Streamline's proxy factory whenever DLSS is on, so presentCommon runs. DLSS-G needs it too, since in manual hooking that is how it gets the back buffer and inserts its frames. This PR adds the start of the first frame there.
  • Pacing. Each present gets the PCL markers and Reflex's sleep (low latency mode), which DLSS-G requires. Frames are numbered by present instead of by upscale, so all the upscales of one presented frame share its token.
  • Off outside the world. DLSS-G is switched on for frames that had an upscale and off for the others (menus, videos, loading), as the DLSS-G guide asks.

Without VICTORY_DLSS_FG nothing changes from #1704: no markers, no Reflex, and the upscale numbers frames per dispatch.

Tested

Windows 11 26300, RTX 5070 (driver 621.40), Streamline SDK 2.14.16, on this branch rebased on 940d32f:

  • dlss::tests::frame_generation_presents_generated_frames opens a window and gets its swap chain from the proxy factory. It then runs 120 frames, each with a DLSS upscale on the list, a present and the markers, and checks that DLSS-G reports n + 1 frames among the last 10 presents, and never more. It passes for VICTORY_DLSS_FG=1, 2 and 3, that is 2x, 3x and 4x. It skips without both variables.
    • It is flaky on this machine. About one run in five, sometimes several in a row, DLSS-G reports status 0 and one frame on every present: it is on and reports no failure, but generates nothing. The failure message now prints the last presents and the status. It came and went while I used the machine, which points at the test window's focus or occlusion rather than the code, but I haven't confirmed that.
  • With VICTORY_DLSS_FG=1, #1704's title-shaped test (victory-hle/tests/dlss.rs, FP16 and RGB9E5 outputs) still passes, and so does the upscale-only path without it.
  • Clippy with -D warnings passes, with and without --all-features.

Not tested: frame generation in the title. #1704 ran there (see its description), but I didn't turn DLSS-G on in the title. Several things are unchecked:

  • How generated frames look with its motion vectors and depth.
  • That its HUD is part of the back buffer. No HUD-less buffer is tagged, so UI may smear in generated frames.
  • That its swap chain format is one DLSS-G accepts. dlss: frame generation presenting logs the status.
  • The camera matrices are identity, as in #1704.
**@⁠marquezinii** on GitHub · 2026-11-24 21:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/1715) `marquezinii:gpu/dlss-frame-generation` → `main` · +3359 −68 · 11 files · 5 commits · open Stacked on #1704 (DLSS upscaling), which is stacked on #1868, all on `main` at `940d32f`. Only the last commit (`6aaec93`) is new here. ## What With `VICTORY_DLSS_FG=<n>` beside `VICTORY_DLSS_DIR`, DLSS frame generation (DLSS-G) adds `n` frames between the presented ones: 1 for 2x, 2 for 3x, 3 for 4x on GPUs that offer multi frame generation. It needs an RTX 40 or newer and hardware-accelerated GPU scheduling. Streamline reports when either is missing, and the log says frame generation is unavailable. The title asks for no frame generation, so the inputs come from the title's upscale. - **Inputs.** At each DLSS upscale, depth and motion vectors are tagged as `eOnlyValidNow`, so Streamline copies them on the list. The title may reuse them before the present. The frame's constants are the upscale's. - **Swap chain.** #1704 now makes the presenter's swap chain from Streamline's proxy factory whenever DLSS is on, so `presentCommon` runs. DLSS-G needs it too, since in manual hooking that is how it gets the back buffer and inserts its frames. This PR adds the start of the first frame there. - **Pacing.** Each present gets the PCL markers and Reflex's sleep (low latency mode), which DLSS-G requires. Frames are numbered by present instead of by upscale, so all the upscales of one presented frame share its token. - **Off outside the world.** DLSS-G is switched on for frames that had an upscale and off for the others (menus, videos, loading), as the DLSS-G guide asks. Without `VICTORY_DLSS_FG` nothing changes from #1704: no markers, no Reflex, and the upscale numbers frames per dispatch. ## Tested Windows 11 26300, RTX 5070 (driver 621.40), Streamline SDK 2.14.16, on this branch rebased on `940d32f`: - `dlss::tests::frame_generation_presents_generated_frames` opens a window and gets its swap chain from the proxy factory. It then runs 120 frames, each with a DLSS upscale on the list, a present and the markers, and checks that DLSS-G reports `n + 1` frames among the last 10 presents, and never more. It passes for `VICTORY_DLSS_FG=1`, `2` and `3`, that is 2x, 3x and 4x. It skips without both variables. - **It is flaky on this machine.** About one run in five, sometimes several in a row, DLSS-G reports status 0 and one frame on every present: it is on and reports no failure, but generates nothing. The failure message now prints the last presents and the status. It came and went while I used the machine, which points at the test window's focus or occlusion rather than the code, but I haven't confirmed that. - With `VICTORY_DLSS_FG=1`, #1704's title-shaped test (`victory-hle/tests/dlss.rs`, FP16 and RGB9E5 outputs) still passes, and so does the upscale-only path without it. - Clippy with `-D warnings` passes, with and without `--all-features`. **Not tested:** frame generation in the title. #1704 ran there (see its description), but I didn't turn DLSS-G on in the title. Several things are unchecked: - How generated frames look with its motion vectors and depth. - That its HUD is part of the back buffer. No HUD-less buffer is tagged, so UI may smear in generated frames. - That its swap chain format is one DLSS-G accepts. `dlss: frame generation presenting` logs the status. - The camera matrices are identity, as in #1704.
The title upscales into an RGB9E5 texture with render-target and
unordered-access uses. NVIDIA creates such a texture, so its host copy
takes UNORDERED_ACCESS, but it cannot store to RGB9E5 through a typed
unordered access view: the host upscaler writing it removes the device
(0x887A0005 in the test below).

Where the host does not store to the output's format (format support:
typed UAV and UAV typed store), the output is moved to COPY_DEST and the
upscaler writes an FP16 texture of ours instead. Its rows are copied to
a buffer, a compute shader packs them into RGB9E5 by D3D's rule, and a
buffer-to-texture copy writes the title's texture. The packer is a 5.1
shader with its root signature inside, as indirect.rs does, and needs no
descriptor heap. Hosts that store RGB9E5 write it directly, as before.

tests/fidelityfx.rs upscales into an RGB9E5 output too, made with the
title's uses, and checks every pixel of both outputs.
Formats such as RGB9E5 and B4G4R4A4 support neither render targets nor
typed unordered views on NVIDIA. An RTX 5070 still makes such a texture
with those flags, unless a clear value comes with it, and the title
passes one: 2560x1440 B4G4R4A4 and RGB9E5 targets got no host texture.
An RTX 3070 refuses them with either flag.

When creation fails, make_texture retries without the render target and
unordered access flags that D3D12_FEATURE_FORMAT_SUPPORT doesn't list
for the format, and without the clear value. The texture then exists and
is written by copies. An RGB9E5 upscaler output goes through the FP16
bridge. Render target views are not made on such a texture, because one
would remove the device: set_targets leaves it unbound and a clear
skips it.
With VICTORY_DLSS_DIR pointing at bin\x64 of NVIDIA's public Streamline
SDK, the title's FidelityFX upscaler calls are answered by DLSS instead of
AMD's PC upscaler. Nothing of the SDK is in the tree: it is loaded from
that folder, and its structures are declared from its MIT headers with
their sizes checked.

victory_hle's FidelityFX module turns the dispatch into host objects as
it does for AMD's DLL (textures swapped for their host copies, the list
for the host one, an RGB9E5 output the host cannot store to swapped for
victory_gpu::rgb9e5's FP16 texture) and hands it to victory_gpu::dlss,
which maps the description onto DLSS options, constants and resource
tags. Jitter and render sizes are answered with FSR's formulas, so the
title renders as it does for FSR.
With manual hooking, Streamline's common plugin only does its per-frame
bookkeeping in presentCommon, which runs from its swap chain proxy's
Present. Nothing called it, so a run in the title logged "presentCommon()
was not observed". With DLSS on, the presenter now makes its swap chain
from Streamline's proxy for the DXGI factory (slUpgradeInterface), as
the manual hooking guide recommends. Without DLSS nothing changes.
With VICTORY_DLSS_FG set beside VICTORY_DLSS_DIR, DLSS-G adds 1 to 3
frames between the presented ones. The title asks for no frame
generation, so the inputs are the DLSS upscale's: depth and motion
vectors are tagged at each upscale for Streamline to copy (they may be
reused before the present), and the frame's constants are the upscale's.

The presenter's swap chain comes from Streamline's proxy factory, and
each present gets Reflex's sleep and the PCL markers DLSS-G paces with.
Frames are numbered by present instead of by upscale, so the upscales of
a presented frame share its token. DLSS-G is on for frames that had an
upscale and off for the others (menus, videos).

A GPU test presents 120 frames to a window through the proxy swap chain,
with an upscale each, and checks that DLSS-G reports n + 1 frames for
the last present; it skips without VICTORY_DLSS_DIR and VICTORY_DLSS_FG.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:42:25 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:35 UTC · original · edited 2026-11-25 06:26 UTC

Automated triage for the maintainers.

Needs work: needs the maintainer's decision. This adds DLSS frame generation (VICTORY_DLSS_FG) on top of #1704 (DLSS upscaling through Streamline), which sits on #1868. The diff against main therefore carries all three: the new crates/victory-gpu/src/dlss.rs, rgb9e5.rs, and changes to resource.rs, host.rs and victory-hle's fidelityfx.rs. Only 6aaec93 is new here. The stack makes VICTORY load and run third-party native code: LoadLibraryW on sl.interposer.dll and its plugins, from the folder VICTORY_DLSS_DIR names (dlss.rs). The swap chain then comes from Streamline's proxy factory. Loading outside DLLs is the maintainer's call, so this cannot be a merge candidate on its own. Two more things before a content review is worth it:

  • #1704 and #1868 need to be decided first; this PR is best re-reviewed once only its own commit differs from main.
  • frame_generation_presents_generated_frames fails about one run in five, by the description's own account, with no cause found. Please confirm the cause (window focus or occlusion) or make the test tolerate it before it lands.

Thanks for the rebase and the clear notes on what is untested. It merges cleanly with main now.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1715#issuecomment-7149714179) · edited 2026-11-25 06:26 UTC <!-- victory-triage v1 head=6aaec938f0c396116209d4ca585a53ff36335d05 verdict=needs-work at=2026-11-25T06:26:10Z --> Automated triage for the maintainers. **Needs work: needs the maintainer's decision.** This adds DLSS frame generation (`VICTORY_DLSS_FG`) on top of #1704 (DLSS upscaling through Streamline), which sits on #1868. The diff against `main` therefore carries all three: the new `crates/victory-gpu/src/dlss.rs`, `rgb9e5.rs`, and changes to `resource.rs`, `host.rs` and `victory-hle`'s `fidelityfx.rs`. Only `6aaec93` is new here. The stack makes VICTORY load and run third-party native code: `LoadLibraryW` on `sl.interposer.dll` and its plugins, from the folder `VICTORY_DLSS_DIR` names (`dlss.rs`). The swap chain then comes from Streamline's proxy factory. Loading outside DLLs is the maintainer's call, so this cannot be a merge candidate on its own. Two more things before a content review is worth it: - #1704 and #1868 need to be decided first; this PR is best re-reviewed once only its own commit differs from `main`. - `frame_generation_presents_generated_frames` fails about one run in five, by the description's own account, with no cause found. Please confirm the cause (window focus or occlusion) or make the test tolerate it before it lands. Thanks for the rebase and the clear notes on what is untested. It merges cleanly with `main` now. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠marquezinii on GitHub · 2026-11-25 04:48 UTC · original

Rebased on 940d32f with #1704, which is now stacked on #1868. The host.rs conflict is gone, because #1704 now routes the swap chain through Streamline whenever DLSS is on, and this PR only adds the frame-generation start there. The FG test now checks the last 10 presents and prints DLSS-G's status when it fails. Its flakiness is described in the updated description.

**@⁠marquezinii** on GitHub · 2026-11-25 04:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/1715#issuecomment-7153181557) Rebased on `940d32f` with #1704, which is now stacked on #1868. The `host.rs` conflict is gone, because #1704 now routes the swap chain through Streamline whenever DLSS is on, and this PR only adds the frame-generation start there. The FG test now checks the last 10 presents and prints DLSS-G's status when it fails. Its flakiness is described in the updated description.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1715/head:github-bot/gh-1715'
git switch 'github-bot/gh-1715'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1715'
git switch 'github-bot/gh-1715'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1715'
git switch 'github-bot/gh-1715'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1715'
git switch 'main'
git merge --squash 'github-bot/gh-1715'
git switch 'main'
git merge --ff-only 'github-bot/gh-1715'
git switch 'main'
git merge 'github-bot/gh-1715'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1715
No description provided.