Repository navigation
GPU: keep view_addresses upload buffer alive on command lists - #2543
reeledMarek wants to merge 1 commit into
Conversation
3823ea1 to
b451ae7
Compare
|
Automated triage for the maintainers. Merge candidate. Narrowed after the rebase, now that #1906 handles CI: Generated by Claude Code |
b451ae7 to
5e5dcbc
Compare
|
Rebased cleanly onto current |
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed and verified at head 5e5dcbc1 against origin/main (63bcca43) on Windows 11 (RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1):
- Design & correctness:
- Returning
Option<(&ID3D12Resource, u64)>fromHostHeap::view_addresses(crates/victory-gpu/src/descriptor/host.rs:567-590) and callinglist.keep(table)incrates/victory-gpu/src/draw.rs:852-864beforeSetComputeRootShaderResourceView/SetGraphicsRootShaderResourceViewcloses the lifetime gap if aHostHeapis dropped while a command list referencing its view-address table is still recording or executing. - Checked every
view_addressescall site across the workspace (draw.rs:711-714,draw.rs:852-864,descriptor/host.rs:2151):draw.rs:862is the sole GPU binding site and matches the existinglist.keep(table)pattern used atdraw.rs:676, 818.HostList::reset()dropsself.deferred().keptcleanly with no leaks, verified byview_addresses_buffer_stays_alive_on_list(descriptor/host.rs:2467-2493). - Note for maintainers:
#2543and#2542have no production-code overlap (only a trivial test-append conflict at the bottom ofcrates/victory-gpu/src/descriptor/host.rs).
- Returning
- Verification:
- Clean
git merge-treeagainstorigin/main(63bcca43);cargo xtask policy(191 files ok);cargo clippy -p victory-gpu --all-targets -- -D warningsclean with default features and--all-features. - RTX 5090 (default):
view_addresses_buffer_stays_alive_on_list1/1 passed. - RTX 5090 +
VICTORY_D3D12_DEBUG=1(--features diagnostics):descriptor::host::tests+draw::tests35/35 passed (skipping pre-existing NVIDIA 1M view-heap capdynamic_slots_are_held_until_released). - WARP (
VICTORY_D3D12_WARP=1) +VICTORY_D3D12_DEBUG=1:descriptor::host::tests+draw::tests36/36 passed.
- Clean
LGTM.
…er alive on command lists
Dukestar69
left a comment
There was a problem hiding this comment.
LGTM — verified on RTX 5090 (Windows / D3D12) against origin/main (63bcca4).
- Returning
(&ID3D12Resource, u64)fromHostHeap::view_addresses()and callinglist.keep(table)prevents use-after-free on the view-address upload buffer if the title releases the descriptor heap before the recorded command list executes. cargo test -p victory-gpu --lib descriptor::host::tests::view_addresses_buffer_stays_alive_on_list -- --test-threads=1: passed.cargo test -p victory-gpu --lib descriptor::host::tests::view_addresses_cover_tables_made_afresh -- --test-threads=1: passed.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Summary
HostHeap::view_addressespreviously returned only the raw GPU virtual addressu64, so command lists bindingstage.view_addressesnever calledlist.keep(...)on the underlyingID3D12Resource. If theHostHeapis dropped while a command list usingview_addressesis still recording or executing, the GPU reads freed memory.Option<(&ID3D12Resource, u64)>fromHostHeap::view_addresses()and calllist.keep(table)incrates/victory-gpu/src/draw.rsbefore setting the root SRV.main(63bcca4, preserving GPU: view addresses for tables made afresh (dynamic slots) #1906'saddress_slots()sizing andview_addresses_cover_tables_made_afreshinvariants) and added a COM refcount regression testview_addresses_buffer_stays_alive_on_list.