Compile AMD's FSR 3.1 upscaler passes from the FidelityFX SDK #822
Closed
notquiteog wants to merge 45 commits from
feat/fsr-vendor into main
pull from: feat/fsr-vendor
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
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/Hookshot!822
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/fsr-vendor"
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?
The shader half of an FSR backend, and the render-target census that settles a question the docs kept asserting.
The shaders
Adds AMD's FidelityFX SDK v1.1.4 GPU sources under
third_party/fidelityfx-sdk/— unmodified, MIT, with aPROVENANCE.md— andscripts/fsr3_shaders.pyto compile the eleven variants intogpu/vk/shaders/fsr3_*_comp_spv.h.Eleven, not eight: the eight passes, plus wave-free variants of both pyramids for devices without the subgroup operations the single-pass downsampler prefers, and an accumulate compiled with sharpening on. The option set lives in one place in the script because each option is a promise about the inputs — HDR colour, low-resolution motion that is not jittered, reversed depth — and the host code has to hand the passes what they were compiled for.
This is the SDK-source route, not AMD's FidelityFX API: no runtime library is needed, none is included, and one code path serves Windows and Linux. #577 vendors AMD's API headers under
third_party/fidelityfx/for the other route, which reaches FSR 4 but needs AMD's runtime and is Windows-only. They are different things, but if both land one of them should go, anddocs/upscaling.mdsays so rather than leaving it implicit.The headers are checked in, like every other shader in
gpu/vk/shaders, so a clone builds with no glslang.tests/test_fsr3_shaders.pyrecompiles all eleven and compares, and validates each module withspirv-val, so they cannot drift from their sources and an invalid module is caught here rather than on a device.glslang-toolsis added to the Linux CI step that hadspirv-toolsonly.That costs about 1.3 MB of generated hex. Generating at build time would remove it at the price of a glslang dependency for every build — your call; the doc records the trade rather than deciding it.
Nothing includes these headers yet. The host side that records the passes is the next PR.
The census
RX_VK_MRT_CENSUS=1logs each distinct render target set once, fromtargets()(once perNOP_SET_RT, not per draw), capped at 512 sets, free while off.It exists to answer whether a denoising upscaler — DLSS Ray Reconstruction, FSR Ray Regeneration — could ever have inputs here, since both want a ray-traced renderer's albedo, normal and roughness guides rather than colour/motion/depth. The honest test is whether the game writes a G-buffer.
It does bind multi-attachment passes, which is the opposite of what I expected: of 136 distinct sets, 7 bind six attachments, 2 bind three, 6 bind two. The formats settle it the other way:
A deferred G-buffer is three or four attachments at the main render resolution carrying albedo, packed normals and roughness. None of this is that: the scene is a single HDR target and every multi-attachment pass is a cubemap face chain or post-processing at a quarter resolution or less. So there are no guides for a denoising upscaler on this title — now on evidence rather than on the absence of a target named "normal".
Tested
Linux, RTX 5060 Ti, driver 615.71.09. All eleven variants compile and pass
spirv-val; the regeneration check fails as it should on a changed word in a header, a changed compile option and a missing header. Full game build from a v131072 dump (builde0f3ccfa) in 8m20s, and a 240 s headless run produced the census above.python -I -B tests/run_all.py: 90 passed, with the same 14 failures and 7 skips as pristinemainin this environment.No fps claim: that run had
RX_VK_PRECOMPILE=0, so every pipeline compiled on demand.AI assistance: recorded in the commit trailers.
Thank you! This has grown to about 56,000 lines (the vendored FidelityFX SDK, plus camera, vsync and frame-rate changes in host/nn_vi.c and nx2/oot_camera.py), stacked on #821. It's too large and mixed to review and test as one. Closing to keep the queue clear; please split it (the vendored SDK and shader compile script on their own, then the camera/vsync changes, each with how it was tested) and reopen.