framegen: frame generation without the proxy swap chain (opt-in) #253

Manually merged
github merged 2 commits from github-bot/gh-253 into gh-pr/253/base 2026-12-02 22:49:42 +00:00 AGit
Owner

@⁠coil111 on GitHub · 2026-12-02 21:47 UTC · original
coil111:fidelityfx-framegen-direct → main · +1799 −125 · 6 files · 2 commits · merged 2026-12-02 22:44 UTC

Follow-up to the reports that FidelityFX frame generation costs a lot of real frames (up to about half) on RADV. This adds an opt-in path, VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1, that generates and presents the frames ourselves instead of going through AMD's proxy swap chain. On my machine it takes frame generation from costing ~25% of the real frame rate to ~8%, with the generated and real frames evenly spaced. The proxy stays the default for now; I'd like a few people with other hardware to try it before we change that.

What goes wrong with the proxy

RADV exposes a single graphics queue. The proxy swap chain composes the interface and presents on a DIRECT queue of its own at high priority, and vkd3d-proton maps that onto the same Vulkan queue as ours. To let the proxy's mid-frame work in, vkd3d-proton "staggers" our queue: it submits it in small pieces, each one only after the previous one has completed on the GPU (d3d12_command_queue_needs_staggered_submissions in libs/vkd3d/command.c; the comment there names FSR3 frame generation on single-graphics-queue drivers as the reason). Every piece is a CPU↔GPU round trip, so the GPU keeps going idle.

Things checked along the way:

  • It's a fixed ~6 ms per real frame here, the same at 1440p and 4K output, so it isn't the interpolation's GPU work. GPU timestamps put the interpolation itself at ~0.5 ms (1440p) and ~1 ms (4K).
  • A vkd3d-proton queue trace (VKD3D_QUEUE_PROFILE) shows the proxy's queue as a second DIRECT queue at priority 100 on the same Vulkan queue, and our work arriving in ~950 small submissions per second with frame generation on.
  • VKD3D_CONFIG=no_staggered_submit makes it worse: the proxy's present then waits behind a whole frame (Present blocked ~31 ms median).
  • VRR, refresh rate, sync interval, calling Present from a separate thread, and allowAsyncWorkloads made no difference.

What this does

With VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1 (plus VICTORY_FIDELITYFX_FRAMEGEN=1):

  • A plain swap chain (3 buffers) on our own queue, so there is only one queue and nothing gets staggered.
  • The generator is configured with NO_SWAPCHAIN_CONTEXT_NOTIFY and dispatched into the present's own command list, after the scene and the interface plane are copied into our textures. The interface is composed over both frames afterwards, so it is never interpolated (same idea as #161, and pillarbox works the same way).
  • The generated frame is presented right after that list.
  • The real frame is presented about halfway through the next frame. Because there is one in-order queue, when Present is called doesn't decide when the GPU gets to it; where it sits in the stream does. So it goes in after a share of the next frame's submissions, learned from when lists land on the GPU, behind a copy into the current back buffer. When the GPU is idle (CPU-bound frames) a timer takes over, and the title's next present is a hard limit. Nothing waits on the GPU for this.
  • Both presents use sync interval 0. The pacing comes from the stream position, and with interval 1 a hidden window (alt-tab) got throttled by the compositor and blocked the thread that sends every submission.
  • VKD3D_SWAPCHAIN_LATENCY_FRAMES is set to 6 if it isn't set, because two presents per frame would otherwise hit vkd3d-proton's limit of 3 outstanding presents.
  • If the frame generation DLL refuses the swap-chain-free path, it logs that once and shows real frames only. It does not fall back to the proxy silently.

The first commit is a small, separate helper: VICTORY_FIDELITYFX_FRAMEGEN_DEBUG passes AMD's debug flags through (1 tear lines, 2 reset indicators, 4 debug view, 16 pacing lines, proxy only), and counts upscale inputs that are replaced or missing.

Numbers

RX 9070 XT, Ryzen 7 9800X3D, Gentoo (kernel 7.3.4), Wine 11.22, Mesa 26.3.1 + mesa.patch, 2560x1440 at 280 Hz without VRR. Same spot in the world, a couple of minutes each, medians of the 5 s stats: frame blocks in gameplay. 1440p output, FSR 4 Performance, VICTORY_BVH_BUILDER=0 VICTORY_CARD_PULL=0 VICTORY_PAGES_SEEN=1 (the settings from the earlier reports):

real fps, median (p10–p90) vs. no FG
no frame generation 35.5 (29.7–38.0)
frame generation, proxy 26.7 (20.1–34.6) −25%
frame generation, direct 32.6 (27.6–35.6) −8%

On the direct path the real frame lands 1.02× half a frame after the generated one (median; p10–p90 0.98–1.10), Present never takes more than ~0.5 ms, and the next-frame trigger places ~97% of the real frames.

At 4K output with ray tracing on, the base rate is ~20 fps, CPU-bound. The proxy already cost nothing there, and the direct path is the same: 20–24 fps, real frames at 1.01–1.03× half a frame.

Trying it

./run.sh play VICTORY_FIDELITYFX_FRAMEGEN=1 VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1 VICTORY_PRESENT_TIMING=1

It's also in the F1 menu. To compare, run the same thing without VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1 and once without frame generation at all, at the same spot. Things to look for in the log:

  • once at start: FidelityFX frame generation (direct): on, without the proxy swap chain ... (or a warning that the DLL refused it)
  • every second, stats: fg_direct: real and gen should match; gap_ms should sit close to half_ms; present_ms should stay well under 1 ms; fg_interp_ms is the interpolation's GPU time
  • stats: frame fps counts real frames only on this path

I could only test RDNA4 at 280 Hz. I'd especially like to hear about:

  • RDNA3 and other AMD cards
  • 60 Hz screens and VRR
  • VICTORY_UI_PLANE=3840x2160 with a smaller output (the HUD should stay sharp when panning) and VICTORY_PILLARBOX=1 (the bars should stay black)
  • whether it feels smooth: the placement is learned, so the first second or so after a load may be uneven

Known limits

  • Presents use interval 0, so tearing is possible where the compositor allows it, the same as with frame generation off.
  • The pacing-lines debug flag (16) only works with the proxy.
  • The interval between the generated and real frame comes from the last frames' timing, like the proxy's moving average, so a frame that is much longer than the one before it can land off-centre.
**@⁠coil111** on GitHub · 2026-12-02 21:47 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/253) `coil111:fidelityfx-framegen-direct` → `main` · +1799 −125 · 6 files · 2 commits · merged 2026-12-02 22:44 UTC Follow-up to the reports that FidelityFX frame generation costs a lot of real frames (up to about half) on RADV. This adds an opt-in path, `VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1`, that generates and presents the frames ourselves instead of going through AMD's proxy swap chain. On my machine it takes frame generation from costing ~25% of the real frame rate to ~8%, with the generated and real frames evenly spaced. The proxy stays the default for now; I'd like a few people with other hardware to try it before we change that. ## What goes wrong with the proxy RADV exposes a single graphics queue. The proxy swap chain composes the interface and presents on a DIRECT queue of its own at high priority, and vkd3d-proton maps that onto the same Vulkan queue as ours. To let the proxy's mid-frame work in, vkd3d-proton "staggers" our queue: it submits it in small pieces, each one only after the previous one has completed on the GPU (`d3d12_command_queue_needs_staggered_submissions` in `libs/vkd3d/command.c`; the comment there names FSR3 frame generation on single-graphics-queue drivers as the reason). Every piece is a CPU↔GPU round trip, so the GPU keeps going idle. Things checked along the way: - It's a fixed ~6 ms per real frame here, the same at 1440p and 4K output, so it isn't the interpolation's GPU work. GPU timestamps put the interpolation itself at ~0.5 ms (1440p) and ~1 ms (4K). - A vkd3d-proton queue trace (`VKD3D_QUEUE_PROFILE`) shows the proxy's queue as a second DIRECT queue at priority 100 on the same Vulkan queue, and our work arriving in ~950 small submissions per second with frame generation on. - `VKD3D_CONFIG=no_staggered_submit` makes it worse: the proxy's present then waits behind a whole frame (`Present` blocked ~31 ms median). - VRR, refresh rate, sync interval, calling `Present` from a separate thread, and `allowAsyncWorkloads` made no difference. ## What this does With `VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1` (plus `VICTORY_FIDELITYFX_FRAMEGEN=1`): - A plain swap chain (3 buffers) on our own queue, so there is only one queue and nothing gets staggered. - The generator is configured with `NO_SWAPCHAIN_CONTEXT_NOTIFY` and dispatched into the present's own command list, after the scene and the interface plane are copied into our textures. The interface is composed over both frames afterwards, so it is never interpolated (same idea as #161, and pillarbox works the same way). - The generated frame is presented right after that list. - The real frame is presented about halfway through the next frame. Because there is one in-order queue, *when* `Present` is called doesn't decide when the GPU gets to it; *where* it sits in the stream does. So it goes in after a share of the next frame's submissions, learned from when lists land on the GPU, behind a copy into the current back buffer. When the GPU is idle (CPU-bound frames) a timer takes over, and the title's next present is a hard limit. Nothing waits on the GPU for this. - Both presents use sync interval 0. The pacing comes from the stream position, and with interval 1 a hidden window (alt-tab) got throttled by the compositor and blocked the thread that sends every submission. - `VKD3D_SWAPCHAIN_LATENCY_FRAMES` is set to 6 if it isn't set, because two presents per frame would otherwise hit vkd3d-proton's limit of 3 outstanding presents. - If the frame generation DLL refuses the swap-chain-free path, it logs that once and shows real frames only. It does not fall back to the proxy silently. The first commit is a small, separate helper: `VICTORY_FIDELITYFX_FRAMEGEN_DEBUG` passes AMD's debug flags through (1 tear lines, 2 reset indicators, 4 debug view, 16 pacing lines, proxy only), and counts upscale inputs that are replaced or missing. ## Numbers RX 9070 XT, Ryzen 7 9800X3D, Gentoo (kernel 7.3.4), Wine 11.22, Mesa 26.3.1 + `mesa.patch`, 2560x1440 at 280 Hz without VRR. Same spot in the world, a couple of minutes each, medians of the 5 s `stats: frame` blocks in gameplay. 1440p output, FSR 4 Performance, `VICTORY_BVH_BUILDER=0 VICTORY_CARD_PULL=0 VICTORY_PAGES_SEEN=1` (the settings from the earlier reports): | | real fps, median (p10–p90) | vs. no FG | |---|---|---| | no frame generation | 35.5 (29.7–38.0) | | | frame generation, proxy | 26.7 (20.1–34.6) | −25% | | frame generation, direct | 32.6 (27.6–35.6) | −8% | On the direct path the real frame lands 1.02× half a frame after the generated one (median; p10–p90 0.98–1.10), `Present` never takes more than ~0.5 ms, and the next-frame trigger places ~97% of the real frames. At 4K output with ray tracing on, the base rate is ~20 fps, CPU-bound. The proxy already cost nothing there, and the direct path is the same: 20–24 fps, real frames at 1.01–1.03× half a frame. ## Trying it ```sh ./run.sh play VICTORY_FIDELITYFX_FRAMEGEN=1 VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1 VICTORY_PRESENT_TIMING=1 ``` It's also in the F1 menu. To compare, run the same thing without `VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1` and once without frame generation at all, at the same spot. Things to look for in the log: - once at start: `FidelityFX frame generation (direct): on, without the proxy swap chain ...` (or a warning that the DLL refused it) - every second, `stats: fg_direct`: `real` and `gen` should match; `gap_ms` should sit close to `half_ms`; `present_ms` should stay well under 1 ms; `fg_interp_ms` is the interpolation's GPU time - `stats: frame` `fps` counts real frames only on this path I could only test RDNA4 at 280 Hz. I'd especially like to hear about: - RDNA3 and other AMD cards - 60 Hz screens and VRR - `VICTORY_UI_PLANE=3840x2160` with a smaller output (the HUD should stay sharp when panning) and `VICTORY_PILLARBOX=1` (the bars should stay black) - whether it feels smooth: the placement is learned, so the first second or so after a load may be uneven ## Known limits - Presents use interval 0, so tearing is possible where the compositor allows it, the same as with frame generation off. - The pacing-lines debug flag (16) only works with the proxy. - The interval between the generated and real frame comes from the last frames' timing, like the proxy's moving average, so a frame that is much longer than the one before it can land off-centre.
VICTORY_FIDELITYFX_FRAMEGEN_DEBUG passes AMD's debug flags to the generator:
1 tear lines, 2 reset indicators, 4 debug view, 16 pacing lines (the proxy
only).

An upscale whose inputs are replaced before a present took them, and a
present that finds no inputs while generation is armed, are counted and
logged at powers of two.
RADV has one graphics queue. The proxy swap chain presents and composes the
interface on a high-priority DIRECT queue of its own, which vkd3d-proton maps
onto that same Vulkan queue; to let it in mid-frame, vkd3d-proton staggers our
queue (submits it in pieces, each after the one before has completed). With
frame generation on, the card sits idle between the pieces: a fixed ~6 ms per
real frame here, at 1440p and 4K alike, and much more on slower CPUs.
VKD3D_CONFIG=no_staggered_submit is worse: the proxy's present then waits
behind a whole frame.

With VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1 there is no proxy. The swap chain
is a plain one (3 buffers) on our own queue, so vkd3d-proton has nothing to
stagger. The generator is configured with NO_SWAPCHAIN_CONTEXT_NOTIFY and
dispatched into the present's own list, after the scene and the interface
plane are copied into textures of ours. The generated frame (with the
interface composed over it) is presented right after that list. The real
frame is composed into a texture of ours and presented later, about halfway
through the next frame: after a share of the next frame's submissions,
learned from when the lists land, or when the card has caught up and half a
frame has passed, or at the latest at the title's next present. Its Present
goes in at that point of the queue, behind a copy into the current back
buffer, so the card reaches it mid-frame without anything waiting on it.

Both presents use sync interval 0: the pacing comes from where the present
sits in the queue, and at 1 the compositor's throttling of a hidden window
blocked the thread that sends every submission. VKD3D_SWAPCHAIN_LATENCY_FRAMES
is set to 6 if unset, since two presents per frame would otherwise hit
vkd3d-proton's limit of 3.

`stats: fg_direct` logs generated and real presents, the time in Present,
the card's time for preparing, interpolating and composing, and how far
apart the generated and real frames land against half a frame. The proxy
stays the default; a DLL without the swap-chain-free path shows real frames
only and says so.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 21:49:46 +00:00
Author
Owner

@⁠joaowtrdev on GitHub · 2026-12-02 22:35 UTC · original

Tested #253 (f35459c) on my machine: Ryzen 7 5700X3D, RX 9070 XT, CachyOS, system Wine 11.22, KDE Wayland (XWayland), 210 Hz, VRR off. 4K output, FSR 4 Performance, RT off, VICTORY_CARD_PULL=0 VICTORY_PAGES_SEEN=1, lsfg-vk off. Three runs back-to-back from the same save: 1 min standing at the start, then ~3 min driving the same route.

Medians / p90 over the 5 s blocks in the world:

no FG FG, proxy (main) FG, VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1
real fps, standing 26.9 / 28.9 13.9 / 15.4 (−48%) 25.6 / 27.0 (−5%)
real fps, driving 25.6 / 30.2 15.4 / 23.5 26.2 / 33.0
gpu_wait_ms 6.5 / 8.1 0.0 / 2.4 5.2 / 7.1
sender busy_ms 28.8 / 41.1 63.4 / 79.0 24.7 / 35.3
sender title_present_ms 0.5 / 4.2 6.0 / 20.8 0.5 / 4.4
proxy Present blocked (frames > 20 ms) — 2.9 / 35.3 ms —

stats: fg_direct in the direct run: generated = real (26.4 / 33.1 per second), fg_interp_ms 1.0, present_ms 0.0, gap_ms 19.4 against half_ms 19.0, so the real frame lands close to half a frame after the generated one.

So on this machine the direct path takes frame generation from about half the real frame rate to about −5% standing, and the difference while driving is within route noise. The GPU waits again and the sender is no busier than without FG. No crash, and the HUD stays clean. The ghosting behind the car is still there, which I take to be interpolation at a ~26 fps base.

Thanks, this makes FSR FG usable here.

**@⁠joaowtrdev** on GitHub · 2026-12-02 22:35 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/253#issuecomment-7360899414) Tested #253 (`f35459c`) on my machine: Ryzen 7 5700X3D, RX 9070 XT, CachyOS, system Wine 11.22, KDE Wayland (XWayland), 210 Hz, VRR off. 4K output, FSR 4 Performance, RT off, `VICTORY_CARD_PULL=0 VICTORY_PAGES_SEEN=1`, lsfg-vk off. Three runs back-to-back from the same save: 1 min standing at the start, then ~3 min driving the same route. Medians / p90 over the 5 s blocks in the world: | | no FG | FG, proxy (main) | FG, `VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1` | |---|---|---|---| | real fps, standing | 26.9 / 28.9 | 13.9 / 15.4 (−48%) | **25.6 / 27.0 (−5%)** | | real fps, driving | 25.6 / 30.2 | 15.4 / 23.5 | **26.2 / 33.0** | | `gpu_wait_ms` | 6.5 / 8.1 | 0.0 / 2.4 | 5.2 / 7.1 | | sender `busy_ms` | 28.8 / 41.1 | 63.4 / 79.0 | 24.7 / 35.3 | | sender `title_present_ms` | 0.5 / 4.2 | 6.0 / 20.8 | 0.5 / 4.4 | | proxy `Present` blocked (frames > 20 ms) | — | 2.9 / 35.3 ms | — | `stats: fg_direct` in the direct run: generated = real (26.4 / 33.1 per second), `fg_interp_ms` 1.0, `present_ms` 0.0, `gap_ms` 19.4 against `half_ms` 19.0, so the real frame lands close to half a frame after the generated one. So on this machine the direct path takes frame generation from about half the real frame rate to about −5% standing, and the difference while driving is within route noise. The GPU waits again and the sender is no busier than without FG. No crash, and the HUD stays clean. The ghosting behind the car is still there, which I take to be interpolation at a ~26 fps base. Thanks, this makes FSR FG usable here.
github-bot changed target branch from main to gh-pr/253/base 2026-12-02 22:49:37 +00:00
github manually merged commit f35459c609 into gh-pr/253/base 2026-12-02 22:49:42 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.