Files
foxhound/docs/dlss.md
readmet3xt-lab 889d607b62 Upscaling and frame generation: the 30 fps gate, fallbacks, and the DLSS step-down
- Frame generation under 30 fps (VICTORY_FRAMEGEN_MIN_FPS): the switch on now needs 90 % of frames at a 29th of a second or less, one frame a second of slack. At the title's own 30 cap about half the frames come a little over a 30th, so the gate never turned it on. New tests: a 30 cap with up to 1 ms of jitter turns it on; a steady 28 never does.
- A failed DLSS or FSR upscaling now records the plain stretch of the scene over the output. The title's own upscaling does not run for that frame, so before this the output kept the frame before. VICTORY_UPSCALE_FALLBACK=0 restores 0.8.3's behaviour.
- DLSS out of the card's memory: the budget steps down after 30 "out of VRAM" answers within 120 upscalings (about four seconds at 30 fps), not only 30 in a row. Failures with successes between them never stepped it down. New tests cover alternating, consecutive and rare failures.
- FSR 4 frame generation: when FidelityFX refuses the FSR 4 swap chain, FSR 3's is made instead, and the generator follows it. Before, frame generation stayed off for the session.
- AMD's upscaler and frame generation alone no longer load Streamline. Streamline has no default folder any more: without VICTORY_STREAMLINE_DIR, DLSS and its frame generation stay off and say why. 0.8.3 tried a developer's folder on FSR-only runs and logged that the title's own upscaling ran. The DLSS setup doc says so.
- Removed the Series S flag that nothing read.

Tests: victory-gpu 639 passed. Clippy is clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 02:09:20 +05:30

278 lines
18 KiB
Markdown

# DLSS and DLSS Frame Generation (NVIDIA Streamline)
Two switches, both off by default:
- `VICTORY_DLSS=1`: DLSS Super Resolution does the program's FidelityFX upscaling
(its `ffxDispatch`), from the same colour, depth, motion vectors, exposure and
reactive mask into the same output, at the same place of the program's command
list.
- `VICTORY_FRAMEGEN=1`: DLSS Frame Generation (2x) on our present, from the depth
and motion vectors of the last upscaling submitted before the present.
Nothing NVIDIA ships is in this repository. The library is loaded at run time
from a folder you name; if anything is missing (the folder, a signature, a
feature on this GPU, the device hand-over), the log says what, and the program's
own upscaling and our plain present run as before.
## Setup
1. Download NVIDIA's Streamline SDK release (NVIDIA RTX SDK license) from
<https://github.com/NVIDIA-RTX/Streamline/releases> and unpack it outside the
repository. Tested: `streamline-sdk-v2.14.16.zip`, unpacked to
`C:\dev\sdk\streamline-sdk-v2.14.16`. Its `bin\x64` folder holds what is
loaded:
- `sl.interposer.dll` (loaded by us; its Authenticode signature is checked),
- `sl.common.dll`, `sl.dlss.dll`, `sl.dlss_g.dll`, `sl.reflex.dll`,
`sl.pcl.dll` (Streamline's plugins; it checks their NVIDIA signatures),
- `nvngx_dlss.dll` (DLSS Super Resolution, 310.x), `nvngx_dlssg.dll` (DLSS
Frame Generation).
A newer `nvngx_dlss.dll` (the DLSS SDK, <https://github.com/NVIDIA/DLSS>,
`lib\Windows_x86_64\rel`) can replace the one in that folder.
2. `VICTORY_STREAMLINE_DIR=<that bin\x64 folder>` (the launcher's Streamline
folder sets it). There is no default: without it DLSS and its frame
generation stay off, and AMD's upscaler and frame generation load no
Streamline at all.
3. Check the PC without the program (a few seconds):
- `victory upscaler-check`: Streamline loads, and what this GPU supports.
- `victory upscaler-check --device`: the host device is made and handed over
to Streamline, DLSS's render sizes for the output are listed, and DLSS runs
three times on stand-in textures.
- `victory upscaler-check --present`: as `--device`, then three seconds of
presents in a window of ours with frame generation on stand-in depth and
motion vectors and a stand-in colour without the interface; it reports how
many frames frame generation showed and how many presents were tagged
with that colour. With a device, the check ends by switching frame
generation off, letting the swap chain go and calling `slShutdown`
(`VICTORY_CHECK_TEARDOWN=0`: not; the process then fails fast at its
exit, code 0xC0000409, which some shells show as 9).
- `VICTORY_STREAMLINE_PRESENT=1` with `--present`: DLSS alone, 120
upscalings with a present after each through Streamline's proxy of our
swap chain (no "presentCommon() was not observed" may follow).
Windows 10 2004 or later, a GeForce RTX GPU (frame generation: RTX 40 or
later), hardware-accelerated GPU scheduling on (frame generation needs it).
## Switches
| Variable | Values | Default | What |
|---|---|---|---|
| `VICTORY_DLSS` | `1` | off | DLSS in place of the program's FidelityFX upscaling |
| `VICTORY_FRAMEGEN` | `1` | off | DLSS Frame Generation on our present; needs `VICTORY_THIN=1` or `VICTORY_ASYNC_SUBMIT=1` (the line of submissions) |
| `VICTORY_DLSS_MODE` | `dlaa`, `quality`, `balanced`, `performance`, `ultraperformance` | `quality` (`dlaa` with frame generation alone) | the scene's size: 1, 2/3, 0.58, 1/2, 1/3 of the output; the DLSS mode follows the sizes the program then passes |
| `VICTORY_DLSS_PRESET` | `default`, `j`, `k`, `l`, `m` (`e`, `f` deprecated) | `default` | the DLSS model, for every mode |
| `VICTORY_STREAMLINE_DIR` | a folder | see above | where `sl.interposer.dll` and the rest are |
| `VICTORY_STREAMLINE_LOG` | a folder | none | Streamline's own log files there, verbose |
| `VICTORY_DLSS_JITTER` | `x,y` | `1,1` | multipliers for the jitter DLSS is given (`-1,1` flips x) |
| `VICTORY_DLSS_MV` | `x,y` | `1,1` | multipliers for the motion-vector scale |
| `VICTORY_DLSS_REACTIVE` | `0` | on | `0`: the program's reactive mask is not given to DLSS |
| `VICTORY_FSR_PATH` | `1` | off | the program's FidelityFX path at `VICTORY_DLSS_MODE`'s scale with its own FidelityFX (no Streamline): the comparison for DLSS |
| `VICTORY_FRAMEGEN_HUDLESS` | `0` | on (with `VICTORY_FRAMEGEN=1`) | `0`: no colour without the interface is copied or tagged on Series X (generated frames then warp the interface) |
| `VICTORY_STREAMLINE_PRESENT` | `1` | off | DLSS without frame generation: our swap chain is Streamline's proxy of it, so Streamline sees the presents (no "presentCommon() was not observed") |
## How it works
**Where a program upscales.** A program that upscales with the console's FidelityFX imports `ffxCreateContext`,
`ffxDestroyContext`, `ffxQuery` and `ffxDispatch` from `amd_fidelityfx_loader_xbox.dll`, which loads
`amd_fidelityfx_upscaler_xbox.dll` itself. With a switch on, the executable's imports of the loader are bound to
ours (`victory_hle::modules::fidelityfx::Interpose`), which call the program's own DLL for everything; only an
upscale `ffxDispatch` (type `0x10001`) is taken. The program's upscaler context stays its own, so its upscaling
runs again on any frame DLSS does not take.
**A program that does not upscale on every profile.** A program may take its FidelityFX path on one console
profile only. Then DLSS has no dispatch to take on the other, and an image patch (checked against the stock
bytes first, and left out for any other executable) makes the program take the path there too, at the scale of
`VICTORY_DLSS_MODE`. The render size is computed by the program, not asked of `ffxQuery`, so a query answer cannot
change it. Such patches are program-specific and are moving out of the engine into title profiles.
**At the dispatch.** On the program's thread the dispatch's textures are checked
(host copies, states a shader can read or write); then a step is put into the
program's list (`crate::list::external`): run at once, or with `VICTORY_THIN=1`
written into the list's stream and run where it is translated, in order. The
step prepares the inputs as a compute shader's would be prepared (aliased
views, uploads of program-written textures, depth twins), moves each into the
state the program gave FidelityFX, records `slEvaluateFeature` into the host list
with the textures as local tags in those states (Streamline moves them to what
it needs and back), marks the output as written on the host, and has the
program's draw state set again before its next draw. Viewport 1, frame index =
the upscaling's number.
Constants from the dispatch: jitter, motion-vector scale (FidelityFX's scale
over the render size), near, far, vertical field of view, reset; from the
context's flags: HDR, inverted depth, auto exposure (no exposure texture),
display-resolution motion vectors, jittered motion vectors. The program passes
no camera matrices: the projection is made of the field of view, the render
aspect and the depth range; camera motion is in the motion vectors, so the
clip-to-previous-clip matrices are the identity and the camera stands at the
origin. DLSS Super Resolution reads none of the matrices; frame generation may.
**Frame generation.** Streamline is used with manual hooking: nothing of D3D12
or DXGI is hooked globally. The host device is handed over (`slSetD3DDevice`);
the direct queue is made through Streamline's device proxy (the native queue
behind it runs everything); our swap chain is made through its factory proxy
on the queue proxy. A list that recorded an upscaling is noted; when it is
submitted, its depth and motion vectors become the latest. Each present (on
the line's thread, `VICTORY_THIN=1`) then gets a frame token of the program's
frame number, the latency markers (simulation, render submit, present), the
constants and the depth and motion-vector tags in the states the submissions
left them in (viewport 0), and frame generation is switched on; a present
without a new upscaling (menus, loads) switches it off and clears the tags.
Reflex low latency is on (frame generation needs it); `slReflexSleep` is not
called. On Series S, whose interface is a second plane, the scene plane is the
colour without the interface and the interface plane its colour and alpha
(premultiplied, as our composer blends them).
**The colour without the interface on a single plane.** Where a program blends its interface over the frame
itself (one draw into the texture it presents, after the scene's composite), that draw is found by role
(`interface_composite`) and, with frame generation, the target is copied into a texture of ours just in front of
it (`crate::streamline::before_target_draw`, called by `draw::State::draw`; two textures in turn, the back
buffer's size and format), recorded into the program's list at that place. When the list is submitted the copy is
noted, and the present of that texture tags the first copy submitted since its last present as
`kBufferTypeHUDLessColor`. Other pipelines that draw into a presented texture are named in the log once each: an
interface element drawn there before the composite would be in the copy, one drawn after it is warped as before.
**The camera's planes.** A program with inverted depth may name the far plane first, which FidelityFX takes in
either order. Frame generation's constants get them in order (near before far), and the projection made of them;
DLSS Super Resolution's are as given.
**Windowed and full screen.** With frame generation the system's Alt+Enter is
not taken for the window (`DXGI_MWA_NO_ALT_ENTER`): Streamline wants frame
generation off across such a change. When the presented size or format
changes, frame generation is switched off before the swap chain's buffers are
made again, and on again at the next present with an upscaling.
**Frame generation alone** (`VICTORY_FRAMEGEN=1` without `VICTORY_DLSS=1`)
leaves the upscaling to the program's own FidelityFX, which may be made only for the sizes it ships with: at
other output sizes its upscaler is not made (an error in the log says so) and the program can fail at its first
upscaling. Use both switches there.
## Log lines
At start: `Streamline: DLSS Super Resolution is supported on this GPU`
(requirements), `Streamline loaded (manual hooking, no downloads)`, the `display`
line with `through the program's FidelityFX path`. At the device: `Streamline: DLSS
Super Resolution loaded streamline=… ngx=…` (and frame generation, Reflex),
`the direct queue was made through the device proxy`, `our swap chain is
Streamline's proxy`. At the program: `FidelityFX: the program's import goes through
ours`, `FidelityFX: the program made its upscaler` (flags, sizes), `FidelityFX:
the program's first upscale dispatch` (every field), `DLSS: upscaling recorded in
place of the program's FidelityFX` (render and output sizes, DLSS mode, optimal
size, formats; again when they change). Every second: `DLSS per frame: …
upscalings by DLSS, … failed, … left to the program's FidelityFX` and `DLSS Frame
Generation: … presents with it on, … off, … frames shown by it (status …)`.
`FidelityFX: the program's own upscaling runs: <why>` names each reason once.
Frame generation: `DLSS Frame Generation switched frame=… on=… code=…` at each
change; `DLSS Frame Generation: first frame with depth and motion vectors
tagged` (sizes, the states of the two textures, near, far, jitter,
motion-vector scale, `interface_plane`, `interface_free_copy`); `video memory
as the system counts it, right before the first present with frame generation
on` and `… 240 presents with frame generation on later`; `DLSS Frame
Generation status changed` (anything but 0 is a fault); `DLSS Frame Generation:
a present failed hresult=…`. Series X: `DLSS Frame Generation: the colour
without the interface is copied in front of the program's interface composite
(first time)` (size, format, pipeline), `DLSS Frame Generation: this pipeline
draws into the texture the program presents` (once per pipeline), and every ten
frame-rate lines `DLSS Frame Generation, colour without the interface, last ten
lines: … copies in front of the program's interface composite, … presents tagged
with one, … presents with frame generation on had none; … interface composite
draws into a presented texture (… after a copy in their list), … draws of other
pipelines into one`.
## The first run with frame generation in the program
Switches: `VICTORY_DLSS=1 VICTORY_DLSS_MODE=quality VICTORY_FRAMEGEN=1
VICTORY_THIN=1 VICTORY_NATIVE_1440P=1`, Series X (the launcher: `-FrameGen`).
Before it, once: `victory upscaler-check --present` (below, line 1).
1. Without the program: `frame generation: 180 presents, 180 with it on, 360
frames shown by it, 180 presents tagged with a colour without the
interface, status 0x0`, then `Streamline shut down: ok (0)`, exit code 0.
(Fewer than 360 shown, 291 in one run of 2026-11-27, when the PC is busy:
frame generation drops a generated frame that comes too late.)
2. It started: `Streamline loaded … dlss=true framegen=true`, `Streamline: DLSS
Frame Generation loaded`, `Streamline: Reflex low latency on … code=0`,
`the direct queue was made through the device proxy`, `our swap chain is
Streamline's proxy`. `frame generation stays off` or `not running (see
above)` anywhere: it does not run; the line before says why.
3. It switched on in the world: `DLSS Frame Generation switched … on=true
code=0` at the first frame with an upscaling, then `first frame with depth
and motion vectors tagged` with the near and far planes in order, `depth_inverted`,
`interface_free_copy=true`.
4. Generated frames are shown: each second `DLSS Frame Generation: N presents
with it on, 0 off, 2N frames shown by it (status 0x0)`. `frames shown`
equal to `presents`: none was generated. Our caption and frame-rate line
count the program's frames only; NVIDIA's overlay or PresentMon shows twice
that. (`DLSSG_IndicatorText`, a DWORD of 2 under
`HKLM\SOFTWARE\NVIDIA Corporation\Global\NGXCore`, makes frame generation
write its state on the picture.)
5. No fault: no `DLSS Frame Generation status changed`, no `a present failed`,
no line of target `streamline` at ERROR, no `presentCommon() was not
observed`. A pink tint over the picture is frame generation's own sign of
an invalid state.
6. Off and on: at the pause menu, a load or a video, `DLSS Frame Generation
switched … on=false` when the program stops upscaling and `on=true` when it
upscales again; the per-second line then counts presents `off`. If the
pause menu keeps upscaling, frame generation stays on behind it.
7. The interface: the ten-second line has as many `copies` as `presents tagged
with one`, about one per present with frame generation on, and `had none`
near 0 in gameplay; still interface elements stay still and
sharp while the camera turns. `this pipeline draws into the texture the
program presents` should name one pipeline, the scene's composite (blend
false); any other with `blend true` is an interface element drawn outside
the interface target. Compare with `VICTORY_FRAMEGEN_HUDLESS=0`: the
interface wobbles at the edges of moving things behind it.
8. Motion vectors (`VICTORY_DLSS_MV`, default `1,1`): turn the camera slowly
and evenly past upright edges (poles, door frames) and look at a still
interface element's neighbourhood and at the edges. Right: edges stay
single in every frame. Wrong sign or scale: every other frame shows the
edge doubled or pulled the wrong way (a judder at half the shown rate), and
DLSS itself smears a trail behind moving edges. Try `-1,1` (x flipped; turn
left and right), `1,-1` (y flipped; look up and down), then `2,2` and
`0.5,0.5` (scale): if `1,1` is right, each of them is visibly worse. The
`DLSS: upscaling recorded` line has `mvec_scale` (one over the render size when
the program's vectors are in render pixels).
9. Jitter (`VICTORY_DLSS_JITTER`, default `1,1`): stand still and look at fine
detail (wire, lettering on signs, distant railings). Right: it settles
within a second to a sharp, steady picture. Wrong sign: it stays soft and
crawls. Try `-1,1`, `1,-1`, `-1,-1`; take the sharpest steady one. The
jitter changes nothing for frame generation itself.
10. Video memory: the two `video memory … frame generation on` lines; the
difference of `in use` is what frame generation took (NVIDIA: about 489 MB
at 1440p). `in use` over the budget of the card's own memory, or the PC's
shared memory growing by hundreds of MB in the memory line, means it does
not fit: use a smaller DLSS mode.
11. A removed device: `host GPU device removed after …`, `; device removed:
…`, `DLSS Frame Generation: a present failed hresult=0x887a0005` (removed),
`0x887a0006` (hung) or `0x887a0007` (reset), the window gone with exit code
0x887a0005. With `VICTORY_STREAMLINE_LOG=<folder>` Streamline's own log has
the plugin's last words.
## Limits
- Motion vectors: blocks of wrong motion inside character silhouettes (likely
a pass of the program's) show as smearing with DLSS and as
warped shapes in generated frames.
- The colour without the interface on a single plane is a copy in front of one
draw found by role (`interface_composite`). Interface drawn into the frame by another
pipeline is not told apart. The interface's own colour and alpha are not
tagged there.
- Camera matrices are made, not the program's (see above).
- "presentCommon() was not observed" (Streamline, once a run, with DLSS and no
frame generation): our swap chain is not Streamline's then, so its common
plugin sees no present; it frees nothing it retired (what DLSS let go of when
the program's upscaler is destroyed stays allocated until the process ends).
`VICTORY_STREAMLINE_PRESENT=1` gives it the presents.
- HDR output (a 16-bit float swap chain) is not supported by frame generation
(status 4).
- Video memory: the program's FidelityFX context stays allocated beside DLSS's;
frame generation needs about 0.5 GB more at 1440p.
- Latency: frame generation holds a frame back; it is meant for a base frame
rate of 60 and up.
- `slShutdown` is not called in the program; the process ends with the program.
Where the program leaves through the C runtime's exit with frame generation
on, the process may fail fast at its very end as the check did without its
shutdown (exit code 0xC0000409): no fault of the run before it.
Credits: the FidelityFX description layouts and the image patch of the
FidelityFX path are DexNom's (DexNom/VIctory, GPL-3.0-or-later).