fix(gpu): failed swap-chain creation and resize are retried once a second #257
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!257
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-257"
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?
@mutlusinan on GitHub · 2026-11-27 20:11 UTC · original
mutlusinan:fix/swapchain-retry→main· +67 −11 · 1 files · 1 commits · openProblem
When the desktop cannot present — a locked session, a display mode change in progress — every presented frame tried again to create the swap chain or
ResizeBuffers. Each failure is expensive, and the warning was logged per frame: an outage lasting a minute cost thousands of DXGI calls and as many log lines.Fix
Presentation { presenter, retry }replacesMutex<Option<Presenter>>.SwapChainRetry::attempt(now, op):now >= next_attempt, otherwise returnsNone(the frame is dropped, as it already was on failure);Both the swap-chain creation and
ResizeBuffersgo through it. Presenter creation also reports which step failed (window, DXGI factory, swap chain, copy list), so a persistent failure is diagnosable from one warning.Verification
cargo check -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked— clean.cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked— no new warning in this code.swap_chain_failures_retry_once_per_second_and_success_clears_the_wait: 120 failed attempts over two seconds at 60 Hz make exactly 2 calls; a success clears the wait and the next call goes straight through (not run here:victory-gpuneeds Windows to build).Ported from DexNom/VIctory
f0967745, GPL-3.0.@mutlusinan on GitHub · 2026-11-27 20:21 UTC · original
Risk assessment (porting review)
SwapChainRetrygates both creation and resize, so a failed creation also spaces resize attempts; intended.presentreturnsNone, the same result a failed attempt gave before.mainate69e39c.@1tsethan on GitHub · 2026-11-27 23:00 UTC · original
Independent Windows validation of PR #257.
Tested commit:
76f787e0f2eb41ccf93ed43491494fc3801de3e1.cargo test --locked -p victory-gpu swap_chain_failures_retry -- --nocapture --test-threads=1Exit: 0.
Coverage here is the retry timing regression, not a live display-lock or mode-change recovery run.
Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result.
@cloph-dsp on GitHub · 2026-11-28 02:20 UTC · original
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
76f787e0f2eb41ccf93ed43491494fc3801de3e1; the PR is a single commit on parent0cef07e9d766df48f0e95f13ce3bbbe2290fe9d3(1 file, +67/-11 incrates/victory-gpu/src/host.rs). NOTE: the shallow local clone cannot computegit merge-base origin/main <pr>(returns empty), so the PR's actual single-commit parent was used as the base.cargo test --locked -p victory-gpu --lib -- host::tests::swap_chain_failures_retry_once_per_second_and_success_clears_the_wait --exact --test-threads=1 --quiet→ 1 passed, 0 failed, 455 filtered, exit 0.git grep -Ffor the test name on the base returned no hits (test is new on this PR);git diff --check 0cef07e9 HEADclean.CARGO_TARGET_DIR(never shared) withCARGO_BUILD_JOBS=2.AI-assisted (Hy4 flash).
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.