Repository navigation
GPU/draw: fix per-heap refresh starvation & VRAM leak, OOB table drop… - #541
pug205gti6 wants to merge 1 commit into
Conversation
…s, and windowed indirect barrier Fix three defects in `crates/victory-gpu/src/draw.rs` and `crates/victory-gpu/src/descriptor/host.rs`: 1. `State::heap_buffers` & `HostHeap`: replace the process-global `static FRAME` and raw-pointer-keyed `static RANGES` (which starved a second view heap bound in the same frame and leaked `Arc<Shadow>` buffers forever without cleanup on heap destruction) with per-heap `last_frame`/`passes`/`ranges` keyed by a unique monotonic `HostHeap::id()`, cleaned up in `impl Drop for HostHeap` via `draw::forget_heap(self.id)`. Key `list.first_use` per host heap pointer so binding multiple view heaps on the same command list keeps each heap's strides buffer and refreshes its views. 2. `State::tables`: track tables that must be relocated because they reach past `host.count()` (`oob`), and push `(slot, u32::MAX)` into `made` if relocation fails (misaligned/sampler heap, missing host heap, or exceeding `DYNAMIC` / heap bounds), so `bind()` cleanly drops the draw instead of passing an out-of-bounds title offset to the GPU. 3. `State::execute_indirect`: record `hit_window = hit.is_some()` and skip calling `indirect::done(list, &bounded)` (`INDIRECT_ARGUMENT -> COMMON`) when `prepare` fails on a window hit, because `bounded` is already in `COMMON` from the prior draw's `done` and `ExecuteIndirect` never ran to implicitly promote it. Add synthetic unit test verifying per-heap frame tracking and `forget_heap` cleanup.
|
lgtm |
|
Duplicate of #481: @AscilCH opened this patch 40 minutes earlier, and Both PRs are CONFLICTING, so this copy does not resolve the conflict it was probably made for. Please continue in #481 so the review history and any test data stay in one place. |
|
Independent verification: PR #541 (GPU/draw: fix per-heap refresh starvation & VRAM leak) merges cleanly (fast-forward), 10 files changed, +659/-52 lines. Build: success (9s). Tests: fail due to pre-existing Linux-host issues (windows_sys crate not found, console_insn module not found, host_resource function not found — issue #90). PR introduces no regressions. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted. |
|
One more per-heap case in On my integration branch I keep the optional interval history with the heap. At the default interval no per-shadow history is needed because the pass already runs once per heap per frame. A two-heap test passed for both the default and a three-frame interval. |
…s, and windowed indirect barrier
Fix three defects in
crates/victory-gpu/src/draw.rsandcrates/victory-gpu/src/descriptor/host.rs:State::heap_buffers&HostHeap: replace the process-globalstatic FRAMEand raw-pointer-keyedstatic RANGES(which starved a second view heap bound in the same frame and leakedArc<Shadow>buffers forever without cleanup on heap destruction) with per-heaplast_frame/passes/rangeskeyed by a unique monotonicHostHeap::id(), cleaned up inimpl Drop for HostHeapviadraw::forget_heap(self.id). Keylist.first_useper host heap pointer so binding multiple view heaps on the same command list keeps each heap's strides buffer and refreshes its views.State::tables: track tables that must be relocated because they reach pasthost.count()(oob), and push(slot, u32::MAX)intomadeif relocation fails (misaligned/sampler heap, missing host heap, or exceedingDYNAMIC/ heap bounds), sobind()cleanly drops the draw instead of passing an out-of-bounds title offset to the GPU.State::execute_indirect: recordhit_window = hit.is_some()and skip callingindirect::done(list, &bounded)(INDIRECT_ARGUMENT -> COMMON) whenpreparefails on a window hit, becauseboundedis already inCOMMONfrom the prior draw'sdoneandExecuteIndirectnever ran to implicitly promote it.Add synthetic unit test verifying per-heap frame tracking and
forget_heapcleanup.