GPU: a present waits for its copy before reading the probe and capture #197
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/Belobug--VIctory-Belobug-AMD!197
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-197"
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?
@WHOISJARDAS on GitHub · 2026-11-25 21:11 UTC · original
WHOISJARDAS:gpu/async-present-wait→main· +13 −0 · 1 files · 1 commits · openWith
VICTORY_ASYNC_SUBMIT=1the presenter's copy list can still be queued whenexecutereturns. In diagnostics builds (the build this README runs),presentthen reads the black-frame probe, and a wanted capture, before the copy has run, and drops them when it returns. The D3D12 debug layer stops atEXECUTION ERROR #921: OBJECT_DELETED_WHILE_STILL_IN_USEinHost::present; without the debug layer the device is removed reading the freed probe (DRED:page fault at 0x20005a000; inside freed [8 × unnamed (type 34)], the same address every run, a buffer made and freed on each present).presentandpresent_overnow wait for the in-flight work when they have a probe or a capture to read. Release builds have neither, so nothing changes there.Tested
RX 9070 XT 16 GB (driver 32.0.32029.2010), Ryzen 7 9800X3D, Windows 11 26200, Series X profile, this README's settings,
VICTORY_ASYNC_SUBMIT=1:4cbe9d7(+ #39 so that it starts here)VICTORY_D3D12_DRED=1,VICTORY_KEEP_RETIRED=1andVICTORY_D3D12_DEBUG=1runs)For what it's worth, on the same save and camera async submission did not raise the frame rate here: median 4.6 fps with it, 5.4 without (most world submissions copy back, which makes them wait anyway). So this only makes the switch usable for experiments; it keeps its default.
AI use: Claude Code (Claude Opus 5.5) found the freed object with DRED and the debug layer and wrote the change; the hardware and runs are mine.
🤖 Generated with Claude Code
@adrianmjim on GitHub · 2026-11-26 19:46 UTC · original
Tested natively on Windows 11 (build 26300) with an RX 7900 XT (driver 32.0.32029.2010), at head
48821bf, its base4cbe9d7, and current main4f62c2a.Main has had a fix for the same crash since
9b89ec2(2026-11-25), which is after this PR's base:9b89ec2addsHost::execute_title. Only the title's submissions (queue.rs) may now return before the GPU is done.presentandpresent_overstill callHost::execute, which passes nokeep. That makescan_asyncfalse, so the call waits on its fence before it returns.presentreads them. With this PR applied to4f62c2a, the two newwait_in_flight()calls have nothing of the present's own left to wait for.Also,
a59f3e5on main makes async submission the default (VICTORY_ASYNC_SUBMIT=0turns it off). So the line about the switch keeping its default is out of date on main.What I ran:
cargo test -p victory-gpu --lib, debug build, with and without--features diagnostics.4cbe9d7and the PR head: 3 runs each, interleaved.4f62c2aand main + this PR (merges cleanly): 2 runs each, interleaved.frame::tests::waits_end_on_ticks_and_count_frames(most runs),depth_bounds_control_a_title_drawand twowatch::testsfailures. Other heavy jobs were running on the machine at the same time.Not tested:
4cbe9d7, and I did not run the game on main with diagnostics and async submission.can_asyncis off undercfg(test).Unless there is a path on main where a present's copy can still return early, this PR looks superseded by
9b89ec2.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.