Skip to content

FidelityFX: answer the upscale calls with DLSS through Streamline (stacked on #1868) - #1704

Open
marquezinii wants to merge 4 commits into
Marvisak:mainfrom
marquezinii:gpu/dlss-upscaler
Open

marquezinii wants to merge 4 commits into
Marvisak:mainfrom
marquezinii:gpu/dlss-upscaler

Conversation

@marquezinii

@marquezinii marquezinii commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1868: its two commits come first here. This PR's own commits are the last two, 1812694 and 5800bd7, on main at 940d32f. #1868 writes an RGB9E5 output that NVIDIA can't store to through an FP16 texture (victory_gpu::rgb9e5), and makes that texture where the host refuses it with the title's uses. DLSS reuses both, so there's one copy of the bridge.

What

With VICTORY_DLSS_DIR pointing at bin\x64 of NVIDIA's public Streamline SDK (2.x), the title's FidelityFX upscale calls are answered by DLSS instead of AMD's PC upscaler. The SDK isn't in the tree. It is loaded from that folder, the way VICTORY_FIDELITYFX_DIR loads AMD's.

  • Routing. victory_hle::modules::fidelityfx does what it already does for AMD's DLL. The title's textures become their host copies in the states the title gives, its command list becomes the host one, and an RGB9E5 output the host can't store to becomes FidelityFX: write an RGB9E5 output NVIDIA cannot store to through an FP16 texture (fixes a device removal) #1868's FP16 texture. Then it hands the description to victory_gpu::dlss instead of ffxDispatch from the PC DLL, and packs the output afterwards as it does for AMD's.
  • Streamline setup.
    • Manual hooking on VIctory's own host device (slSetD3DDevice), with frame-based resource tagging.
    • Each FidelityFX context is one Streamline viewport. Its DLSS mode comes from the context's largest upscale (1.5x → Quality, 2x → Performance and so on).
    • With DLSS on, the presenter makes its swap chain from Streamline's proxy factory (slUpgradeInterface), as Streamline's manual hooking guide recommends, so its presentCommon runs on each present. Without that, Streamline logs presentCommon() was not observed and its per-frame bookkeeping never runs (reported in the comments).
  • Description mapping. The FidelityFX flags become DLSS options and constants: HDR, inverted depth, auto exposure, jittered vectors.
    • Jitter passes through, since both APIs take the camera's offset in pixels.
    • FidelityFX's motion vector scale converts vectors to pixels, and DLSS's converts them to [-1, 1]. So the scale is divided by the size the vectors are rendered at.
  • Queries. The title asks for its jitter sequence and render sizes, which DLSS has no calls for. They are answered with FSR's own formulas (8 * ratio² phases, Halton(2, 3)), so the title renders the frames it would for FSR.
  • Bindings. The Streamline structures are declared from the SDK's MIT-licensed headers. Their sizes, and the offsets that matter, are const-asserted against MSVC's values.

Tested

Windows 11 26300, RTX 5070 (driver 621.40), Streamline SDK 2.14.16:

  • victory-hle/tests/dlss.rs is new, built from main's tests/fidelityfx.rs.
    • It calls our exports as the title does: the title's descriptions, console device, queue and list, the jitter queries, and two upscalings (1280x720 → 1920x1080) of a flat colour.
    • One upscaling goes into an FP16 output, the other into an RGB9E5 output made with the title's uses (render target and unordered access). Every pixel of both, read back in the same list, is checked within 0.05.
    • It runs with the debug layer on, with no errors from it. Here the log reads RGB9E5 output written through an FP16 texture.
    • It passes, and it skips without VICTORY_DLSS_DIR.
  • victory-gpu's unit tests pass: the FSR formulas, the DLSS mode per ratio, the dispatch mapping, and a DLSS upscale on a device made before Streamline starts.
  • cargo test -p victory-gpu passes (except the two NVIDIA heap-cap failures main has, Test report: RTX 5070 (Blackwell), Windows 11, 70564ae: 471 passed, 5 failed, 7 ignored (4 from the 1,000,000 view heap cap) #1744), and so does cargo test -p victory-hle.
  • Clippy with -D warnings passes, with and without --all-features.

In the title (main at 940d32f plus #1775 and #1751, without which main removes the device at boot on NVIDIA (#1753); Series S profile, which takes the FidelityFX path):

  • The log reads, in order:
    1. dlss: Streamline initialised on the host device
    2. dlss: presenting through Streamline
    3. dlss: upscale context on the host GPU viewport=0 render=[1280, 720] upscale=[1920, 1080] mode=MaxQuality
    4. FidelityFX: first upscaling, host formats of its textures formats=[10, 19, 34, 67]
    5. dlss: first upscale recorded on the host GPU
  • No presentCommon error and no Streamline error came up over about 4½ minutes in the world.
  • Before this was stacked on FidelityFX: write an RGB9E5 output NVIDIA cannot store to through an FP16 texture (fixes a device removal) #1868, the same run never upscaled. The title's RGB9E5 output had no host texture (the RTX 5070 refuses it with a clear value), and the log read a resource has no host texture in its state; the upscaling did not run.
  • These runs used VICTORY_SKIP_PIPELINES=f607780aa8e502d0. Without it, the GPU hangs within a minute of entering the world on this card, on an indirect dispatch of that pipeline, with or without DLSS (DRED names it).
  • The world's frames are still dark on this machine, so the picture couldn't be judged here. An RTX 3050 run in the comments found it clean.

Not tested: Series X (it doesn't take the FidelityFX path without #1793's picker change), other DLSS modes, AMD (DLSS needs NVIDIA).

@sagouindupm

Copy link
Copy Markdown

In-title result for this PR, since the description says it had not been run in the title: DLSS answers the title's upscale calls in Series S mode on an 8 GB card, and the picture is clean.

Setup

From the log (one run, about 5 minutes, opening cutscene then the first gameplay room)

  • dlss: Streamline initialised on the host device
  • dlss: upscale context on the host GPU viewport=0 render=[1280, 720] upscale=[1920, 1080] flags=41 mode=MaxQuality
  • ffx: jitter phase count ... count=Some(18)
  • dlss: first upscale recorded on the host GPU render=[1280, 720] upscale=[1920, 1080] mode=MaxQuality, then ffx: first upscale recorded ... result=0 ... format=10 packed=false (the output is the FP16 stand-in of GPU: fence waits, direct memory-write wakes, queue timeline and host list pool #32, so no RGB9E5 packing here).
  • No device removal, no host GPU error.

Picture and speed

  • Compared by eye with a plain bilinear stretch of the same input and with the PC FSR path of GPU: cap a sampler heap past the host's limit, with dynamic slots for tables past it #86 (which picked provider 3.1.6 on this card): no grain, straight edges, no visible shake or smearing on a slow camera. So the jitter sign and the motion vector scale look right at this frame rate; I did not check a fast camera.
  • 510 to 650 ms a frame in the world in most samples, two samples near 3 s; the same range as the stretch (588 ms median) and FSR (569 ms median) on this machine. 6.9 GB of video memory, the card about 60 % busy. The frame time is not the upscaler's here.

One error, once in the run
[streamline][error] commonInterface.cpp:559 [slEvaluateFeatureInternal] Streamline presentCommon() was not observed. Ensure the common plugin's presentCommon() function is invoked every frame. Without presentCommon(), internal bookkeeping and garbage collect...
Nothing visible came of it in 5 minutes. I did not measure memory over a long run.

Not tested

  • More than one run; runs longer than 5 minutes; a fast-moving camera.
  • Series X (it does not take the FidelityFX path without the picker override).
  • Other DLSS modes, other cards.

No game data. AI-assisted: Claude Code applied the commit, made the run, read the log and wrote this comment.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs work: needs the maintainer's decision. This answers the title's FidelityFX upscale calls with DLSS. It loads sl.interposer.dll and its plugins with LoadLibraryW from VICTORY_DLSS_DIR (crates/victory-gpu/src/dlss.rs), about 1,400 lines in that file alone. Loading external code is the maintainer's call, so this cannot be a merge candidate on review alone.

Update after your reply (head 5800bd7):

The picture itself is still unchecked, since the frames are dark in your runs. A side-by-side with FidelityFX would help whoever decides.


Generated by Claude Code

…n FP16 texture

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.
… without it

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.
…ns each frame

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.
@marquezinii marquezinii changed the title FidelityFX: answer the upscale calls with DLSS through Streamline, RGB9E5 outputs included FidelityFX: answer the upscale calls with DLSS through Streamline (stacked on #1868) Nov 25, 2026
@marquezinii

Copy link
Copy Markdown
Contributor Author

Updated, taking the triage's three points and @sagouindupm's run (thanks for testing it in the title, and for catching the Streamline error):

  • presentCommon() was not observed. 5800bd7: with DLSS on, the presenter makes its swap chain from Streamline's proxy factory (slUpgradeInterface). That's what the manual hooking guide recommends, so presentCommon runs on each present. In a Series S run on an RTX 5070 the log now reads dlss: presenting through Streamline, then the context and dlss: first upscale recorded on the host GPU. Over about 4½ minutes in the world, no presentCommon or other Streamline error came up.
  • One copy of the RGB9E5 bridge. This PR is now stacked on FidelityFX: write an RGB9E5 output NVIDIA cannot store to through an FP16 texture (fixes a device removal) #1868 and uses its victory_gpu::rgb9e5. dlss/rgb9e5.rs is gone, and the FidelityFX module does the bridging for both backends. The stacking turned out to be needed in the title anyway. Without FidelityFX: write an RGB9E5 output NVIDIA cannot store to through an FP16 texture (fixes a device removal) #1868's new commit, the RTX 5070 refused the title's RGB9E5 output texture (it comes with a clear value), so DLSS never ran: a resource has no host texture in its state; the upscaling did not run.
  • CI. The failures were the victory-shader hardware tests that failed on main at the time (fixed in 42363ab/ccfb029). Rebased on 940d32f.

The title runs used main plus #1775 and #1751, since plain main removes the device at boot on NVIDIA (#1753). On this card the world also hangs the GPU within a minute on an indirect dispatch of compute pipeline f607780aa8e502d0, with or without DLSS (DRED names it). The runs skipped that pipeline with VICTORY_SKIP_PIPELINES. I couldn't judge the picture because the world's frames are still dark here, so @sagouindupm's comparison remains the picture check.

sagouindupm added a commit to sagouindupm/Mandy that referenced this pull request Nov 26, 2026
…rvisak/VIctory#1704)

The commit 7e6e578 of Marvisak/VIctory#1704 by marquezini, applied on top of
this branch's port of the PC upscaler (#86). With VICTORY_DLSS_DIR naming the
bin\x64 folder of NVIDIA's Streamline SDK, the title's FidelityFX upscale
calls are answered by DLSS. One conflict, in the module comment of
crates/victory-hle/src/modules/ffx.rs.

Built (release). Not run in the title yet: the SDK is not on this machine.

(cherry picked from commit 5825e5d95bec89bcbce4d99963436c11cc50d772)

Onto feat/render, after the port of #86 there: one conflict in the module
comment and module list of crates/victory-gpu/src/ffx.rs (the RGB9E5
packing is not ported here, so no rgb9e5 module). README conflict: ours
kept.

Co-Authored-By: marquezini <marquezinii@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Signé-par: Sagouindupm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants