MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / FreeDedicatedMemory

Method FreeDedicatedMemory

include/vk_mem_alloc.h:14810–14846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14808}
14809
14810void VmaAllocator_T::FreeDedicatedMemory(VmaAllocation allocation)
14811{
14812 VMA_ASSERT(allocation && allocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_DEDICATED);
14813
14814 const uint32_t memTypeIndex = allocation->GetMemoryTypeIndex();
14815 VmaPool parentPool = allocation->GetParentPool();
14816 if(parentPool == VK_NULL_HANDLE)
14817 {
14818 // Default pool
14819 m_DedicatedAllocations[memTypeIndex].Unregister(allocation);
14820 }
14821 else
14822 {
14823 // Custom pool
14824 parentPool->m_DedicatedAllocations.Unregister(allocation);
14825 }
14826
14827 VkDeviceMemory hMemory = allocation->GetMemory();
14828
14829 /*
14830 There is no need to call this, because Vulkan spec allows to skip vkUnmapMemory
14831 before vkFreeMemory.
14832
14833 if(allocation->GetMappedData() != VMA_NULL)
14834 {
14835 (*m_VulkanFunctions.vkUnmapMemory)(m_hDevice, hMemory);
14836 }
14837 */
14838
14839 FreeVulkanMemory(memTypeIndex, allocation->GetSize(), hMemory);
14840
14841 m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(allocation->GetMemoryTypeIndex()), allocation->GetSize());
14842 allocation->Destroy(this);
14843 m_AllocationObjectAllocator.Free(allocation);
14844
14845 VMA_DEBUG_LOG_FORMAT(" Freed DedicatedMemory MemoryTypeIndex=%" PRIu32, memTypeIndex);
14846}
14847
14848uint32_t VmaAllocator_T::CalculateGpuDefragmentationMemoryTypeBits() const
14849{

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected