GPU/draw: fix per-heap refresh starvation & VRAM leak, OOB table drops, and windowed indirect barrier #481
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/481"
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 fxceless/victory-fork. Originally posted by AscilCH on 2026-11-25T01:23:00Z.
Problem
Three defects in
crates/victory-gpu/src/draw.rs(andcrates/victory-gpu/src/descriptor/host.rs):Arc<Shadow>VRAM leak (State::heap_buffers):static FRAME: AtomicU64gated the entire mirror/refresh/texture pass across all view heaps, starving any second view heap bound in the same frame. Similarly,list.first_use(ONCE)used a single constant key per list rather than per host heap.static RANGESwas keyed by rawHostHeappointer and never removed entries when aHostHeapwas dropped, permanently leakingArc<Shadow>GPU buffers and risking stale range aliasing if a newHostHeapreused a freed address.State::tables):host.count()were added tofreshbecause the host heap has no direct slots for them. If relocation failed (n > DYNAMIC, misaligned table, orlastoutside the heap),tables()executedcontinuewithout pushing(slot, u32::MAX)tomade, sobind()did not drop the draw and instead handed the un-relocated OOB title offset to the GPU.INDIRECT_ARGUMENT -> COMMONbarrier on failed windowedexecute_indirect:VICTORY_INDIRECT_WINDOW=1hit an existing window (hit.is_some()),boundedwas already inCOMMON(left by the prior draw'sindirect::done). Ifpreparefailed (!ran),ExecuteIndirectnever ran (no implicit promotion), yet line 2438 unconditionally calledindirect::done(list, &bounded), emitting an invalidINDIRECT_ARGUMENT -> COMMONbarrier on aCOMMONbuffer.Fix
HostHeap::id()andimpl Drop for HostHeapcallingdraw::forget_heap(self.id).HEAP_RANGESbyhost.id()storing per-heaplast_frame,passes, andranges, and keylist.first_useby host heap pointer.oobtable slots inState::tablesand push(slot, u32::MAX)when relocation of an out-of-bounds table fails.indirect::done(list, &bounded)on!ranwhen!hit_window.heap_ranges_tracks_frames_per_heap_and_cleans_up_on_forget.Verification
cargo test -p victory-gpu --locked draw::tests -- --test-threads=1: 1 passed, 0 failedcargo test -p victory-gpu --locked descriptor -- --test-threads=1: 15 passed, 0 failedcargo xtask policy: 169 files okcargo clippy -p victory-gpu --all-targets --locked -- -D warnings: cleancargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings: clean(AI-assisted; synthetic unit tests only, no game data.)
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.