fix(gpu): failed swap-chain creation and resize are retried once a second #257
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mutlusinan on 2026-11-27T20:11:44Z.
Problem
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.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mutlusinan on 2026-11-27T20:21:32Z.
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.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 1tsethan on 2026-11-27T23:00:23Z.
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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-11-28T02:20:37Z.
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).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mutlusinan on 2026-11-28T12:01:33Z.
Rebased onto current
main(one conflict resolved)Rebased onto
63b902f(force-with-lease).host.rsmoved under this change, so theResizeBuffershunk conflicted:mainnow passeschain_flags(p.tearing)instead ofDXGI_SWAP_CHAIN_FLAG(0). The resolution keepsmain's flags and only wraps the call inretry.attempt(...); the retry logic is unchanged.Re-verified:
cargo check --workspace --target x86_64-pc-windows-msvc --lockedclean, andcargo clippy -p victory-gpu --all-targetsreports nothing in the new code.The risk note above still holds. CI shows
action_required(maintainer approval to run a fork's workflow).