draw.rs: a list gives its dynamic descriptor slots back to whatever heap now has the old heap's address #392
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#392
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Jesper-Andersson on GitHub · 2026-11-26 22:38 UTC · original
A command list records the dynamic descriptor slots it took by the title heap's address, and gives them back to whatever shader-visible heap is registered at that address when it is reset or released. If the title has released that heap meanwhile and a new one was made at the same address, the old list frees slots of the new heap that another live list holds, so two lists end up sharing slots.
Where
At
126acb3:crates/victory-gpu/src/draw.rs:499-501: the slots a list holds are kept by heap address:crates/victory-gpu/src/draw.rs:516-521and1088-1091: a reset (*self = State::default()) or a release drops the oldState, which gives every range back by that address:crates/victory-gpu/src/descriptor.rs:862-870:release_dynamicfrees the range in the heap registered at that address now:Heap'sDrop(descriptor.rs:908-915) removes the heap fromSHADER_HEAPS, and a new heap is aBox<Heap>(descriptor.rs:1740) registered by its address (descriptor.rs:1760-1764), so the allocator can hand a new heap the old one's address.Why it matters
tables_donegives them back right after a run, so this covers lists that were recorded but never run, and lists that ran throughsubmit_split(VICTORY_CUT_WAITS=0, wheretables_doneisn't called for the lists run at once).SHADER_HEAPS, which is valid once the GPU no longer needs the heap.Box<Heap>at H's old address. List M takes dynamic slots from H2.release_dynamic(H's address, ...)finds H2 and frees ranges of H2 that M holds.The same address-for-identity pattern was the cause of #232 (
FLIPSandNEW_PENDINGkeyed byHostHeap), and #265 addresses pending flips when a host heap is dropped. Neither covers the list's dynamic slots. #48 drains a list's ranges once its flight completes, so the list's later drop can't free slots that were handed out again in the same heap. It doesn't apply to a list that never ran and whose heap was replaced at the same address.Suggestion
HostHeapan identity from a process-wide counter, record it next to the heap address inState::dynamic, and free a range inrelease_dynamic/HostHeap::releaseonly when the identity matches. A release for a heap that is gone, or for a new heap at the old address, then does nothing: the host heap it named, and its slots, no longer exist. This is what fxceless/victory-fork#1324 did (merged there 2026-11-26). Its test is two host heaps, where a range of A released with B's identity stays taken and with A's identity is given back.Not checked
Found by reading the source at
126acb3. Not reproduced, and I have no game run showing it. I haven't checked how often the title releases a shader-visible heap while lists that used it are still unreset, or whether the allocator reuses the address in practice. If it never does, this is latent. I haven't checked whether a list keeps a reference to the heaps it sets (that would close step 3).AI use
AI-assisted review (source reading), with Claude Code. No build, no hardware run, no game files.
@akimfomin on GitHub · 2026-11-26 23:27 UTC · original
The exact heap-lifetime guard is already in fxceless via CwWwWwW’s #1324. I confirmed avatarmanz main
014d52dstill releases by address, then tried only the three-file fix, using its actual parent58de9bfas the base. It conflicts indescriptor.rs,descriptor/host.rsanddraw.rs. Fxceless carries the heap ID with each range and rejects a mismatched release.The smallest follow-up is to port that ID guard along the three existing paths and carry the two-heaps WARP regression as the first check. The wrong-ID release must leave the new heap's range live, while the correct ID still frees it. Source/Git check only on the receiving fork. PortBridge · AI-assisted comparison.