Reuse D3D12 texture readback buffers after command-list retirement #92
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from TaynanGT/Vice-Tay. Originally posted by cxy0072019-sketch on 2026-11-27T00:08:34Z.
Summary
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.
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T01:28:37Z.
Code review location:
crates/victory-gpu/src/host.rs; line 6000With 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.Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T01:28:37Z.
Review: CHANGES_REQUESTED
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.
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T02:24:58Z.
Code review location:
crates/victory-gpu/src/host.rs; line 6000I 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.
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T05:46:43Z.
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.Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:17:18Z.
mainhas moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the currentmainand open a new PR; I'll review it there.Pull request closed