GPU: a lost host list's heaps are not a wanted pair #3037
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3039"
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 Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T04:54:29Z.
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
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T04:59:27Z.
Review: APPROVED
Static review of
851b5290againstcrates/victory-gpu/src/draw.rsandcrates/victory-gpu/src/memory.rs.Confirmed the root cause on
main:crate::memory::OURSisusize::MAX,SAMPLERS_OURSisusize::MAX, soState::wanted([0, 0], true)returns[usize::MAX, usize::MAX], which collided with the[usize::MAX; 2]sentinel written byState::host_state_lost(). Aftercut()orexternal::record,bind_heapstreated the lost state as already matchingwantand skippedSetDescriptorHeaps.Switching
host_heapstoOption<[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).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.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T06:32:42Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):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).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:14:45Z.
Automated triage for the maintainers.
I confirmed the bug on
main. Incrates/victory-gpu/src/draw.rs,MEMORY_HEAP(memory::OURS) andSAMPLERS_OURSare bothusize::MAX.State::wanted([.., 0], true)therefore returns the same[usize::MAX; 2]thatState::host_state_lostuses as its marker, so after a cutbind_heapsbinds nothing. This PR makeshost_heapsanOption<[usize; 2]>and usesNoneas the lost state. Nowantedpair can equalNone, so this kind of sentinel collision can no longer happen.host_heapsis touched only inhost_state_lostandbind_heaps. The defaultNonefor a newStatealso forces the first bind, as the old[0, 0]did. The test covers everywantedcombination. CI:checkpassing.Note for the maintainers: #2882 fixes the same issue, #2881, by moving
SAMPLERS_OURStousize::MAX - 1, and it is also labelled as a merge candidate. Only one of the two should land. This one removes the sentinel instead of picking a different value, so I would prefer it, but that is your call.Generated by Claude Code
upstream-sync referenced this pull request2026-11-26 07:01:46 +00:00
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.