Reuse D3D12 texture readback buffers after command-list retirement #92
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/TaynanGT--Vice-Tay!92
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-92"
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?
@cxy0072019-sketch on GitHub · 2026-11-27 00:08 UTC · original
cxy0072019-sketch:codex/texture-readback-pool→main· +402 −12 · 2 files · 2 commits · openSummary
Backport the optional D3D12 texture readback pool from Cool Fox, preserving its authorship. The pool keeps a readback buffer leased while a closed command list can still replay it. Retired buffers can be reused in bounded size classes. The relay also rejects the device-removal fence value before retiring pooled buffers.
Enable with
VICTORY_READBACK_POOL=1.VICTORY_READBACK_POOL_MBsets the idle-byte limit in MiB, with a default of 256 MiB. Oversized requests and failed rounded allocations use the original requested size.Validation
readback_pooltests passed. They cover lease exclusivity and idle limits, the original-size fallback, and a closed D3D12 command list replayed before its lease can be reused.The pool held at most 20.25 MiB idle in this run. Both runs recorded zero readback allocation failures. The longer route varied with other boats and shoreline geometry. These measurements primarily establish the reduction in allocations.
@TaynanGT on GitHub · 2026-11-27 01:28 UTC · original · requested changes
Thanks, @cxy0072019-sketch. I checked the lease lifetime and the original-size fallback. The Windows CI logs show all four pool tests passing in both builds, including replaying a closed D3D12 list before reset. There's one device-removal reporting issue to fix before this goes in.
@ -5692,6 +5997,7 @@ impl Host {Err(e) => tracing::warn!(error = %e, "submissions sent ahead not waited for"),}}self.verify_texture_readback_fence(*submitted);@TaynanGT on GitHub · 2026-11-27 01:28 UTC · original
With the pool enabled,
GetCompletedValue()returnsu64::MAXon device removal, so this call reachesfailbefore the existing branch can reportremoval_data(&runs)andlast_notes(&runs)for the affected lists. The direct submission path has the same ordering. Can both paths handle device removal with the existing list details first and still verify the fence before any readback or retirement? In the direct path, the removal check would need to move up too, sinceFINISHEDandburyare currently ahead of it.@ -5692,6 +5997,7 @@ impl Host {Err(e) => tracing::warn!(error = %e, "submissions sent ahead not waited for"),}}self.verify_texture_readback_fence(*submitted);@TaynanGT on GitHub · 2026-11-27 02:24 UTC · original
I prepared a follow-up in #118 on top of your commits. The fence sentinel now goes through the existing device-removal report in both synchronous submission paths, while an incomplete fence still stops recycling. The new regression and the full CI passed. The opt-in title run is still pending.
@TaynanGT on GitHub · 2026-11-27 05:46 UTC · original
Thanks for including the closed-list replay case, @cxy0072019-sketch. It covers the lease lifetime, and the 17,405-to-zero allocation count is the concrete result from your stationary run.
The branch currently conflicts with
main. #166 has since changedhost.rsandtexback.rs, so the pool needs to sit on the current readback path. The replay lease test and the device-removal fence guard should carry through that reconciliation.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.