Small refactoring: Removed function VmaBlockVector::DestroyDefragmentator.
This commit is contained in:
parent
f863a1dbd0
commit
6826f2d768
1 changed files with 25 additions and 45 deletions
|
@ -5519,13 +5519,12 @@ public:
|
||||||
VmaAllocator hAllocator,
|
VmaAllocator hAllocator,
|
||||||
uint32_t currentFrameIndex);
|
uint32_t currentFrameIndex);
|
||||||
|
|
||||||
|
// If m_pDefragmentator is not null, uses it to defragment and destroys it.
|
||||||
VkResult Defragment(
|
VkResult Defragment(
|
||||||
VmaDefragmentationStats* pDefragmentationStats,
|
VmaDefragmentationStats* pDefragmentationStats,
|
||||||
VkDeviceSize& maxBytesToMove,
|
VkDeviceSize& maxBytesToMove,
|
||||||
uint32_t& maxAllocationsToMove);
|
uint32_t& maxAllocationsToMove);
|
||||||
|
|
||||||
void DestroyDefragmentator();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class VmaDefragmentationAlgorithm;
|
friend class VmaDefragmentationAlgorithm;
|
||||||
friend class VmaDefragmentator;
|
friend class VmaDefragmentator;
|
||||||
|
@ -11157,6 +11156,8 @@ VkResult VmaBlockVector::Defragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free empty blocks.
|
// Free empty blocks.
|
||||||
|
if(result >= 0)
|
||||||
|
{
|
||||||
m_HasEmptyBlock = false;
|
m_HasEmptyBlock = false;
|
||||||
for(size_t blockIndex = m_Blocks.size(); blockIndex--; )
|
for(size_t blockIndex = m_Blocks.size(); blockIndex--; )
|
||||||
{
|
{
|
||||||
|
@ -11181,17 +11182,13 @@ VkResult VmaBlockVector::Defragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VmaBlockVector::DestroyDefragmentator()
|
// Destroy defragmentator.
|
||||||
{
|
|
||||||
if(m_pDefragmentator != VMA_NULL)
|
|
||||||
{
|
|
||||||
vma_delete(m_hAllocator, m_pDefragmentator);
|
vma_delete(m_hAllocator, m_pDefragmentator);
|
||||||
m_pDefragmentator = VMA_NULL;
|
m_pDefragmentator = VMA_NULL;
|
||||||
}
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VmaBlockVector::MakePoolAllocationsLost(
|
void VmaBlockVector::MakePoolAllocationsLost(
|
||||||
|
@ -12898,7 +12895,7 @@ VkResult VmaAllocator_T::DefragmentationBegin(
|
||||||
|
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
|
|
||||||
// ======== Main processing - call Defragment on block vectors.
|
// Main processing: Call Defragment on block vectors.
|
||||||
|
|
||||||
VkDeviceSize maxBytesToMove = info.maxCpuBytesToMove;
|
VkDeviceSize maxBytesToMove = info.maxCpuBytesToMove;
|
||||||
uint32_t maxAllocationsToMove = info.maxCpuAllocationsToMove;
|
uint32_t maxAllocationsToMove = info.maxCpuAllocationsToMove;
|
||||||
|
@ -12927,23 +12924,6 @@ VkResult VmaAllocator_T::DefragmentationBegin(
|
||||||
maxAllocationsToMove);
|
maxAllocationsToMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ======== Destroy defragmentators (regardless of result).
|
|
||||||
|
|
||||||
// Process custom pools.
|
|
||||||
for(size_t poolIndex = poolCount; poolIndex--; )
|
|
||||||
{
|
|
||||||
m_Pools[poolIndex]->m_BlockVector.DestroyDefragmentator();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process standard memory.
|
|
||||||
for(uint32_t memTypeIndex = GetMemoryTypeCount(); memTypeIndex--; )
|
|
||||||
{
|
|
||||||
if((m_MemProps.memoryTypes[memTypeIndex].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)
|
|
||||||
{
|
|
||||||
m_pBlockVectors[memTypeIndex]->DestroyDefragmentator();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue