GPU & CLI: configurable/uncapped FPS limit, high-res pacing, high-refresh modes, and tearing swapchain #250
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!250
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-250"
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?
@wbkepler on GitHub · 2026-11-24 01:49 UTC · original
wbkepler:gpu/configurable-fps-limit→main· +757 −67 · 10 files · 1 commits · openSummary
Makes console frame pacing configurable (including uncapped) and upgrades host presentation for high-refresh displays:
victory-core,victory.example.toml,apps/victory):[graphics]section (fps_limit,allow_tearing) with#[serde(default)]toFileConfig(victory.example.tomlupdated).--fps <N>CLI flag onvictory run(0= uncapped) andVICTORY_FPS_LIMIT/VICTORY_ALLOW_TEARINGenv overrides (precedence:--fps> env >victory.toml> title default).victory-gpu/src/frame.rs):frame::set_fps_limit(Option<u32>)overridingSetFrameIntervalX(Some(0)returns immediately while advancing tokens/ticks;Some(n)setsround(1_000_000 / n)us logged once atinfo!).thread::sleepwith a thread-local Windows high-resolution waitable timer (CREATE_WAITABLE_TIMER_HIGH_RESOLUTION) plus 500 us spin tail (withthread::sleepfallback).FrameStatsviaframe::stats()while keeping the COM statistics entry point safe.dxgi.rs,host.rs):dxgi.rswith DXGIMORE_DATAsemantics.host.rsflip-model swapchain to 3 buffers and probesIDXGIFactory5::CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING), passingALLOW_TEARINGon creation,ResizeBuffers, andPresent(0, flags)with automatic fallback toPresent(0, 0).victory-core(10/10) andvictory-gpu(45/45).Verification
cargo clippy --workspace --all-targets— passed (zero new warnings)cargo clippy -p victory --features diagnostics --all-targets— passedcargo test --workspace— passedcargo xtask policy— passed (151 files ok)@GamingRipperDoc on GitHub · 2026-11-24 04:46 UTC · original
First test report, on Windows 10 + AMD: the uncapped limit works, but only until the title starts loading the story; from there on frames are paced at exactly 30 fps again.
Setup: Windows 10 22H2 19045.7846, RX 9070 XT (driver 32.0.32015.7029), Ryzen 9 9900X, 3840x2160 window.
maind2a4bae+ #175 (Agility SDK, needed on Windows 10) + #336 + this PR at8a84e85. One conflict with #175 inapps/victory/src/main.rs: both add lines toshow_configat the same spot; I kept both (d3d12 sdkthenfps_limit/tearing). Diag build,VICTORY_FPS_LIMIT=0.victory configshowsfps_limit : uncappedwith the env var and(title default)without it;tearing : true.frame interval overridden: uncapped (fps_limit = 0) title_interval=33.333msandpresenting to a window width=3840 height=2160 format=28 buffers=3 tearing=true.From the runtime's per-5 s
fps, ms/framelines:The uncapped part looked right to me: no visible speed-up of animation or audio, and no tearing I noticed. But after the switch the frames sit at exactly 33.3 ms while the work takes ~3 ms, so something keeps pacing them at 30 that
set_fps_limitdoesn't override: the title callingSetFrameIntervalXagain, a wait kind this PR doesn't cover, or the title's own timing. I didn't run withVICTORY_LOG=victory_gpu::frame=debug, which would show theframe wait kind=… timeout_ms=…lines; happy to, if that helps.No game data used.
AI-assisted (Claude Code); I played the run.
@jeremygold02 on GitHub · 2026-11-24 05:44 UTC · original
Tested current PR head
8a84e85c9d88f45205e40e235aaa5093e9edf085.cargo test --locked -p victory-core --lib config -- --test-threads=1: 6 passed. This covers optional graphics defaults, file parsing, environment-over-file precedence for FPS/tearing, and invalid environment values.cargo test --locked -p victory-gpu --lib frame -- --test-threads=1: 2 passed. The cases cover title-default, uncapped, and 60/120/144/240-FPS interval math; timeout/origin/flip token sequencing; an immediate uncapped loop; and frame statistics (clock tests).cargo test --locked -p victory-gpu --lib output_enumerates_high_refresh_modes -- --test-threads=1: 1 passed. It checks 4K 60/120/144/240-Hz modes, a custom host rate, duplicate removal, and the undersized-bufferMORE_DATAcase (mode test).cargo test --locked -p victory -- --test-threads=1: 1 passed and the CLI package built.cargo run --locked -p victory -- run --helpalso displays the new--fpsoption and its documented precedence; no title was run.These tests do not exercise a real swapchain, adapter/display tearing support, or the reported return to 30 FPS during story loading. The CLI package test is an existing loader-lock test, so it does not verify the
--fpsoverride in a running title.@wbkepler on GitHub · 2026-11-24 06:50 UTC · original
Thanks @GamingRipperDoc for the detailed report!
I audited every frame-pacing, wait, and present path across
victory-gpu(frame.rs,queue.rs,host.rs,dxgi.rs,device.rs) andvictory-hle:SetFrameIntervalXre-calls:FPS_LIMITis set once at startup (Some(0)for uncapped) and never reset. Any subsequentSetFrameIntervalXcall re-runseffective_interval(title_interval, Some(0))->None, so the uncapped override stays active.WaitFrameEventXevent kinds: whenintervalisNone,next_tick(kind)returnsDuration::ZEROfor every event kind (ORIGIN,VBLANK,FLIP, etc.), soframe::waitreturnsS_OKwith zero sleep.PresentX/ DXGI:Host::presentpassesSyncInterval = 0withDXGI_PRESENT_ALLOW_TEARING(andSyncInterval = 0on fallback), andIDXGIOutputhas noWaitForVBlanksleep path.That strongly points to the lock-back to 30.0 fps (33.3 ms) around frame ~13,866 being the title's own CPU-side frame/simulation limiter (e.g. a QPC +
Sleep/timer loop targeting 33.3 ms once it leaves early boot and enters the intro/menu/loading loop), rather than a second pacing path insidevictory-gpu.Pushed a small follow-up commit to
frame.rsso repeatedSetFrameIntervalXcalls also log atdebug(instead of being silenced byOnce), plus a test covering repeatedset_intervalcalls across all event kinds in uncapped mode. If you do another quick run withVICTORY_LOG=victory_gpu::frame=debug, checking whetherframe waitstill logswait_us=0during the 30.0 fps phase (and whether anyframe interval re-setlines appear) will confirm conclusively whethervictory-gpuis sleeping at all there.@wbkepler on GitHub · 2026-11-24 20:40 UTC · original
Rebased onto current main (
ffe310e) as6fa50e2; conflicts were in config.rs (upstream's flattest_titlesfile config vs this PR's[paths]/[graphics]split; its tests now useFileConfig) and theshow_configoutput (kept bothdata_dirand the fps lines). Gate (clippy -D warnings, tests, policy) clean.AI-assisted (Claude Code); checked on Windows 11 / RTX 5090.
@wbkepler on GitHub · 2026-11-24 22:18 UTC · original
Rebased onto
70564aeas6c2c141(squashed to one commit). Adapted: kept upstream'sfidelityfx_dirconfig key andshow_configline alongside the new[graphics]section/fps_limitoutput, and kept upstream's 50 ms tick in the frame pacing test (the PR's module-levelFLIPconstant replaces the test-local one). Gate: clippy -D warnings (core, gpu, victory, victory+diagnostics), tests andcargo xtask policypass; two pre-existing view-heap-cap tests fail identically on plain upstream on this host.AI-assisted (Claude Code); checked on Windows 11 / RTX 5090.
@Marvisak on GitHub · 2026-11-25 00:27 UTC · original · edited 2026-11-25 15:56 UTC
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-gpu/src/frame.rs,crates/victory-gpu/src/lib.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs-work) was for an older state ofmain.Generated by Claude Code
@wbkepler on GitHub · 2026-11-25 07:13 UTC · original
Rebased onto current main (
940d32f) as1899bb5; conflicts were with the frame-wait tick now taken before the sleep (kept upstream's, the uncapped path takes its tick too), the swap-chain retry/error steps (tearing flags folded into them) andrunnow returning the exit status (fpsadded).AI-assisted (Claude Code); checked on Windows 11 / RTX 5090.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.