GPU: a released view heap takes its title memory page table with it #2234
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2234
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2234/head"
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?
@denkencar-sketch on GitHub · 2026-11-25 08:31 UTC · original
denkencar-sketch:fix/view-heap-shared→main· +48 −0 · 2 files · 1 commits · merged 2026-11-25 21:55 UTCSummary
A view heap that is released keeps its title memory page table.
Heap::dropremoves the heap fromSHADER_HEAPSbut never frommemory::SHARED, so:Arc<Shadow>copies it names live on for the rest of the process, andShared::hostis meant to tell the two heaps apart ("a heap made later at a released one's address is another"), but it is the address of theHostHeap, which sits inline inHeap::host(OnceLock<Option<HostHeap>>), so it is the heap's address plus a constant and always equal. The old view pairs,nullslot andgenerationare then reused on the new host heap.Change
memory::release(key)drops the heap'sSHAREDentry;Heap::dropcalls it after letting go of theSHADER_HEAPSlock (bindandpreparetake the table's lock inside the heaps' lock, so it is not taken the other way round). Lists that named the table hold their own clone of it, as the existing comment inbindsays.Testing
descriptor::tests::a_released_view_heap_drops_its_page_tablecreates a shader-visible view heap, binds a list (making its table), releases the heap and checks the table is gone. It fails onmain("released with its heap") and passes with this change.cargo clippy --workspace --all-targets [--all-features] --locked -- -D warningsis clean.Not tried: a run in the game, and the address-reuse case itself (the test shows the table outliving its heap, which is what makes the reuse possible).
modules::dstorage::tests::a_page_list_filled_after_its_request_startsfails now and then onmaintoo (5 of 20 runs ofcargo test -p victory-hle --lib); it is unrelated.AI-assisted.
@Marvisak on GitHub · 2026-11-25 13:30 UTC · original
Automated triage for the maintainers.
Merge candidate (worth a look).
Heap::dropindescriptor.rsnow calls a newmemory::release(key)that drops the heap'sSHAREDpage-table entry, after letting go of theSHADER_HEAPSlock (matching the heaps-then-table ordermemory::binduses). Onmainthe entry outlives its heap, and thes.hostcheck inbindcannot tell a later heap at the same address apart, since theHostHeapsits inline inHeap, so its address is the key plus a constant; lists keep their own clone of the table, so dropping the entry is safe. A test covers the release, and CIcheckpasses on this head.Generated by Claude Code