| 14728 | } |
| 14729 | |
| 14730 | void VmaAllocator_T::CalculateStatistics(VmaTotalStatistics* pStats) |
| 14731 | { |
| 14732 | // Initialize. |
| 14733 | VmaClearDetailedStatistics(pStats->total); |
| 14734 | for(uint32_t i = 0; i < VK_MAX_MEMORY_TYPES; ++i) |
| 14735 | VmaClearDetailedStatistics(pStats->memoryType[i]); |
| 14736 | for(uint32_t i = 0; i < VK_MAX_MEMORY_HEAPS; ++i) |
| 14737 | VmaClearDetailedStatistics(pStats->memoryHeap[i]); |
| 14738 | |
| 14739 | // Process default pools. |
| 14740 | for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex) |
| 14741 | { |
| 14742 | VmaBlockVector* const pBlockVector = m_pBlockVectors[memTypeIndex]; |
| 14743 | if (pBlockVector != VMA_NULL) |
| 14744 | pBlockVector->AddDetailedStatistics(pStats->memoryType[memTypeIndex]); |
| 14745 | } |
| 14746 | |
| 14747 | // Process custom pools. |
| 14748 | { |
| 14749 | VmaMutexLockRead lock(m_PoolsMutex, m_UseMutex); |
| 14750 | for(VmaPool pool = m_Pools.Front(); pool != VMA_NULL; pool = m_Pools.GetNext(pool)) |
| 14751 | { |
| 14752 | VmaBlockVector& blockVector = pool->m_BlockVector; |
| 14753 | const uint32_t memTypeIndex = blockVector.GetMemoryTypeIndex(); |
| 14754 | blockVector.AddDetailedStatistics(pStats->memoryType[memTypeIndex]); |
| 14755 | pool->m_DedicatedAllocations.AddDetailedStatistics(pStats->memoryType[memTypeIndex]); |
| 14756 | } |
| 14757 | } |
| 14758 | |
| 14759 | // Process dedicated allocations. |
| 14760 | for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex) |
| 14761 | { |
| 14762 | m_DedicatedAllocations[memTypeIndex].AddDetailedStatistics(pStats->memoryType[memTypeIndex]); |
| 14763 | } |
| 14764 | |
| 14765 | // Sum from memory types to memory heaps. |
| 14766 | for(uint32_t memTypeIndex = 0; memTypeIndex < GetMemoryTypeCount(); ++memTypeIndex) |
| 14767 | { |
| 14768 | const uint32_t memHeapIndex = m_MemProps.memoryTypes[memTypeIndex].heapIndex; |
| 14769 | VmaAddDetailedStatistics(pStats->memoryHeap[memHeapIndex], pStats->memoryType[memTypeIndex]); |
| 14770 | } |
| 14771 | |
| 14772 | // Sum from memory heaps to total. |
| 14773 | for(uint32_t memHeapIndex = 0; memHeapIndex < GetMemoryHeapCount(); ++memHeapIndex) |
| 14774 | VmaAddDetailedStatistics(pStats->total, pStats->memoryHeap[memHeapIndex]); |
| 14775 | |
| 14776 | VMA_ASSERT(pStats->total.statistics.allocationCount == 0 || |
| 14777 | pStats->total.allocationSizeMax >= pStats->total.allocationSizeMin); |
| 14778 | VMA_ASSERT(pStats->total.unusedRangeCount == 0 || |
| 14779 | pStats->total.unusedRangeSizeMax >= pStats->total.unusedRangeSizeMin); |
| 14780 | } |
| 14781 | |
| 14782 | void VmaAllocator_T::GetHeapBudgets(VmaBudget* outBudgets, uint32_t firstHeap, uint32_t heapCount) |
| 14783 | { |
no test coverage detected