mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:40:52 +01:00
[PR #151] FFX shim: the title's five FidelityFX calls answered by the layer's PC upscaler (part 2) #203
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#203
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/151
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9883📝 Commits (10+)
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 case8af9ed0d3d12 layer: an Upscale command replayed through AMD's PC upscaler (FFX shim, part 1)3c05c37replay: Upscale images in a PreparedList side table, and one barrier each way016df7fFFX shim: the title's five FidelityFX calls answered by the layer's PC upscaler (part 2)a2766d2ffx_vk: the loader's choice depends on GPU and driver, not on architecture alone37c57c2Merge branch 'ffx-upscale-shim' into ffx-upscale-shim-2a2fb835Merge branch 'rt-344-ffx-vk' into ffx-upscale-shimcf8b714docs: which console mode calls FSR (Rockstar's statement), and LEONIDA_DEVICE_TYPE=6📊 Changes
18 files changed (+2110 additions, -8 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+68 -0)📝
runtime/CMakeLists.txt(+33 -0)📝
runtime/shims/d3d12_com.cpp(+11 -0)📝
runtime/shims/d3d12_com.h(+5 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+50 -0)➕
runtime/shims/ffx_shim.cpp(+175 -0)➕
runtime/shims/ffx_upscale.cpp(+316 -0)➕
runtime/shims/ffx_upscale.h(+52 -0)📝
runtime/src/command_list.h(+26 -1)➕
runtime/src/ffx_vk_backend.cpp(+88 -0)➕
runtime/src/ffx_vk_backend.h(+89 -0)📝
runtime/src/vulkan_backend.h(+11 -1)📝
runtime/src/vulkan_replay.h(+134 -1)➕
runtime/test/d3d12_ffx_scene.h(+232 -0)➕
runtime/test/d3d12_ffx_shim_test.cpp(+193 -0)➕
runtime/test/d3d12_ffx_upscale_test.cpp(+121 -0)📝
runtime/test/ffx_api_min.h(+43 -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
#5171, 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 (a5112a362), which merges cleanly onmain7e39a81ea. The test reports from other contributors are on#5171.Item: the FFX upscale shim (claim: https://github.com/ItsNotRexed/Leonida/issues/5032#issuecomment-7095090683), part 2 of 2: the shim table that answers the title's five FidelityFX calls with part 1's layer path.
Depends on:
#9882(part 1, the layer's Upscale command), which depends on#9877(the backend). This branch carries both; this PR's own work is016df7f2and the docs commit after it (plus a merge of the chain's wording fix).Draft until
#9882and#9877are ready.What
shims/ffx_shim.cppservesffxCreateContext,ffxDestroyContext,ffxConfigure,ffxQueryandffxDispatchfor both package modules that export them:amd_fidelityfx_loader_xbox.dll;amd_fidelityfx_upscaler_xbox.dll.dumpbinshows exactly these five on each (docs/d3d12_command_objects.md§3.5). Which module the title calls needs its executable.Registration: the table registers before
main, and only withLEONIDA_FFX_PC=1in the process environment. The shims then own both modules: imports andLoadLibrary/GetProcAddressresolve here, and the package's copies are never mapped. Off, nothing is registered and the title loads the package's DLLs exactly as before;d3d12_ffx_shim_offchecks this.In
gta6rt: the file is a source ofgta6rtitself, in its Vulkan block. In the static library nothing would reference the self-registering object, so the linker would drop it.The calls:
ffxCreateContext: takes the upscale description and the device of the console backend descriptor from the chain. That descriptor is type0x01000002with the device at+0x10, measured indocs/d3d12_vulkan.mdA.3; the code asserts the offset.FFX_UPSCALER_VERSION(4.1.2) instead. Without it, AMD's loader reported that the newer API functions are unavailable.rt::ffx_upscalecontext number.UNKNOWN_DESCTYPE; no backend descriptor or device isERROR_PARAMETER.ffxDispatch: oneleonida::Upscalerecorded into the title's list (#9882). Other dispatch types (the reactive-mask generator, …) areUNKNOWN_DESCTYPE, logged once per type.ffxQuery/ffxConfigure: pass through to AMD's loader, with these exceptions:GET_VERSIONSnames the title's D3D12 device, which is replaced by that device's Vulkan handles;UNKNOWN_DESCTYPE(measured).ffxDestroyContext:rt::ffx_upscale::destroy(part 1: it waits for idle under the submit lock).test/d3d12_ffx_scene.hholds the scene both layer tests share; the part 1 test now uses it, which removes about 200 duplicated lines.d3d12_ffx_shim_testcalls the five functions as the loader binds them (rt::shims::findon the console names), with the console chain.When the title calls FSR (added in the last commit)
Rockstar's statement on the console versions, as reported by VideoCardz and Alt Char:
#780).The runtime reports a Series X by default (
XSystemGetDeviceType). So the title would take its TAA path, which needs nothing beyond the translated shaders, and never call FSR.LEONIDA_DEVICE_TYPE=6reports a Series S, the mode that reaches this shim. That suits weaker GPUs: 720p rendering with PC FSR 4.1 or 3.1.docs/d3d12_vulkan.mdA.3.Performance
ffxDispatch: a field-by-field copy into a 136-byteUpscaleand onerecord_upscale, O(1). Replay cost is part 1's: one barrier each way, then AMD's dispatch.ffxCreateContext/ffxDestroyContext: rare, at resolution changes.Tested
Built with clang-cl 23.1.5 + xwin and run under Wine 11.22 on CachyOS, Mesa 26.3.1 RADV, FidelityFX SDK 2.4.0 DLLs, through
ctest(which setsLEONIDA_FFX_PCper test):d3d12_ffx_shimd3d12_ffx_shim_offd3d12_ffx_upscaleffx_vk_dispatchffxDispatchreturning OK without recording, the shim test reports 440/880 and FAIL.LEONIDA_FFX_DIR,d3d12_ffx_shimandd3d12_ffx_upscaleskip (77).#9877; on the iGPU there's only Wine's own01387.test_ctest_registration.py,test_cmake_vulkan_missing.py,test_runtime_paths.pyand thetest_docs_*checks pass.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.