Skip to content

AMD FSR 4 on Vulkan: FSR SDK 2.4's runtime, FSR 4.1 where it runs, FSR 3.1 elsewhere, and an FSR version row - #138

Closed
RootChad wants to merge 1 commit into
mainfrom
fsr4
Closed

RootChad wants to merge 1 commit into
mainfrom
fsr4

Conversation

@RootChad

Copy link
Copy Markdown
Collaborator

Why

The 0.8.0 list has FSR 4. AMD's FSR SDK 2.4.0 (28 October) brought FSR Upscaling 4.1.2 to Vulkan, at parity with DX12, and extended it to the RX 6000 series (INT8 model) beside the RX 7000 (INT8) and RX 9000 (FP8). ReLink was on the SDK 1.1.4 DLL, FSR 3.1 only.

SDK 2.x splits the runtime: a loader, amd_fidelityfx_loader_vk.dll, and effect DLLs beside it (amd_fidelityfx_upscaler_vk.dll). The device is given as a VkDeviceContext and the backend type changed, which is where other recompilations stumbled (MHGURecomp's issue 141).

What changed

  • DLLs: AMD's signed SDK 2.4.0 loader and upscaler replace amd_fidelityfx_vk.dll in releases. scripts/release_parts.py fetches them from AMD's repository by size and SHA-256 (both checked against the URLs). nx2/build.py and nx2/make_game.py put them beside the game. Their license is the SDK's MIT text, as shipped before.
  • Headers: gpu/vk/third_party/ffx_api is SDK 2.4's, include paths flattened, the Linux FFX_API_ENTRY visibility kept. Frame generation headers are not taken (not used yet).
  • vk_fsr.cpp:
    • It loads the 2.x loader first. The upscaler DLL is loaded just before it, so the vcrt fallback serves it and a failure names it.
    • Where the loader is missing, it falls back to the 1.x DLL. RX_VK_FSR_LEGACY=1 forces that path.
    • Linux keeps libamd_fidelityfx_vk.so and the 1.x backend type, unchanged.
    • It passes a VkDeviceContext and the 2.x backend type, and links ffxCreateContextDescUpscaleVersion in. SDK 2.1+ requires it: without it the runtime logged "must be attached … to access new API functions" at every creation, and FSR 4 came out a shade lighter.
    • It lists the versions available on this device and test-makes the default (FSR 4 where AMD's runtime offers it), plus FSR 3.1 beside it.
    • If FSR 4 cannot be made at a given size, it falls back to 3.1. FSR 4 is told at creation that the colour is gamma-encoded (FFX_UPSCALE_ENABLE_NON_LINEAR_COLORSPACE). FSR 3.1 gets what it got before.
  • Device: VK_EXT_shader_float8 and VK_KHR_compute_shader_derivatives are enabled where the GPU has them, as AMD's sample does (FP8 network, INT8 prepass). The integer dot products are already on with the 1.3 features.
  • Insert menu:
    • A new FSR version row under Upscaling: Auto (FSR 4) or FSR 3.1, saved as fsr_version.
    • The row is fixed (no arrows) where FSR 4 is not offered, or while another upscaler draws.
    • The Upscaler row reads AMD FSR 4 / AMD FSR 4 native AA when FSR 4 runs.
    • The launcher's Display page gets the same row.
  • Idle release: a chosen FSR 4 is kept 30 s while not drawing (cutscene, menu) instead of 2 s. Its network takes 200–900 ms of CPU to recreate (FSR 3.1: ~15 ms), which caused a hitch on every return to play.

Tested (Windows, Radeon RX 6600 XT)

  • Startup log: AMD FSR: available (FSR 4.1.2, or 3.1 by the FSR version row, …; versions here: 4.1.2, 3.1.6, 2.3.4; FP8 no, compute derivatives yes; …)
  • In play, Hyrule Castle town at 67%:
    • FSR 4.1.2 and FSR 4 native AA work.
    • FSR 3.1.6 works, and the switch between them is live in the menu.
    • The game's own upscaler still works.
    • No GPU errors.
  • After the API-version fix, FSR 4's mean brightness matches FSR 3.1 (131.3 vs 130.7; 132.9 before the fix). Edges are slightly sharper (12.33 vs 12.06).
  • The SDK 1.x DLL alone (RX_VK_FSR_LEGACY=1) still gives FSR 3.1.4.
  • nx2/test_vk_linux_presentation.py and nx2/test_nup_listing.py pass. A full make_game.py --update succeeded (0 failed).

Not tested

  • Linux: no Linux toolchain here. By reading, its path is unchanged: same library, same 1.x backend type, new code inside the Windows block.
  • NVIDIA / Intel: AMD's runtime returns no FSR 4 provider there, according to other projects' reports, so FSR 3.1 with the row fixed.

Notes

  • Switching the Upscaler row to FSR 4 native AA makes the upscaler twice in a row, a ~1 s hitch, only at the moment the row changes. This already happened with 3.1, where it was cheap.
  • vk: honor FSR input and camera contracts #113 (FSR input and camera contracts, linear colour) touches the same files. If it lands, FSR receives linear colour and FSR_PERCEPTUAL should be dropped from make_fsr's flags.
  • AMD frame generation (FSR FG 4.0 on RX 9000, 3.1.7 elsewhere) uses its own swapchain. It is left for a separate PR, given ReLink's own frame generation and present thread.

🤖 Generated with Claude Code

…, FSR 3.1 elsewhere, and an FSR version row

- AMD's signed FSR SDK 2.4.0 DLLs replace the SDK 1.1.4 one: the loader amd_fidelityfx_loader_vk.dll and its upscaler
  amd_fidelityfx_upscaler_vk.dll (FSR Upscaling 4.1.2 on Vulkan, FP8 on the RX 9000 series, INT8 on the RX 6000 and 7000;
  FSR 3.1.6 on any GPU). release_parts.py fetches them from AMD's repository by size and SHA-256 (checked); build.py and
  make_game.py put them beside the game. The old amd_fidelityfx_vk.dll still loads where the loader is not there
  (RX_VK_FSR_LEGACY=1 forces it), and Linux keeps libamd_fidelityfx_vk.so with the 1.x backend type, as before.
- The API headers are SDK 2.4's (MIT), their include paths flattened, the Linux entry-point visibility kept.
- vk_fsr.cpp: the device given as a VkDeviceContext and the 2.x backend type; the upscaler DLL loaded before the loader
  (the vcrt fallback serves it, and a failure is named); ffxCreateContextDescUpscaleVersion linked in (SDK 2.1+: without
  it the runtime kept to its older API, said so in the log at every creation, and FSR 4 read the colour a shade lighter);
  the versions listed for this device, the default's test upscaler and FSR 3.1's beside it; an FSR 4 that cannot be made
  at a size falls back to 3.1. FSR 4 is told at its creation that the colour is gamma-encoded.
- The device turns on VK_EXT_shader_float8 and VK_KHR_compute_shader_derivatives where the GPU has them (FSR 4's FP8
  network and INT8 prepass, as AMD's sample enables them).
- Insert menu: an FSR version row under Upscaling (Auto: FSR 4 where AMD's runtime makes it here; FSR 3.1), saved as
  fsr_version; the Upscaler says AMD FSR 4 when FSR 4 runs. The launcher's Display page has the same row.
- A chosen FSR 4 is kept 30 s while not drawing (a cutscene, a menu) instead of 2 s: its network took 200 to 900 ms of CPU
  to make again, a hitch on every return to play.

Tested on an RX 6600 XT (driver 26.x): FSR 4.1.2 and its native AA, FSR 3.1.6, the game's own upscaler, the switch between
them in play, and the SDK 1.x DLL alone. Not tested: Linux, NVIDIA and Intel GPUs (AMD's runtime lists no FSR 4 there).

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

pixl27 commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Merged into 0.7.9.3 (https://github.com/pixl27/ProjectReLink/releases/tag/v0.7.9.3), through the hotfix branch rather than this pull request, with your authorship kept in the commit (Co-authored-by). Thank you, RootChad.

@pixl27 pixl27 closed this Nov 22, 2026
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.

2 participants