feat(build): --build-fsr-linux makes a native FSR 4 library on the player's PC from AMD's DLL, with fsr4up-vk #2507

Open
roblesleo wants to merge 1 commit from roblesleo/Longshot:fsr4-linux-build into main
Contributor

Summary

AMD publishes FSR 4's Vulkan runtime as a Windows DLL only, so a Linux game folder has FSR 4 only if the player finds an amd_fidelityfx_upscaler_vk.so to put beside the game. With --fsr --build-fsr-linux --accept-amd-license the builder makes one on the player's PC (nx2/fsr4_linux.py), off unless asked:

  1. AMD's amd_fidelityfx_upscaler_vk.dll and license from AMD's repository, at the existing FSR pin: the file a Windows build already fetches.
  2. fsr4up-vk's sources at one commit, 13 files, each by its SHA-256 (scripts/fetch.py, FSR4UP). It is an independent MIT implementation of FSR 4.1.2's API for Linux.
  3. Its tools/setup.py, which reads AMD's SPIR-V shaders and network data out of the DLL as data.
  4. One compile and link with the builder's own clang++, sysroot and Vulkan headers. No CMake, nothing to install: it works in the AppImage on SteamOS.
  5. The library, a stamp, fsr4up-vk's license and notices and AMD's license into the game folder.

A library the player put there is never replaced, and a stamped one is built again only when fsr4up-vk's commit, the DLL or the compiler changed.

Why built there and not shipped. The library carries AMD's shaders and data. Nothing made from AMD's file is in this repository, in a release or in a download: it exists only on the PC that built it.

Why I think it may be built at all, and what I would like you to check. scripts/fetch.py describes AMD's license as binary-only with no reverse engineering. That is how the license file opens, "for all files except as noted below". But the list that follows, which ends "are subject to the following license" (MIT), includes Kits\FidelityFX\signedbin\amd_fidelityfx_upscaler_vk.dll (line 658 of LICENSE-AMD-FSR-SDK.md). On that reading the DLL is under the MIT terms. The list is headed "These source files" and still names DLLs, so AMD may not have meant it. I am not a lawyer: if you read it the other way, close this and I will not argue. The builder shows what it is about to do and stops without --accept-amd-license either way.

Third-party risk. fsr4up-vk is one person's project, published 2026-11-16. That is why every file is pinned by SHA-256 and only the 13 files the build reads are fetched.

The launcher's tick box for this is not here: that is LongshotLauncher's, after this one.

Read first: nx2/fsr4_linux.py, then build_fsr_linux and place_fsr_linux in nx2/make_game.py.

Testing

Tested: SteamOS, Legion Go (Ryzen Z1 Extreme, Radeon 780M, RADV Mesa 26.2.0-devel), nightly-801's builder unpacked with this branch's files, a new game folder with --fsr --build-fsr-linux --accept-amd-license.

  • The notice is printed, the 3 AMD files and 13 fsr4up-vk files are fetched, the asset step and the compile run with the builder's clang 23.1.5, and the folder gets amd_fidelityfx_upscaler_vk.so (69 MB), .longshot_fsr4up, LICENSE-AMD-FSR-SDK.md, LICENSE-FSR4UP-VK.txt and THIRD-PARTY-FSR4UP-VK.md. The library links only libc and libm.

  • In the game: upscalers 4.1.2 (fsr4up-vk); using 4.1.2, FSR 4.1.2 (fsr4up-vk) made for outputs of 1382x864, AMD FSR 4 draws OoT's upscale: 1286x804 -> 1382x864, 3 minutes in Castle Town, no error.

  • tests/test_fsr4_linux.py (new, 9 cases, no compiler or network): the two commands, the pin table against them, what makes a rebuild, what is installed, the player's own library left alone. Passes. test_ffx_sdk.py, test_xess_sdk.py, test_ngx_sdk.py, test_make_game_ngx.py, test_appimage_scripts.py pass.

  • The asset step also run on Windows with the pinned files: 1011 modules, 68.9 MB.

  • The whole suite on my Windows PC, python -I -B tests/run_all.py --jobs 6 (not --strict: this PC lacks the Vulkan and SPIR-V headers and spirv-val, so 137 checks are skipped): 817 passed, 27 failed. The 26 checks that fail are the same 26, by name, that fail on main @ 9046a8d7 here, none of them one this change touches: test_auto_handheld, test_bug_report, test_build_long_paths, test_cmpflags, test_crash_dialog, test_dev_ab, test_dev_build, test_dev_migrate, test_discover, test_fastfp_fma, test_fma_soft, test_fpx_sticky, test_fpxkeep, test_game_menu_mouse_buttons, test_input_movie, test_lift_lookups, test_linux_preflight, test_make_game_cache, test_pads_after_menu, test_perf_report, test_sdiv_overflow, test_spawn_emit, test_vbytes, test_vecfp, test_vfpx_elem, test_walk. The 27th, test_stack_commit, failed once in that run with Windows is out of memory and passes alone, three times in a row.

  • On the same Legion Go, the test folder: --update --build-fsr-linux without --accept-amd-license stops with needs AMD's license accepted first, exit 1, nothing downloaded; with the license and nothing changed, not made again and the file is byte-identical; --update without the option leaves the library and its license files as they are; a file of the player's own under that name is left as it is.

Still to test:

  • The released AppImage itself, not an unpacked copy (CI or by hand).
  • A Linux PC that is not SteamOS, and an NVIDIA or Intel GPU (the Test Farm, or by hand).

Measurements

Nothing to compare against main: FSR 4 does not run on Linux there without a library. For scale, same scene on the 780M, performance profile, one run each: FSR 3.1 31 fps (GPU 24.9 ms a frame), FSR 4.1.2 from this library 32.7 fps (22.2 ms; nightly-801 for FSR 3.1, so not the same build).

Risks

Off unless asked. It downloads and compiles third-party code on the player's PC: pinned by commit and SHA-256. A failed download or compile stops the build before the game is compiled, with a line saying to build again without the flag. After updating, a player who did not ask sees nothing new. To remove it: delete the .so and .longshot_fsr4up from the game folder.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A check under tests/ that reads changed source is updated, not weakened.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
## Summary AMD publishes FSR 4's Vulkan runtime as a Windows DLL only, so a Linux game folder has FSR 4 only if the player finds an `amd_fidelityfx_upscaler_vk.so` to put beside the game. With `--fsr --build-fsr-linux --accept-amd-license` the builder makes one on the player's PC (`nx2/fsr4_linux.py`), off unless asked: 1. AMD's `amd_fidelityfx_upscaler_vk.dll` and license from AMD's repository, at the existing `FSR` pin: the file a Windows build already fetches. 2. [fsr4up-vk](https://github.com/auz466/fsr4up-vk)'s sources at one commit, 13 files, each by its SHA-256 (`scripts/fetch.py`, `FSR4UP`). It is an independent MIT implementation of FSR 4.1.2's API for Linux. 3. Its `tools/setup.py`, which reads AMD's SPIR-V shaders and network data out of the DLL as data. 4. One compile and link with the builder's own clang++, sysroot and Vulkan headers. No CMake, nothing to install: it works in the AppImage on SteamOS. 5. The library, a stamp, fsr4up-vk's license and notices and AMD's license into the game folder. A library the player put there is never replaced, and a stamped one is built again only when fsr4up-vk's commit, the DLL or the compiler changed. **Why built there and not shipped.** The library carries AMD's shaders and data. Nothing made from AMD's file is in this repository, in a release or in a download: it exists only on the PC that built it. **Why I think it may be built at all, and what I would like you to check.** `scripts/fetch.py` describes AMD's license as binary-only with no reverse engineering. That is how the license file opens, "for all files except as noted below". But the list that follows, which ends "are subject to the following license" (MIT), includes `Kits\FidelityFX\signedbin\amd_fidelityfx_upscaler_vk.dll` (line 658 of `LICENSE-AMD-FSR-SDK.md`). On that reading the DLL is under the MIT terms. The list is headed "These source files" and still names DLLs, so AMD may not have meant it. I am not a lawyer: if you read it the other way, close this and I will not argue. The builder shows what it is about to do and stops without `--accept-amd-license` either way. **Third-party risk.** fsr4up-vk is one person's project, published 2026-11-16. That is why every file is pinned by SHA-256 and only the 13 files the build reads are fetched. The launcher's tick box for this is not here: that is LongshotLauncher's, after this one. Read first: `nx2/fsr4_linux.py`, then `build_fsr_linux` and `place_fsr_linux` in `nx2/make_game.py`. ## Testing **Tested:** SteamOS, Legion Go (Ryzen Z1 Extreme, Radeon 780M, RADV Mesa 26.2.0-devel), nightly-801's builder unpacked with this branch's files, a new game folder with `--fsr --build-fsr-linux --accept-amd-license`. - The notice is printed, the 3 AMD files and 13 fsr4up-vk files are fetched, the asset step and the compile run with the builder's clang 23.1.5, and the folder gets `amd_fidelityfx_upscaler_vk.so` (69 MB), `.longshot_fsr4up`, `LICENSE-AMD-FSR-SDK.md`, `LICENSE-FSR4UP-VK.txt` and `THIRD-PARTY-FSR4UP-VK.md`. The library links only libc and libm. - In the game: `upscalers 4.1.2 (fsr4up-vk); using 4.1.2`, `FSR 4.1.2 (fsr4up-vk) made for outputs of 1382x864`, `AMD FSR 4 draws OoT's upscale: 1286x804 -> 1382x864`, 3 minutes in Castle Town, no error. - `tests/test_fsr4_linux.py` (new, 9 cases, no compiler or network): the two commands, the pin table against them, what makes a rebuild, what is installed, the player's own library left alone. Passes. `test_ffx_sdk.py`, `test_xess_sdk.py`, `test_ngx_sdk.py`, `test_make_game_ngx.py`, `test_appimage_scripts.py` pass. - The asset step also run on Windows with the pinned files: 1011 modules, 68.9 MB. - The whole suite on my Windows PC, `python -I -B tests/run_all.py --jobs 6` (not `--strict`: this PC lacks the Vulkan and SPIR-V headers and spirv-val, so 137 checks are skipped): 817 passed, 27 failed. The 26 checks that fail are the same 26, by name, that fail on `main` @ 9046a8d7 here, none of them one this change touches: `test_auto_handheld`, `test_bug_report`, `test_build_long_paths`, `test_cmpflags`, `test_crash_dialog`, `test_dev_ab`, `test_dev_build`, `test_dev_migrate`, `test_discover`, `test_fastfp_fma`, `test_fma_soft`, `test_fpx_sticky`, `test_fpxkeep`, `test_game_menu_mouse_buttons`, `test_input_movie`, `test_lift_lookups`, `test_linux_preflight`, `test_make_game_cache`, `test_pads_after_menu`, `test_perf_report`, `test_sdiv_overflow`, `test_spawn_emit`, `test_vbytes`, `test_vecfp`, `test_vfpx_elem`, `test_walk`. The 27th, `test_stack_commit`, failed once in that run with `Windows is out of memory` and passes alone, three times in a row. - On the same Legion Go, the test folder: `--update --build-fsr-linux` without `--accept-amd-license` stops with `needs AMD's license accepted first`, exit 1, nothing downloaded; with the license and nothing changed, `not made again` and the file is byte-identical; `--update` without the option leaves the library and its license files as they are; a file of the player's own under that name is `left as it is`. **Still to test:** - The released AppImage itself, not an unpacked copy (CI or by hand). - A Linux PC that is not SteamOS, and an NVIDIA or Intel GPU (the Test Farm, or by hand). ## Measurements Nothing to compare against `main`: FSR 4 does not run on Linux there without a library. For scale, same scene on the 780M, performance profile, one run each: FSR 3.1 31 fps (GPU 24.9 ms a frame), FSR 4.1.2 from this library 32.7 fps (22.2 ms; nightly-801 for FSR 3.1, so not the same build). ## Risks Off unless asked. It downloads and compiles third-party code on the player's PC: pinned by commit and SHA-256. A failed download or compile stops the build before the game is compiled, with a line saying to build again without the flag. After updating, a player who did not ask sees nothing new. To remove it: delete the `.so` and `.longshot_fsr4up` from the game folder. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers.
feat(build): --build-fsr-linux makes a native FSR 4 library on the player's PC from AMD's DLL, with fsr4up-vk
Some checks are pending
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website builds (pull_request) Blocked by required conditions
Website / Website preview, build (pull_request) Blocked by required conditions
Website / Website preview, upload (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
9326f7edee
AMD publishes FSR 4's Vulkan runtime as a Windows DLL only, so a Linux game
folder has FSR 4 only if the player finds an amd_fidelityfx_upscaler_vk.so
to put beside the game. With --fsr --build-fsr-linux --accept-amd-license
the builder makes one on the PC: AMD's DLL from AMD's repository at the
FSR pin, fsr4up-vk's sources at one commit with each file's SHA-256
(scripts/fetch.py FSR4UP), fsr4up-vk's own asset step over the DLL, then
one compile and link with the builder's clang++, sysroot and Vulkan
headers. The library, its stamp, fsr4up-vk's license and notices and AMD's
license go into the game folder. Off unless asked; a library the player
put there is never replaced.

Nothing made from AMD's file is in the repository or a download: the
library carries AMD's shaders and network data and exists only on the PC
that built it. AMD's FSR SDK license lists the DLL among its MIT-licensed
files (docs/license.md); the builder shows what it is about to do and
stops without --accept-amd-license.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Member

Possibly related, for context:

  • PR #2506 WIP: feat(vk): the FSR 4 model row on Linux, with fsr4up-vk's library — Companion game-side support for this fsr4up-vk Linux library; coordinate the build/install and runtime changes.
  • PR #2488 feat(recomplauncher): AMD FSR 4 ticks for the setup step, on Windows and Linux — Open launcher setup work adds the Linux FSR option and optional library placement, overlapping this build workflow.
  • PR #824 docs(steamos): document fsr4-vk build with distrobox — Open SteamOS documentation for building an FSR4 Vulkan library; check whether the new player-PC build supersedes or complements it.
  • PR #174 fix(linux): a Linux build with AMD FSR 4 compiles its own Vulkan back end, from AMD's FSR API headers the AppImage now carries — Merged Linux FSR4 build-backend support is the prerequisite that lets an FSR-enabled game use a supplied library.
  • PR #2402 feat(devtools): packs build with the upscalers the environment names (FSR 4, AMD's and Intel's runtimes) — Merged build-option mapping provides precedent for passing FSR choices through build tooling.
Possibly related, for context: - PR #2506 WIP: feat(vk): the FSR 4 model row on Linux, with fsr4up-vk's library — Companion game-side support for this fsr4up-vk Linux library; coordinate the build/install and runtime changes. - PR #2488 feat(recomplauncher): AMD FSR 4 ticks for the setup step, on Windows and Linux — Open launcher setup work adds the Linux FSR option and optional library placement, overlapping this build workflow. - PR #824 docs(steamos): document fsr4-vk build with distrobox — Open SteamOS documentation for building an FSR4 Vulkan library; check whether the new player-PC build supersedes or complements it. - PR #174 fix(linux): a Linux build with AMD FSR 4 compiles its own Vulkan back end, from AMD's FSR API headers the AppImage now carries — Merged Linux FSR4 build-backend support is the prerequisite that lets an FSR-enabled game use a supplied library. - PR #2402 feat(devtools): packs build with the upscalers the environment names (FSR 4, AMD's and Intel's runtimes) — Merged build-option mapping provides precedent for passing FSR choices through build tooling.
Author
Contributor

Checks on my Windows PC: python -I -B tests/run_all.py --changed against current main: 76 passed, 5 failed, 6 skipped.

The 5 failures are the same on main without this branch, with the same messages: test_dev_build.py, test_build_long_paths.py, test_make_game_cache.py, test_linux_preflight.py, test_crash_dialog.py. They look like Windows-on-my-PC failures (POSIX paths, long paths), not this change. Not the full mise run test and not --strict, so WIP stays in the title until CI has run.

More of "Still to test", run on the same Legion Go (SteamOS), on the test folder:

  • --update --build-fsr-linux without --accept-amd-license: stops with AMD FSR 4 for Linux needs AMD's license accepted first, exit 1, nothing downloaded.
  • --update --build-fsr-linux --accept-amd-license with nothing changed: the library the last build made from the same files: not made again; the file in the folder is byte-identical.
  • --update without the option: no mention of it, the library and its three license files stay, same bytes.
  • A file of the player's own under that name (no stamp), then --update with the option: amd_fidelityfx_upscaler_vk.so in ... is not this builder's: left as it is; the player's file is untouched.

On #2488: its Linux tick builds with --fsr and lets the player pick a .so they already have. This option is what would make that .so; wiring the tick to it (with AMD's license shown, as on Windows) could follow once both are in. Both leave a file already in the folder alone.

Checks on my Windows PC: `python -I -B tests/run_all.py --changed` against current `main`: 76 passed, 5 failed, 6 skipped. The 5 failures are the same on `main` without this branch, with the same messages: `test_dev_build.py`, `test_build_long_paths.py`, `test_make_game_cache.py`, `test_linux_preflight.py`, `test_crash_dialog.py`. They look like Windows-on-my-PC failures (POSIX paths, long paths), not this change. Not the full `mise run test` and not `--strict`, so WIP stays in the title until CI has run. More of "Still to test", run on the same Legion Go (SteamOS), on the test folder: - `--update --build-fsr-linux` without `--accept-amd-license`: stops with `AMD FSR 4 for Linux needs AMD's license accepted first`, exit 1, nothing downloaded. - `--update --build-fsr-linux --accept-amd-license` with nothing changed: `the library the last build made from the same files: not made again`; the file in the folder is byte-identical. - `--update` without the option: no mention of it, the library and its three license files stay, same bytes. - A file of the player's own under that name (no stamp), then `--update` with the option: `amd_fidelityfx_upscaler_vk.so in ... is not this builder's: left as it is`; the player's file is untouched. On #2488: its Linux tick builds with `--fsr` and lets the player pick a `.so` they already have. This option is what would make that `.so`; wiring the tick to it (with AMD's license shown, as on Windows) could follow once both are in. Both leave a file already in the folder alone.
roblesleo changed title from WIP: feat(build): --build-fsr-linux makes a native FSR 4 library on the player's PC from AMD's DLL, with fsr4up-vk to feat(build): --build-fsr-linux makes a native FSR 4 library on the player's PC from AMD's DLL, with fsr4up-vk 2026-11-25 13:12:43 +00:00
Some checks are pending
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website builds (pull_request) Blocked by required conditions
Website / Website preview, build (pull_request) Blocked by required conditions
Website / Website preview, upload (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
This pull request has changes conflicting with the target branch.
  • assets/fsr4_linux.py
  • docs/dev/reference/upscalers.md
  • nx2/make_game.py
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fsr4-linux-build:roblesleo-fsr4-linux-build'
git switch 'roblesleo-fsr4-linux-build'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
MagicBeanDev/Longshot!2507
No description provided.