fix(vk): V-Sync Auto keeps its mode when DLSS Frame Gen's runtime makes fewer frames than the multiplier asks #2701
Closed
github-sync
wants to merge 1 commit from
github/pr/2701 into main
pull from: github/pr/2701
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!2701
Loading…
Reference in a new issue
No description provided.
Delete branch "github/pr/2701"
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?
With Frame generation at 3x or 4x, "Frame generation by" Auto and V-Sync Auto, a DLSS Frame Generation runtime that makes only 1 frame leaves the frames to the renderer's own generator, but the swapchain was still made FIFO as for DLSS-G. The game was then held at the refresh rate over the multiplier (36 fps on a 144 Hz display at 4x, none of 720 frames shown on time).
Fixes #2695
What was wrong
swapchain_dlssg()(V-Sync Auto's FIFO) followsdlss_fg_runs(), which checked that DLSS-G is asked for, that DLSS runs on the device and that NGX did not say no or give its feature up. It did not check how many frames the runtime makes.dlss_fg_framesleaves a set of more frames than that (count > g.most) to the renderer's own generator, every present, so at 3x and 4x with a runtime that makes 1 the swapchain stayed FIFO while the renderer's own made all the frames. The comment at the mode's choice already said the renderer's own frame generation keeps Auto's mailbox.The fix
dlss_fg_runs(frames)now takes the number of made frames a set asks for (the multiplier less 1) and says no when the runtime makes fewer. The runtime's limit is published byfg_startonce NGX has answered (most_known, 0 before).swapchain_dlssg()passes the Frame generation row's multiplier less 1 (the row goes up to 8x;swapchain_framegen()stops at 4, for the images, so it is not the count).present_imageseesswapchain_dlssg()change and makes the swapchain again, once, the same way it already does when NGX says no or the feature is given up. The limit is set once a run, so there is no second change.RX_VK_DLSS_FG_MOST=<n>caps what the runtime is taken to make, for checks: with=1a current runtime behaves as the reporter's at 3x and 4x.Unchanged: 2x with such a runtime (DLSS-G makes its 1 frame: FIFO), a runtime that makes as many as asked, V-Sync On and Off, GPUs without DLSS, builds without NGX, FSR's and the renderer's own frame generation, the swapchain's image count (it follows the multiplier, not DLSS-G).
Tested
python -I -B tests/test_vsync_row.py: it now compiles the realswapchain_dlssganddlss_fg_runsintocreate_swapchain's choice of mode and checks, for Windows' and Linux's mode lists: before NGX's answer FIFO; a runtime that makes 1 at 2x FIFO, at 3x and 4x Auto's mailbox (the issue); a runtime that makes 3 at 4x FIFO, at 5x and 8x mailbox; given up, or a device without DLSS, mailbox; V-Sync On FIFO and Off immediate in every case. It fails onmain(nodlss_fg_runs(int frames)).tests/test_dlssg_runtime.py,tests/test_present_thread.py,tests/test_present_semaphores.py,tests/test_vk_swapchain_compat.py(they read the same code): pass.Built on Linux (
hookshot_vk.so, with NGX) and run in the game: RTX 3090, 2560x1440 at 240 Hz, Hyrule Field, DLSS, Frame generation 4x, Frame generation by Auto, V-Sync Auto, Reflex on, cap 120. This card has no DLSS Frame Generation (NGX: "not available (0xbad00004) ... needs an RTX 40 or newer"), so the renderer's own makes the frames: the swapchain is made FIFO before the first present, then once more as mailbox when NGX answers, as onmain, and the log now says "V-Sync Auto with frame generation at 4x, its frames the renderer's own (DLSS-G does not make them): Auto's mode, as without DLSS-G". One FIFO-to-mailbox remake, no loop; 254 fps shown (about 63 game fps), "0 made by DLSS-G".Not tested
RX_VK_DLSS_FG_MOST=1with Frame generation 4x reproduces the issue's runtime on such a card: the log should show the FIFO line once, then the "renderer's own" line, and the frame rate should no longer sit at the refresh over 4.github-sync referenced this pull request2026-11-12 08:31:01 +00:00
@jabbaxipil this should fix #2695. I could only run it on an RTX 3090, which has no DLSS Frame Generation at all, so the exact case of the issue (a runtime that makes 1 frame, at 3x or 4x) is covered by the unit test but not by a run in the game. If you can build this branch on your RTX 4070: with Frame generation 4x, by Auto, and V-Sync Auto, the log should show the "V-Sync Auto with DLSS Frame Generation at 4x: FIFO" line once, then "V-Sync Auto with frame generation at 4x, its frames the renderer's own", and the game should no longer sit at 36 fps. 2x should behave as before.
Ran this on a card with DLSS Frame Generation: RTX 4090, NVIDIA 621.01, Windows 11, 144 Hz display. Build
hookshot v2.1.0-rc.3-256-g51da0464(source 18ed87b5):mainwith this PR, built from source with NGX (SDK 310.9.16, itsnvngx_dlssg.dllin the game'sngxfolder).Settings: Kokiri Forest from a save, DLSS DLAA (preset K) at 2560x1440, Frame generation by Auto, Frame pacing on, cap 60, V-Sync Auto. Each multiplier was set in the menu and the game restarted.
The mode choice works as described. At 2x, DLSS-G makes the frame and the swapchain is FIFO. At 4x, the runtime makes 1, and the swapchain is remade as mailbox once NGX has answered:
But #2695's symptom stays at 4x: the game is still held at 36.0 fps (144 / 4), with the same bunched presents. Every status line in play shows it, in a window (2558x1360) and in fullscreen (5120x1440, Reflex on):
GPU time was about 9.5 ms a frame, so the GPU is not what holds it. It is not FIFO either: the swapchain is mailbox in both runs. In play it felt like uneven pacing and very high latency in the window; in fullscreen the pacing felt better, but the latency was just as bad.
At 2x and at 2x with Reflex on, DLSS-G works as intended: 600 of each 600 presents made by DLSS-G, 56-61 fps in Kokiri once past the load (1,400-3,800 draws), and (2x) 601 of 615 frames shown on time, 7-9 ms apart. It looked smooth, with no shimmer.
So on Windows the FIFO choice looks like only part of #2695: the game stays at refresh / multiplier with mailbox too. @jabbaxipil, does your RTX 4070 show the same on Linux with this PR? If it does, #2695 may need reopening. I can run builds with more logging on this machine.
Not tested here: 3x in play (it is the same fallback), Frame pacing off, an uncapped game, and Linux.
🤖 Generated with Claude Code
@hckrman101 @Jiro131 Tested on the RTX 4070 on Linux: the fix works here, and the game is no longer held at refresh / multiplier.
Setup: RTX 4070, NVIDIA 615.71.09, DLSS-G runtime
libnvidia-ngx-dlssg.so.310.9.16, Ryzen 7 5800X3D, Ubuntu 26.04.1 (kernel 7.0), GNOME Wayland, 2560x1440 fullscreen at 144 Hz. CI AppImage frommain(v2.1.0-rc.3-256-g51da0464, which has #2701), built with NGX. DLSS, Frame generation by Auto, frame pacing on, V-Sync Auto, Reflex on;RX_VK_PARALLEL=4. Hyrule Field, standing still, about 60 s a run.The mode choice is as described: at 4x the log shows
V-Sync Auto with DLSS Frame Generation at 4x: FIFO, then3 made frames asked, but its runtime makes 1 at most ... V-Sync Auto keeps its mode without DLSS-G, and the swapchain is made once more as mailbox. One change from FIFO to mailbox, no loop. At 2x every swapchain is FIFO.No
slow submitlines while standing in any run (with the fix, the only ones came earlier, at start-up and on the way to the spot), and no write-back timeout or device lost in the three runs with the fix. At 2x, 99.6% of shown frames were 7-12 ms apart.So on Linux the FIFO choice was all of #2695: with mailbox, 4x runs at about the game's rate at 2x (54.9-56.4 fps against 57.1). @Jiro131's result on Windows (36.0 fps with mailbox) did not show up here, so it looks like a separate, Windows-side problem rather than a reason to reopen #2695. I did not test Windows, Frame pacing off, 3x or
RX_VK_DLSS_FG_MOST.