Repository navigation
GPU: a lost host list's heaps are not a wanted pair - #3039
kotekompotek wants to merge 1 commit into
Conversation
fuzeofficlal
left a comment
There was a problem hiding this comment.
Static review of 851b5290 against crates/victory-gpu/src/draw.rs and crates/victory-gpu/src/memory.rs.
Confirmed the root cause on main: crate::memory::OURS is usize::MAX, SAMPLERS_OURS is usize::MAX, so State::wanted([0, 0], true) returns [usize::MAX, usize::MAX], which collided with the [usize::MAX; 2] sentinel written by State::host_state_lost(). After cut() or external::record, bind_heaps treated the lost state as already matching want and skipped SetDescriptorHeaps.
Switching host_heaps to Option<[usize; 2]> is cleaner than introducing another magic sentinel:
State::default()initializeshost_heapstoNone, matching the prior behavior ([0, 0]never matchedwanted's non-zero sampler slot either).- All four
host_heapssites indraw.rsare updated consistently,host_rootsis still cleared wheneverSetDescriptorHeapsruns, and the unit test covers all combinations of(views, samplers, memory_heap)afterhost_state_lost().
Note for maintainers: this addresses the same issue (#2881) as #2882; the Option<[usize; 2]> approach here eliminates sentinel collisions by type.
host_state_lost marked host_heaps [usize::MAX; 2], but a list that binds no heaps and reads title memory wants [MEMORY_HEAP, SAMPLERS_OURS] — the same pair. After a cut or an external record, bind_heaps found them equal and bound nothing; the next directly-indexing root signature ran with no heaps, the device removal Marvisak#1778 was written to prevent. None now marks the lost state: it equals no pair wanted can make, so the next bind_heaps binds again. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
851b529 to
c141c1f
Compare
|
Automated triage for the maintainers. I confirmed the bug on Note for the maintainers: #2882 fixes the same issue, #2881, by moving Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):
- Diff review: Changing
State::host_heapstoOption<[usize; 2]>withNoneinhost_state_lost()cleanly eliminates the sentinel collision with[MEMORY_HEAP, SAMPLERS_OURS]([usize::MAX; 2], #2881) so heaps are always rebound after a lost host state. cargo test -p victory-gpu draw::tests -- --test-threads=1(RTX 5090 & WARP): 21 passed, 0 failed on both (includinga_lost_host_state_matches_no_wanted_heaps).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
Fixes #2881.
host_state_lostmarkedhost_heaps[usize::MAX; 2], but a list that binds no heaps and reads title memory wants[MEMORY_HEAP, SAMPLERS_OURS]— the same pair. After a cut (Wait32/64BitValueX, 0–21 per world frame) or anexternal::record(FidelityFX),bind_heapsfound them equal and bound nothing: the next directly-indexing root signature ran with no heaps bound — debug layer id 1419, the device removal on NVIDIA that #1778 was written to prevent (#1754).host_heapsis nowOption<[usize; 2]>:Nonemarks the lost state and equals no pairwantedcan make, so the nextbind_heapsbinds again. This removes the whole sentinel-collision class rather than picking a different one.Test plan
cargo test -p victory-gpu --lib heaps— newa_lost_host_state_matches_no_wanted_heapsfails on the old[usize::MAX; 2]marker forwanted([0,0], true), passes underOptioncargo clippy -p victory-gpu --all-targets --locked -- -D warningsclean (msvc)Generated with Devin