FSR 3 frame generation: the presenter sleeps and waits for its fence instead of spinning (VICTORY_FSR_PACING) #2371
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2371"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Sil3ntGam3r on 2026-11-29T12:26:20Z.
With FSR 3 frame generation on, FidelityFX's frame interpolation swap chain uses its default frame pacing. With those
defaults it spins until the next present is due, and spins again on the fence. On a CPU-bound 6-core machine, that
spinning takes almost a whole logical processor from the threads the frame waits on.
This PR sets
FfxApiSwapchainFramePacingTuningon the swap chain context right after it is made. It is sent throughffxConfigureDescFrameGenerationSwapChainKeyValueDX12(type0x30008) with keyFRAMEPACINGTUNING(2):allowHybridSpin = truewithhybridSpinTime = 2: it sleeps and only spins the last two timer ticks.victory-hle's
timeBeginPeriod(1)makes a tick 1 ms.allowWaitForSingleObjectOnFence = true: it waits on the fence withWaitForSingleObjectinstead of spinning.safetyMarginInMsandvarianceFactorkeep FidelityFX's values (0.1 / 0.1). In the SDK header, both flags defaultto false.
VICTORY_FSR_PACINGis a list ofhybridandfence, both when unset.VICTORY_FSR_PACING=spinkeepsFidelityFX's defaults, which is the behaviour before this PR. The configure call's return code is logged. Only the
FSR 3.x swap chain is configured. FSR 4's 4.0.0 swap-chain provider is left as it is because I couldn't test it.
Measured on an RTX 3070 8 GB (driver 621.40) with an i5-11600K (6 cores / 12 threads), Windows 11. Series S
profile, DLSS Quality, FSR 3 frame generation 2x, the same save and spot in the open world, release builds, 30 s of
per-thread CPU time (QueryThreadCycleTime):
Before the fix, a world timeline showed the presenter thread at 31–40 ms of every ~35 ms frame. It sat alongside
victory-submit(33–40 ms) and the four list threads (27–36 ms each). In a second pair of runs, it was 21.15 fpsagainst 20.89. Between runs on this machine, the noise is about ±0.5 fps. So the frame-rate gain on its own is
small. The clear result is about 0.9 of a logical processor given back, which should matter more on 4- and 6-core
CPUs.
Those numbers are from main
a4d05e7fplus local tuning. I ran two 15-minute runs in the world with it on: no crash,no device removal, interpolated frames at 2x the rendered rate.
On this branch (
829188e9+ this PR), the same machine and settings, four alternating runs of about 5 minutesin the world each: two on (unset), two off (
VICTORY_FSR_PACING=spin). Each run took 30 s of thread times afterabout 2 minutes in the world. FidelityFX answered
code=0both times it was on.So on main it gives back about 0.6 of a processor, and the presenter and interpolation threads drop by more than
half. Rendered fps here was the same either way (20.23 against 20.29 on average). On this machine the frame still
waits on
victory-submit(71–80 % of a processor) and the list threads, so the freed time isn't what limits it.CPUs with fewer cores, or machines with other things running, are where this should show.
Tested:
cargo test --workspace --locked --no-fail-fast: 2,162 passed and 7 failed. The same tests fail on829188e9without this PR: three BCPack
oracle_parity_*tests invictory-formats,xmem::...a_read_by_range_waits...in
victory-hle, xtask'srepository_passes_policy(it flagsvictory-loader/src/heap_sites/frame_users.rs) andhost::menu::tests::a_change_is_saved_at_once.... One morevictory-gputest failed in each full run:card_steps::places_written_after_sending_are_learnedon main,menu::gray_shadow_lift_is_live...on thisbranch. Both pass when run alone (3 of 3), so they look order-dependent.
cargo test -p victory-gpu fsr: 9 passed, including new layout checks:SwapChainKeyValueis 40 bytes andPacingTuningis 20, withhybrid_spin_timeat offset 12 and the fence flag at 16.cargo clippyadds no warnings infsr.rs. Note that on829188e9itself,cargo clippy --workspace --all-targets -- -D warningsalready fails in code this PR doesn't touch:victory-loader/src/crash.rs:804unwind_copyis unused, andvictory-shader/src/emit/lower/analysis.rs:6/:467andemit/lower.rs:594have anunused import and
while_immutable_condition.AI-assisted (Claude Code); tested on the hardware above.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nikitronick-crypto on 2026-11-30T18:25:02Z.
A second 6-core machine for this PR, where it does move the frame.
Ryzen 5 7500F (6c/12t), RTX 3080 Ti 12 GB, 32 GB DDR5-4800, Windows 11 26300, driver 621.40.
v2026.11.30.01 (
c71899d9) release build, Series X, 2560x1440, DLSS Balanced, FSR 3 frame generation 2x.This PR applies cleanly on
c71899d9. FidelityFX answered code=0 hybrid=true fence=true.Same street, standing/walking, 9,400-10,100 draws a frame, medians of the 5 s frame lines.
Frame generation was switched in the F1 menu inside each run (on -> off -> on), so on and off share a run.
c71899d9c71899d9+ this PRSo on this CPU the default pacing costs about 8 ms of rendered frame time with frame generation on,
and this PR gives back 3-4 ms of it (about 14.5 -> 16 rendered fps). The two builds were separate runs,
and the run with the PR was ~2.4 ms faster with frame generation off too, which is why I count 3-4 ms
and not the full 6.5. Single lines range 57-69 ms, and the "off" segment with the PR is only 25 s.
No crash or device removal in the run; interpolated frames were at 2x the rendered rate.
Runs are from my own PC; the logs were read and this was written with an AI assistant (Claude).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.