mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:15:52 +01:00
[PR #145] runtime: AMD's PC FidelityFX upscaler on the layer's Vulkan device (RT-344) #196
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#196
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/145
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9877📝 Commits (8)
c8d136druntime: AMD's PC FidelityFX upscaler on the layer's Vulkan device (RT-344)e312253ffx_vk: enable the extensions the upscaler's shaders use; the test fails on validation errors (#4999 review)be631dbffx_vk_dispatch_test: the console's 1080p configuration and a 4K casea2766d2ffx_vk: the loader's choice depends on GPU and driver, not on architecture alone8abab27docs: FSR 4.1.2 on RDNA4 under AMD's Windows driver (RX 9060 XT), and the shader errors there tooc1e976affx_vk: load the provider by full path instead of changing the process DLL search patha1cbccbMerge remote-tracking branch 'origin/main' into rt-344-ffx-vk6f014cfMerge remote-tracking branch 'origin/main' into rt-344-ffx-vk📊 Changes
6 files changed (+672 additions, -5 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+32 -0)📝
runtime/CMakeLists.txt(+11 -0)➕
runtime/src/ffx_vk_backend.cpp(+71 -0)➕
runtime/src/ffx_vk_backend.h(+70 -0)📝
runtime/test/ffx_api_min.h(+25 -5)➕
runtime/test/ffx_vk_dispatch_test.cpp(+463 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Resubmitted unchanged: this was
#4999, closed at the repository's move to the organisation (the members-only switch, 22:25–22:49 UTC) with no review comment; reopening it is refused. Same branch and head (6f014cfc1), which merges cleanly onmain7e39a81ea. The test reports from other contributors are on#4999.Item: RT-344 (claim: https://github.com/ItsNotRexed/Leonida/issues/4933#issuecomment-7093985805; finding by amarovndres: https://github.com/ItsNotRexed/Leonida/issues/4816#issuecomment-7093381681). It's the AMD counterpart of
#4801, and it touches none of#4801's files.It has run on native Windows on AMD (RDNA4 and RDNA3 with FSR 4.1.2, and an RDNA2 iGPU) and on NVIDIA, and under Wine on RDNA4 and NVIDIA; see "Tested". Parts 1 and 2 of the shim that uses this backend are
#5139and#5171.Why
The game calls the five FFX functions of the package's
amd_fidelityfx_upscaler_xbox.dll. That DLL's 29 INT8 programs would have to be translated, and it only builds one table: 1080p, Quality (docs/d3d12_vulkan.mdA.3,docs/fspx.md).AMD's public FidelityFX SDK 2.4.0 (2026-10-28) ships a signed Vulkan loader,
amd_fidelityfx_loader_vk.dll. Its release notes put the upscaler "at feature parity with DX12". So the same FFX calls can be answered on the layer's ownVkDevice, with no D3D12 device and no D3D12↔Vulkan hand-off. That hand-off is the part#4801leaves open. The loader picks the newest upscaler the GPU and driver support. Measured: FSR 4.1.2 on RDNA4 under RADV and on RDNA3 under AMD's Windows driver 26.11.2; FSR 3.1.6 on an RDNA2 iGPU and on NVIDIA (a2766d20corrects the comments, which had said RDNA4 and RDNA2 discrete only).What
runtime/src/ffx_vk_backend.{h,cpp}(about 120 lines). It:LEONIDA_FFX_DIR, or from next to the program;VkImageresources and aVkCommandBuffer;wanted_device_extensions, the device extensions the upscaler's shaders use. These are the ones AMD's own sample device enables where present:VK_KHR_compute_shader_derivatives,VK_KHR_cooperative_matrixandVK_EXT_shader_float8.runtime/test/ffx_api_min.h: adds the Vulkan backend descriptor and the provider-version query, written out from the SDK's MIT headers (ffx_api.h,vk/ffx_api_vk.h).fsr_dispatch_teststill builds.runtime/test/ffx_vk_dispatch_test.cpp:LEONIDA_VK_VALIDATION=1runs it under the Khronos validation layer, and any validation error fails it, except five named by VUID and text inknown_provider_error. Those five are in AMD's FSR 4.1.2 shaders; see the next section. A missing layer fails the run too.LEONIDA_VK_DEVICEpicks the GPU.runtime/CMakeLists.txt: the test, Windows builds only, next to the other Vulkan tools.docs/d3d12_vulkan.mdA.3: what was measured.Not in this PR, as in
#4801: the shim that routes the game's calls here and maps its resources to the layer's images.Licence
LEONIDA_FFX_DIRat the SDK'sKits/FidelityFX/signedbin.ffx_api_min.h.Validation (after whattheflop's review,
e312253b)VUID-VkShaderModuleCreateInfo-pCode-08740/08742). The test now enables the wanted extensions.VK_INSTANCE_LAYERS), since Wine's Vulkan doesn't show layers to Windows programs:vkCreateDevice-…-01387raised by Wine's own device setup.SPV_NV_cooperative_matrix2, which RADV doesn't offer on that GPU;OpFConverton cooperative-matrix types and anOpStoreto an image;rw_reprojected_color,rw_history_color,rw_mlsr_output_color) get 3-component writes on RGBA16F views (OpImageWrite-08795).These are the five
known_provider_errorentries.Tested
Built with clang-cl 23.1.5 + xwin (SDK 10.0.26100) through
runtime/cmake/clang-cl-xwin.cmake. Run withctest -R ffx_vk_dispatchunder Wine 11.22 on CachyOS (kernel 7.3.5, Mesa 26.3.1 RADV), FidelityFX SDK 2.4.0 DLLs:At
be631db9, per upscale (submit + wait); every case passes with every square right and 0 non-finite values:From reviewers:
3c05c379(#5139): RX 9060 XT (RDNA4), AMD Windows driver 26.10.1. All three wanted extensions are offered; the loader chose FSR 4.1.2: 1.27 ms to 1080p and 4.16 ms to 4K, every square right, and#5139's layer test passes too.known_provider_errorentries. So those are in AMD's shaders on AMD's driver too.be631db9: RX 7600 (RDNA3, gfx1102), AMD Windows driver 26.11.2. The loader chose FSR 4.1.2: 4.56 ms to 1080p and 16.98 ms to 4K, every square right.LEONIDA_VK_VALIDATION=1: 0 validation errors, and 10 provider errors, all the08795writesknown_provider_errorlists. So those are in AMD's shaders on AMD's own driver too.be631db9: RTX 4080, native Windows, driver 621.01. FSR 3.1.6 at both sizes, every square right, zero validation errors (Khronos 1.4.357).8af9ed0b(#5139): RTX 5070 Ti, native Windows. FSR 3.1.6, 880/880 and 1980/1980.At
c8d136d4:whattheflop: native Windows 11, the same iGPU, AMD driver 32.0.21030.2001, MSVC. FSR 3.1.6, 880/880, 0 non-finite, 16.8 ms. The missing-loader skip returned 77. That run found the extension issue fixed in
e312253b.Kev-Ball: RTX 3080 Ti (NVIDIA 620.73.04), CachyOS, Wine 11.22, built with llvm-mingw. The loader chose FSR 3.1.6, 880/880, 0 non-finite, 0.69 ms.
The test can fail: with the
dispatchcall removed, both cases fail (440/880 and 990/1980 squares).Without
LEONIDA_FFX_DIRit skips:amd_fidelityfx_loader_vk.dll not found.tests/test_ctest_registration.py,test_cmake_vulkan_missing.py,test_build_runtime_fallback.py,test_runtime_paths.pyand thetest_docs_*checks pass.Covered since: whattheflop confirmed the extension fix on Windows (
e312253b, 0 errors). RSK2707X ran FSR 4.1.2 on AMD's Windows driver (RX 7600).Not run: Intel.
No game files. AI-assisted (Claude Code).
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.