Keep HUD staging and display buffers alive until the GPU finishes #359
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!359
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-359"
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?
@ANDREANIADS on GitHub · 2026-11-26 21:51 UTC · original
ANDREANIADS:fix-hud-submission-lifetime→a-publier· +30 −38 · 1 files · 1 commits · openResizing the optional HUD or changing its swap-chain format abandons its previous card buffer and four upload buffers via
mem::forget. Repeated format or scale changes retain every set. The four upload slots also rotate by time. If more than four refreshes are recorded before execution, a later refresh can overwrite bytes that an earlier command still needs.The patch stages each new picture at an offset in the recording command list’s upload storage and keeps the display buffer on that list through submission. A scale or format change can then release the panel’s reference. No wait is added to the drawing path. Failed staging reuses an existing picture when available and retries at the next sample. At 4K with an FP16 swap chain the surface exceeds the 4 MiB scratch page, so that refresh can require a dedicated scratch allocation.
Before and after on two physical adapters
I recorded nine synthetic HUD updates before submitting their command lists together. The sequence included two scales, RGBA8 and FP16, and a nonzero upload offset. The panel stayed alive through execution. After waiting on the queue’s fence, I compared the card-buffer readbacks to the expected packed pixels and reset the completed lists.
cd8dfc0I ran the attached regression separately on a GeForce RTX 3070 and on Intel UHD Graphics 630. Both reproduced the same two mismatches in the original and all nine byte-exact readbacks with the patch. On both adapters the first retired buffer had two references after completion on the original and only the observer on the fixed build. The Intel run exercises D3D12 copies and resource lifetime independently of the game’s shader requirements.
All three existing HUD unit tests passed. I checked that the patch applies independently to the default branch and on top of #348. Validation used Rust 1.98.0 MSVC and locally available dependencies. The experiment measures resource lifetime and pixel correctness under a delayed submission. It does not measure gameplay frame rate.
Implemented and tested with Codex.
Reproduce the queued readback
The attached test patch applies to the base and the proposed change. Extract it, then run from the repository root on Windows with a D3D12 adapter. Substitute the adapter name if needed.
hud-delayed-regression.zip
@lvndrpup on GitHub · 2026-11-27 05:30 UTC · original · reviewed
A check of how this sits on the current
a-publier, since it was cut fromcd8dfc0. Your RTX 3070 and UHD 630 runs already cover the behaviour, so this is only about the merge.cf46420merges into4eb6cfdwith no conflict; git merges itspanel.rswith the changes made there sincecd8dfc0. On the merged tree (RTX 3060 Ti 8 GB, Windows 11 build 26300, Rust 1.98.1, debug):victory-gpucargo test --libcargo clippy --all-targets -- -D warnings--all-featuresI did not run your attached regression or the HUD in a game.
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.