MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator / FreeDedicatedMemory

Method FreeDedicatedMemory

include/vk_mem_alloc.h:15353–15389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15351}
15352
15353void VmaAllocator_T::FreeDedicatedMemory(VmaAllocation allocation)
15354{
15355 VMA_ASSERT(allocation && allocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_DEDICATED);
15356
15357 const uint32_t memTypeIndex = allocation->GetMemoryTypeIndex();
15358 VmaPool parentPool = allocation->GetParentPool();
15359 if(parentPool == VK_NULL_HANDLE)
15360 {
15361 // Default pool
15362 m_DedicatedAllocations[memTypeIndex].Unregister(allocation);
15363 }
15364 else
15365 {
15366 // Custom pool
15367 parentPool->m_DedicatedAllocations.Unregister(allocation);
15368 }
15369
15370 VkDeviceMemory hMemory = allocation->GetMemory();
15371
15372 /*
15373 There is no need to call this, because Vulkan spec allows to skip vkUnmapMemory
15374 before vkFreeMemory.
15375
15376 if(allocation->GetMappedData() != VMA_NULL)
15377 {
15378 (*m_VulkanFunctions.vkUnmapMemory)(m_hDevice, hMemory);
15379 }
15380 */
15381
15382 FreeVulkanMemory(memTypeIndex, allocation->GetSize(), hMemory);
15383
15384 m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(allocation->GetMemoryTypeIndex()), allocation->GetSize());
15385 allocation->Destroy(this);
15386 m_AllocationObjectAllocator.Free(allocation);
15387
15388 VMA_DEBUG_LOG_FORMAT(" Freed DedicatedMemory MemoryTypeIndex=%" PRIu32, memTypeIndex);
15389}
15390
15391uint32_t VmaAllocator_T::CalculateGpuDefragmentationMemoryTypeBits() const
15392{

Callers

nothing calls this directly

Calls 9

GetTypeMethod · 0.80
UnregisterMethod · 0.80
GetMemoryMethod · 0.80
RemoveAllocationMethod · 0.80
GetMemoryTypeIndexMethod · 0.45
GetParentPoolMethod · 0.45
GetSizeMethod · 0.45
DestroyMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected