Merge pull request #28 from wike1701/fix/dynamic-slot-heap-identity

GPU: release dynamic descriptor slots only to the host heap that allocated them
This commit is contained in:
trustno1-coder authored and GitHub committed 2026-11-27 01:45:53 -08:00
commit dc6dc87098
3 files changed
+54 -21

No files matched your search

+3 -3
View File
@@ -847,15 +847,15 @@ pub(crate) fn with_heap<T>(heap: usize, f: impl FnOnce(&Heap) -> T) -> Option<T>
}
/// Gives back dynamic slots of the host heap behind the title heap at
/// `heap`, if that heap still exists.
/// `heap`, if that host heap instance (`id`) still exists.
#[cfg(windows)]
pub(crate) fn release_dynamic(heap: usize, first: u32, n: u32) {
pub(crate) fn release_dynamic(heap: usize, id: u64, first: u32, n: u32) {
let heaps = SHADER_HEAPS.read().unwrap_or_else(|e| e.into_inner());
if heaps.iter().any(|&(_, _, h)| h == heap)
// SAFETY: registered heaps are live (removed when dropped).
&& let Some(Some(host)) = unsafe { &*(heap as *const Heap) }.host.get()
{
host.release(first, n);
host.release(id, first, n);
}
}