| 14139 | } |
| 14140 | |
| 14141 | void VmaAllocator_T::FreeMemory( |
| 14142 | size_t allocationCount, |
| 14143 | const VmaAllocation* pAllocations) |
| 14144 | { |
| 14145 | VMA_ASSERT(pAllocations); |
| 14146 | |
| 14147 | for(size_t allocIndex = allocationCount; allocIndex--; ) |
| 14148 | { |
| 14149 | VmaAllocation allocation = pAllocations[allocIndex]; |
| 14150 | |
| 14151 | if(allocation != VK_NULL_HANDLE) |
| 14152 | { |
| 14153 | if(VMA_DEBUG_INITIALIZE_ALLOCATIONS) |
| 14154 | { |
| 14155 | FillAllocation(allocation, VMA_ALLOCATION_FILL_PATTERN_DESTROYED); |
| 14156 | } |
| 14157 | |
| 14158 | switch(allocation->GetType()) |
| 14159 | { |
| 14160 | case VmaAllocation_T::ALLOCATION_TYPE_BLOCK: |
| 14161 | { |
| 14162 | VmaBlockVector* pBlockVector = VMA_NULL; |
| 14163 | VmaPool hPool = allocation->GetParentPool(); |
| 14164 | if(hPool != VK_NULL_HANDLE) |
| 14165 | { |
| 14166 | pBlockVector = &hPool->m_BlockVector; |
| 14167 | } |
| 14168 | else |
| 14169 | { |
| 14170 | const uint32_t memTypeIndex = allocation->GetMemoryTypeIndex(); |
| 14171 | pBlockVector = m_pBlockVectors[memTypeIndex]; |
| 14172 | VMA_ASSERT(pBlockVector && "Trying to free memory of unsupported type!"); |
| 14173 | } |
| 14174 | pBlockVector->Free(allocation); |
| 14175 | } |
| 14176 | break; |
| 14177 | case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED: |
| 14178 | FreeDedicatedMemory(allocation); |
| 14179 | break; |
| 14180 | default: |
| 14181 | VMA_ASSERT(0); |
| 14182 | } |
| 14183 | } |
| 14184 | } |
| 14185 | } |
| 14186 | |
| 14187 | void VmaAllocator_T::CalculateStatistics(VmaTotalStatistics* pStats) |
| 14188 | { |
no test coverage detected