GPU: throttle failed swap-chain creation and resize #1625
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1626"
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 Marvisak/VIctory. Originally posted by AwsAli05 on 2026-11-24T19:56:01Z.
Fixes #1591. Thanks to @fiestorra for identifying the per-frame DXGI calls and documenting the failure.
When DXGI refuses swap-chain creation or resize, wait one second before repeating the operation. The retry state lives beside the presenter under the existing lock. Frames that match an already working swap chain can still present during a failed resize's cooldown. Creation failures identify the failing step and log the requested dimensions and format.
The regression test simulates two seconds of frames at 60 Hz during a desktop outage. Only two calls reach the failing operation. It also verifies that a successful attempt immediately clears the cooldown.
On Windows, the GPU diagnostics suite passed 54 tests with one ignored benchmark. Clippy passed for the GPU crate with all targets and features. The regression used synthetic inputs.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:06:15Z.
Review: COMMENTED
Static review only: victory-gpu/victory-hle/apps are Windows-only (D3D12/windows_sys), so nothing here compiles or runs on macOS — please rely on the Windows CI leg.
Swap-chain creation/resize failures are throttled to one attempt per second via
SwapChainRetry(next_attemptset only onErr, cleared on success), so a desktop that is temporarily unavailable no longer spams DXGI calls and warnings every frame.Presentationbundles presenter+retry under the same mutex; the?onattemptreturnsNone(skip present) during backoff, which is the right frame-level behavior. Failure steps are now tagged ("window","DXGI factory","swap chain","copy list") — good for diagnosis. The unit test covers the 1s window and recovery; it is#[cfg(test)]in a Windows-only crate, so it runs on Windows only.Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T22:14:44Z.
Tested on Windows 11, RTX 4070 SUPER (driver 621.14), with the repo toolchain, merged into current
main(70564ae):cargo test -p victory-gpumainmain+ this PRmain,--all-featuresmain+ this PR,--all-featurescargo clippy --all-targets -- -D warnings, with and without--all-features: clean.victory-gputests fail on currentmainon this NVIDIA card:dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views. That's the 1,000,000-view heap cap, see #1744. They fail the same way with this PR, and no other test does.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.