GPU: a run with no presentable desktop asks DXGI for a swap chain once per frame (1,654 warnings in 60 s) #1591
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#1591
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@fiestorra on GitHub · 2026-11-24 19:33 UTC · original
What's wrong
Host::present(crates/victory-gpu/src/host.rs) retries the whole presenter path on every presented frame while the presenter is absent, and logs aWARNfor each attempt:A run whose desktop cannot be presented on (locked screen, sleeping display, a session with no visible desktop) therefore does
CreateDXGIFactory2+CreateSwapChainForHwndonce per frame and writes one line per frame. The same shape exists in the resize path (swap chain not resized).Measured today on my machine (RTX 4090, driver 621.24, Windows 11 26100, package 1.0.2.1, diagnostics build, empty cache), while the desktop happened to be un-presentable:
no swap chainlinesmainffe310e, 60 smainffe310e, 60 s (second probe)That is roughly one and a half attempts per presented frame; the first run's log was 311 KB after 60 seconds, about four fifths of it these lines, and nothing else in it can be read. Two different errors appear, so the failure is not even stable:
0x887A0022"a resource is not available at the time of the call, but may become available later" — the transient case retrying is for;0x8007000E"not enough memory resources are available to process this command".Neither line says which step failed.
presenter()funnels the window, the factory, the swap chain and the copy list into one error, so the log cannot tell a missing window from a refused swap chain.This is not a hang and not the cause of the device removals people report; it is a state that a tester behind a locked screen hits immediately, and it costs work and log every frame in it.
The fix
One failure state on
Host, a backoff that grows and caps, and log lines that say what failed:Retry { attempts: u32, next: Option<Instant> }withdue(now)/failed(now)/reset(); the wait isretry_delay(attempts)= 100 ms doubling to a 1 s cap, so a state that clears recovers within a second.present()returns early (no DXGI call, no log) until the retry is due; the resize path uses the same gate.WARNnaming the step and the frame size; later ones areDEBUGwith the attempt count. When a presenter finally appears, oneINFOreports how many attempts failed.presenter()returnsResult<Presenter, (PresentStep, windows::core::Error)>, namingwindow,DXGI factory,swap chainorcopy list.Five unit tests cover the schedule (100/200/400/800/1,000/1,000 ms), the gate, the reset, the step names, and a simulated minute at 20 fps with no desktop — bounded to 63 attempts where the old code made 1,200.
Measured effect
Same machine state, same command, patches applied to
ffe310eonly:no swap chainlinesmainunmodified (target\main-check, release)Both runs ended at frame 128 with the same
host GPU device removed after a submission of 1 lists(0x887A0004/0x887A0007), so the two windows are directly comparable — and that removal reproduces identically on the unmodified binary, so it is not from this change.Verification run:
cargo test -p victory-gpu present_retry→ 5 passed;cargo clippy -p victory-gpu --all-targets --locked -- -D warnings→ clean;rustfmt --checkon the file reports only hunks in pre-existing code, none in the added lines.The patch
External PRs are collaborators-only here, so the diff is below; apply it on
ffe310eand it builds clean.crates/victory-gpu/src/host.rs (+212 −13)
No game data is involved: no shaders, textures, keys or package bytes, only counts and error codes.
Written with an AI assistant.
github-bot referenced this issue2026-11-26 04:38:56 +00:00
@fiestorra on GitHub · 2026-11-24 20:19 UTC · original
Correction: this measurement ran on the integrated GPU, not on the RTX 4090
The runs behind this report took adapter 0, which on this machine is
AMD Radeon(TM) Graphics, the Ryzen's integrated GPU (driver32.0.21045.29003). The RTX 4090 is adapter 1 (32.0.16.2124, the 621.24 marketing version), andD3D12CreateDevice(None, …)— whatcrates/victory-gpu/src/host.rscalls — takes DXGI's default adapter, the first one enumerated. The numbers stand, because they are what that adapter did; the hardware I named in the report does not.The defect itself does not depend on it: the retry storm and the backoff live in the present path, which every adapter shares, and the 131-against-1 count is per presented frame either way.
The adapter selection, the log line that now names the adapter, and what each one answers (mesh tier not supported on adapter 0, tier 1 on adapter 1) are in #1630, together with the three fixes in this report.
Written with an AI assistant.