Vulkan: Fix ResourceHeap leak for direct-allocated resources.
Bug: chromium:1081051 Change-Id: I1f68ebf21033fb9cf925b5cbc3915667b61290fa Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21460 Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
4fa5ad4bf0
commit
b6eeee0aa3
|
@ -152,10 +152,13 @@ namespace dawn_native { namespace vulkan {
|
||||||
|
|
||||||
// For direct allocation we can put the memory for deletion immediately and the fence
|
// For direct allocation we can put the memory for deletion immediately and the fence
|
||||||
// deleter will make sure the resources are freed before the memory.
|
// deleter will make sure the resources are freed before the memory.
|
||||||
case AllocationMethod::kDirect:
|
case AllocationMethod::kDirect: {
|
||||||
mDevice->GetFencedDeleter()->DeleteWhenUnused(
|
ResourceHeap* heap = ToBackend(allocation->GetResourceHeap());
|
||||||
ToBackend(allocation->GetResourceHeap())->GetMemory());
|
allocation->Invalidate();
|
||||||
|
mDevice->GetFencedDeleter()->DeleteWhenUnused(heap->GetMemory());
|
||||||
|
delete heap;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Suballocations aren't freed immediately, otherwise another resource allocation could
|
// Suballocations aren't freed immediately, otherwise another resource allocation could
|
||||||
// happen just after that aliases the old one and would require a barrier.
|
// happen just after that aliases the old one and would require a barrier.
|
||||||
|
|
Loading…
Reference in New Issue