AMD FSR3.1 - FSR 4.1 - DLSS5 NR #1335
Closed
notquiteog wants to merge 146 commits from
main into main
pull from: main
merge into: 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!1335
Loading…
Reference in a new issue
No description provided.
Delete branch "main"
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?
Exactly as the title says, adds AMD FSR4 and DLSS5 NR with options, for older systems it supports FSR 3.1, next update adds NR for AMD and DLSS5 NR on linux
Thanks for this. FSR 3.1 frame generation is something players have been asking for, and this is the only PR that has it. It's too much to review and test as one piece, though, so could you split it?
1. FSR 3.1 upscaling + frame generation on its own (
vk_fsr3fi.cpp, the vendored FidelityFX files, AMD's runtime DLLs from GPUOpen pinned by commit as you have it now, the menu row). This one I'd like to take first. It'll be tested here for fps, frame pacing and visual flashes before it's merged.2. FSR 4.1 and the DLSS 5 / Streamline path as separate PRs. Please include a short description of what each does, the GPUs and drivers they need, and how you tested them.
A few notes for the split:
scripts/ngx_sdk.py ... --accept-nvidia-license, so every release build would accept NVIDIA's DLSS license and ship NVIDIA's library. The maintainer hasn't decided on that, so please leave it out of the FSR PR. Today each player accepts the license themselves in the builder.v2.14.16tag, the same way the AMD checkout is pinned.release.ymland the other workflow edits out of the FSR PR unless the feature needs them, and say why for any that stay.tests/run_all.pyon currentmainby itself.Once the FSR 3.1 part is up, I'll test it right away. Then #1313, #1095, #1096 and #1097 can be closed as superseded.
Two things for the split, so it doesn't overlap work that's already open or merged:
vk_temporal.cppwith a small engine interface, so DLSS and FSR 4.1 are two engines on one input path. Tested on an RX 6700 XT (FSR 4.1.2), and it also runs on Linux. A separate FSR 4.1 PR from this one would duplicate it. Happy to compare notes if yours does something #1008 doesn't.nx2/oot_jitter.py) and builds motion vectors with actor motion. This branch adds a second camera hook (nx2/oot_camera.py) and a second motion pass (vk_camera_motion.cpp). Taking #841's inputs instead keeps one jitter in the game and gives FSR 3.1 the characters' motion too. Once #1008's update is up, FSR 3.1 could plug in there as one more engine.On it rn
For the DLSS 5 / NR part of the split: I have an NGX-direct path for feature 18 (NVSDK_NGX_Feature_DLSSNR) working on Vulkan in Hookshot — the fallback docs/neural-rendering.md mentions. It uses NVIDIA's own DLSS-NR NGX headers (the RTX Remix NGX package) and the DLSS SDK's nvsdk_ngx_s.lib. That means no Streamline DLLs and no reconstructed options struct, and it shares the NGX setup already merged in #841. Nothing of NVIDIA's is committed; the player fetches it the same way as #841.
Measured on an RTX 5090 (driver 621.14): the model evaluates in-game every frame and fps holds at 60 at 2048×1152. It uses 386 MB of VRAM, and a standalone test measured ~1.3–1.6 ms per frame at 720p. Every eval parameter is exposed (intensity, tone, structure, skin, style 0–7, auto mask, blend mode, UI correction). Like #1335 it has no motion vectors yet, so each frame is processed on its own.
One open question: whether the Remix package's terms cover use outside Remix. Happy to contribute it as the NR follow-up PR, or to hand the code to @notquiteog to fold in, whichever the maintainer prefers.
May I ask why Streamline is being added at all? The latest NGX supports DLSS5NR, which is what the repo uses, I find it unnecessary for Streamline to be added when NGX suits the needs.
Ok, I'm looking at your branch and I'll adjust my PR around it, I have a bunch of uncommitted work to bring NR to AMD
NGX is not open source, Streamline allows users to replace the DLL's themselves easily as well
We can support NR with NGX, which is cross-platform. Let's do that
None of DLSS is open-source, so it's moot
Thanks for this. There's real work in here, especially the FSR 3.1 frame interpolation, which no other PR has. I read the hand-written integration against current main and skipped the vendored SDK sources. Provenance and licence notes for
third_party/ffx-apiandthird_party/fidelityfx-sdklook fine: MIT, pinned commits, unmodified.I agree with the split NotRexed asked for. Below is what I found, so each piece can land cleanly.
Bugs in the FSR 3.1 upscaler (
gpu/vk/vk_fsr3.cpp,vk_draw.cppseam)prepare()remakes every internal image when the render or output size changes, butfirst_evaluationis only reset byshutdown(). On the nextupscale(),firstis false, so the new images never get their UNDEFINED→GENERAL barrier or their clear.lut_uploadedalso stays true, so the newlanczos_lutis never filled. After any size change (window resize, Render resolution, a dynamic-resolution change) the passes run on undefined layouts and an empty Lanczos LUT.make_image()→drop_image()destroys the old images straight away, with no idle and no deferred free, while earlier command buffers can still reference them.vk_dlssnr.cppalready does this correctly withdevice_wait_idle_locked()underpresent_mu.vk_ffx.cpp'sidle()uses a barevkDeviceWaitIdlefrom the replay thread. That breaks the external-sync rule your own comment invk_dlssnr.cppdescribes, because the present queue can be submitting at the same moment.fsr3::upscale()has dstFRAGMENT|COMPUTE / SHADER_READ, but the seam then readsfsr3::output_image()withvkCmdBlitImage, which isTRANSFER / TRANSFER_READ. The blit isn't ordered after the RCAS/accumulate write. Nothing orders the blit's write to the game's target before the game's next reader either. Separately, B10G11R11 isn't guaranteedBLIT_DST, so the format feature should be checked once.dlss_out.comp) squares the result back to linear before writing the network's output. This PR gives FSR 3.1 and FSR 4dw().imgs[0]/dw().srcs[0]directly and blits the result into the target without squaring. If I'm reading main right, the FSR picture comes out in the wrong transfer function. It also saysFFX_UPSCALE_ENABLE_HIGH_DYNAMIC_RANGEfor an input that isn't linear HDR.Duplicate inputs.
nx2/oot_camera.pyplusvk_camera_motion.cppadd a second camera hook and a camera-only motion pass, but main already has #841's jitter (nx2/oot_jitter.py) and motion vectors with the skinned actors' own motion.oot_camera.pyalso changes the lifted C for everyone, at four projection sites every frame. #1008'svk_temporal.cppmoves #841's chain behind an engine interface. FSR 3.1 should plug in there as one more engine, so there's one jitter in the game and FSR gets actor motion too.Upscaler values clash with #1008. Both PRs extend the saved
dlsskey past DLAA with different meanings: here 3 = FSR 3.1 and 4 = FSR 4, in #1008 3 = FSR 4 and 4 = FSR 4 Native AA. Whichever lands second has to renumber. I'd suggest keeping #1008's 3/4 and adding FSR 3.1 as 5, so nobody's saved ini changes meaning between releases.Teardown. None of the new
shutdown()functions (ffx,fsr3,fsr3fi,dlssnr,dlssnr_ngx,streamline,dlssg,camera_motion) is called anywhere. That avoids the exit-timeffxDestroyContext-from-a-static crash we found in #1008, but only because nothing is ever destroyed. If teardown gets wired up later, it needs to run before the device goes and never from a static destructor.DLSS 5 NR. This isn't ray reconstruction. It's NVIDIA's "neural rendering" uplift, run over the finished frame before the HUD. It worries me most for main:
DlssNrOptions(GUID, struct version, layout) is reverse-engineered from a prerelease DLL, because the real header is only in NVIDIA's NDA SDK. The NGX-direct path usesNVSDK_NGX_Feature_Reserved18with guessed parameter names.explain_refusaltell RTX 20–40 users to use a patchednvngx_dlssnr.dlland setHKLM\...\NGXCore\EnableSignatureOverride=1. That turns off NGX signature checking for every game on the PC. I don't think upstream should document or support that.Release and CI. These need to come out of the feature PRs:
--accept-nvidia-licensein both workflows, and the prebuilthookshot_vk.dllshipped in the Windows package with NGX statically linked. That changes main's "each player accepts NVIDIA's licence in the Builder" model, and it's the maintainer's call.Repository.cs, theHOOKSHOT_REPOSITORYplumbing insetup.c,hos_update.c,linux_update.pyandversion.py,.releaserc.json(feat→ patch),changelog.txtand the fork's version bumps. That's fork release machinery.prebuilt_renderer()inmake_game.py: the Builder stops compiling the renderer on the player's PC.Unrelated behaviour changes that should be their own PRs:
nn_vi.c: the vsync event now follows the display's refresh rate by default instead of 60. That changes pacing for everyone on a high-refresh monitor, with no opt-in.HOS_DISPLAY_VRR,HOS_FPS_FORCEand the 120 Hz HLE.texture_touch_quickandgpu_buffer_bind, which sit on hot paths.Linux. FSR 4 (
vk_ffx) and Streamline are Windows-only stubs, and FSR 3.1 is the only new path that compiles on Linux. CI never ran on this PR (head is the fork'smain, and there are no checks), so there's no evidence either way that the Linux build ortests/run_all.pypass. It also conflicts with main (39 commits behind).On #1008 vs this: I'd take #1008's architecture as the base for main: the TemporalEngine on #841's inputs, the right colour handling, and it runs on Linux. That makes #1008 the FSR 4 path, so
vk_ffx.cpphere would duplicate it. From this PR, the unique and valuable parts are the FSR 3.1 upscaler, as an engine onvk_temporal(with the fixes above), and FSR 3.1 frame interpolation (vk_fsr3fi.cpp) plus the Frame generation method row. Those are a great first split PR. NR should come separately over NGX.@ -160,3 +81,4 @@--skip-tag "$SKIP_TAG" ||{ echo "no release with a setup list: built without the profile"; exit 0; }python3 -I scripts/release_parts.py profile /tmp/setup.txt work ||{ echo "the profile did not download: built without it"; exit 0; }Same here for the AppImage:
--accept-nvidia-licensein CI makes every release accept NVIDIA's licence. Please drop it from the feature split.@ -366,4 +258,3 @@uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:ref: ${{ inputs.tag }}persist-credentials: falseThis accepts NVIDIA's DLSS licence on every release build and links NGX into the shipped
hookshot_vk.dll. Main's model is that each player accepts it in the Builder, and changing that is the maintainer's call, so please leave it out of the feature PRs.Can you recheck the recent NR/upscale/frame-gen work on my fork? It should be a complete implementation on AMD and NVIDIA
Thanks for splitting this up. FSR 3.1 upscaling and frame generation are now reviewed in #1386, and FSR 4.1 is in #1008, so closing this combined PR. For DLSS NR, please open it as its own PR; review asked for it through NGX rather than Streamline.