#1600: FSR 4 upscaling and frame generation on AMD GPUs #1605

Closed
TheSlowly wants to merge 0 commits from TheSlowly/Slipstream:fsr4-1600 into main
Collaborator

Fixes #1600: FSR 4.1.2 (ML) upscaling and FSR 4.0.2 frame generation through AMD's FSR SDK 2.4 runtime, with our own FSR 3.1 everywhere else.

  • The build downloads AMD's signed Vulkan DLLs from the SDK's v2.4.0 commit (SHA256-pinned, cached) and ships them in the Windows package, like the OpenXR loader. MIT notice added.
  • Upscaling: on AMD GPUs that the runtime offers FSR 4 for (Windows, RX 6000+), the FSR upscaler feeds our inputs pass to FSR 4 instead of 3.1's passes. Live desktop view only; snapshots, offscreen and VR keep 3.1. A refusal falls back to 3.1 in the same frame. RenderVKUpscalerFsr4 (A/B, not saved) compares.
  • Frame generation: dispatched by hand into our own present chain (no SDK swapchain). Behind RenderVKFrameGenFsr4, off and not saved, because nobody has an RX 9000 to test it. That bends the guide's rule on experiment settings on purpose; the switch goes or becomes the default once it's tested.
  • The device enables FSR 4's shader features (fp16/int8/cooperative matrix/...) on AMD + Windows + Vulkan 1.3 only, with its own retry; FSR 4 only runs on a device that has them.

Tested: builds; on NVIDIA the DLLs load, the runtime offers only 3.1.6/2.3.4 and FSR falls back to 3.1. Not yet run on AMD. Please try FSR Quality on the 7900 XTX: the log should say "FSR 4 upscaler made". Worth running once with validation layers: AMD's DLLs are closed, so their barriers and view lifetimes (3 present slots) are unverified.

Fixes #1600: FSR 4.1.2 (ML) upscaling and FSR 4.0.2 frame generation through AMD's FSR SDK 2.4 runtime, with our own FSR 3.1 everywhere else. - The build downloads AMD's signed Vulkan DLLs from the SDK's v2.4.0 commit (SHA256-pinned, cached) and ships them in the Windows package, like the OpenXR loader. MIT notice added. - Upscaling: on AMD GPUs that the runtime offers FSR 4 for (Windows, RX 6000+), the FSR upscaler feeds our inputs pass to FSR 4 instead of 3.1's passes. Live desktop view only; snapshots, offscreen and VR keep 3.1. A refusal falls back to 3.1 in the same frame. RenderVKUpscalerFsr4 (A/B, not saved) compares. - Frame generation: dispatched by hand into our own present chain (no SDK swapchain). Behind RenderVKFrameGenFsr4, off and not saved, because nobody has an RX 9000 to test it. That bends the guide's rule on experiment settings on purpose; the switch goes or becomes the default once it's tested. - The device enables FSR 4's shader features (fp16/int8/cooperative matrix/...) on AMD + Windows + Vulkan 1.3 only, with its own retry; FSR 4 only runs on a device that has them. Tested: builds; on NVIDIA the DLLs load, the runtime offers only 3.1.6/2.3.4 and FSR falls back to 3.1. Not yet run on AMD. Please try FSR Quality on the 7900 XTX: the log should say "FSR 4 upscaler made". Worth running once with validation layers: AMD's DLLs are closed, so their barriers and view lifetimes (3 present slots) are unverified.
FSR 4 upscaling and frame generation exist only as AMD's signed DLLs (the loader plus
one DLL per effect, about 72 MB together), so they are not committed. The build downloads
them from the SDK's v2.4.0 commit, checks each file's SHA256, keeps them in the 3p cache
for offline rebuilds and stages them beside the viewer, as the OpenXR loader is. The SDK's
API headers are vendored unmodified, and the MIT notice AMD applies to the DLLs is added to
the Windows licences.

Nothing loads them yet; the runtime code follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FSR upscaling (RenderVKUpscaler 1-6) now uses AMD's FSR 4.1.2 ML upscaler where the FSR SDK
runtime offers it: Windows, Radeon RX 6000 and newer, a recent Adrenalin driver. It is fed by
the same inputs pass as our FSR 3.1 (motion, depth, reactive mask, transparency, exposure)
and replaces the rest of it. Everywhere else, and for snapshots, offscreen renders and VR,
our own FSR 3.1 runs as before; the SDK's 3.1 versions are never used.

The runtime is loaded at run time (llcleanffxvk.cpp, the only file that sees the SDK's
headers: its Vulkan header declares a VkDeviceContext of its own). FSR 3.1 stays made beside
FSR 4, so a refused context or dispatch upscales that same frame with 3.1, and FSR 4 is not
tried again until the sizes change. The log says which one runs and why.

RenderVKUpscalerFsr4 (A/B, not saved) turns FSR 4 off to compare on the same GPU.

Test-Plan: On an RX 6000 / 7000 / 9000 card with Adrenalin 26.10.1 or later, set FSR
    Quality: the log shows "FSR 4 upscaler made: ..." and the image is sharper and steadier
    than with RenderVKUpscalerFsr4 0 (FSR 3.1), with no ghosting on moving avatars. Resize the
    window and change the FSR mode: still FSR 4. Take a snapshot: it still works (FSR 3.1).
    On NVIDIA / Intel / Linux: "FSR 4 upscaling is not used, FSR 3.1 instead: ..." and FSR
    looks as before.
Test-Settings: RenderVKUpscaler = 2, RenderVKUpscalerFsr4 = 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the FSR generator, frame generation can use AMD's FSR Frame Generation 4.0.2 where the
FSR SDK runtime offers it: Windows 11, Radeon RX 9000 and newer, a recent Adrenalin driver.
It is dispatched by hand into our own present chain (no SDK swapchain), from the same world,
depth and motion images our FSR 3.1 frame generation reads, so pacing, HDR / SDR and the
interface layer stay ours. FSR 3.1's images stay made beside it: a refused dispatch
generates that frame with 3.1, and FSR 4 is not tried again until the sizes change.

Nobody on the team has an RX 9000 card, so this has never run. It is behind
RenderVKFrameGenFsr4, off and not saved. That bends the guide's rule that experiment
settings are settled before merging; it is deliberate, so the code can be tested once
someone has the hardware, and the switch goes (or becomes the default) after that.

Test-Plan: Only on an RX 9000 card with Windows 11 and Adrenalin 26.10.1 or later: set
    RenderVKFrameGenFsr4 on, then turn frame generation on with the FSR generator. The log
    shows "FSR 4 frame generation made: ..."; generated frames look right while turning the
    camera and walking, in SDR and HDR, with the interface steady. Anywhere else the log says
    "FSR 4 frame generation is not used, FSR 3.1 instead: ..." and frame generation works as
    before.
Test-Settings: RenderVKFrameGenFsr4 = 1, RenderVKFrameGenGenerator = 2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From an independent review of the FSR 4 commits, checked against AMD's sample and
providers:

- FSR 4's ML shaders use 16-bit floats, 8-bit integers, 16 / 8-bit storage, integer dot
  products, cooperative matrices, 8-bit floats and compute derivatives. AMD's runtime picks
  its shaders from what the GPU supports, not from what our device enabled, so on an AMD GPU
  it would have run them with those capabilities off. The device now enables each one the GPU
  has (Windows, AMD, Vulkan 1.3 only; shader capabilities, nothing else changes), with its
  own retry so the device is never lost over them, and FSR 4 runs only on a device that has
  them -- which also keeps it to AMD GPUs.
- Frame generation without AMD's swapchain needs NO_SWAPCHAIN_CONTEXT_NOTIFY, or the
  configuration is handed to a null swapchain and refused: FSR 4 frame generation could
  never have been made. It is also configured every frame with that frame's id, as AMD's
  sample does; configured once, every frame counted as a reset.
- A refused FSR 4 upscale no longer retries every frame (the refusal is checked before
  the size fit), and its fallback frame's FSR 3.1 constants are written as a reset.
- Frame generation is made for the frames' real encoding (HDR10 or SDR, from the
  swapchain) rather than guessed from the format, and made again when it changes; the
  refusal also remembers the format and encoding. The peak brightness is clamped as 3.1's.
- The runtime's message callback is locked (render and present threads).

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

Tested on NVIDIA with the final build (all four commits): FSR says "FSR 4 upscaling is not used, FSR 3.1 instead: the device was made without FSR 4's shader features" and FSR 3.1 Quality runs as before (steady frames, clean image, no warnings). FSR 3.1 frame generation also unchanged: generator FSR, 125 of 125 frames generated, 2.00 shown per rendered frame, pacing within 0.54 ms. DLSS and DLSS frame generation unaffected.

Tested on NVIDIA with the final build (all four commits): FSR says "FSR 4 upscaling is not used, FSR 3.1 instead: the device was made without FSR 4's shader features" and FSR 3.1 Quality runs as before (steady frames, clean image, no warnings). FSR 3.1 frame generation also unchanged: generator FSR, 125 of 125 frames generated, 2.00 shown per rendered frame, pacing within 0.54 ms. DLSS and DLSS frame generation unaffected.
Author
Collaborator

Merged into main in 54eb91c942; closing.

Merged into main in 54eb91c942; closing.
TheSlowly closed this pull request 2026-11-22 03:07:40 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
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
sky_line/Slipstream!1605
No description provided.