mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
Removed redundant VmaDeviceMemoryBlock::m_Size.
This commit is contained in:
parent
40fd505639
commit
3606138794
@ -3035,6 +3035,7 @@ public:
|
|||||||
|
|
||||||
// Validates all data structures inside this object. If not valid, returns false.
|
// Validates all data structures inside this object. If not valid, returns false.
|
||||||
bool Validate() const;
|
bool Validate() const;
|
||||||
|
VkDeviceSize GetSize() const { return m_Size; }
|
||||||
size_t GetAllocationCount() const { return m_Suballocations.size() - m_FreeCount; }
|
size_t GetAllocationCount() const { return m_Suballocations.size() - m_FreeCount; }
|
||||||
VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize; }
|
VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize; }
|
||||||
VkDeviceSize GetUnusedRangeSizeMax() const;
|
VkDeviceSize GetUnusedRangeSizeMax() const;
|
||||||
@ -3133,7 +3134,6 @@ public:
|
|||||||
uint32_t m_MemoryTypeIndex;
|
uint32_t m_MemoryTypeIndex;
|
||||||
VMA_BLOCK_VECTOR_TYPE m_BlockVectorType;
|
VMA_BLOCK_VECTOR_TYPE m_BlockVectorType;
|
||||||
VkDeviceMemory m_hMemory;
|
VkDeviceMemory m_hMemory;
|
||||||
VkDeviceSize m_Size;
|
|
||||||
bool m_PersistentMap;
|
bool m_PersistentMap;
|
||||||
void* m_pMappedData;
|
void* m_pMappedData;
|
||||||
VmaBlockMetadata m_Metadata;
|
VmaBlockMetadata m_Metadata;
|
||||||
@ -5119,7 +5119,6 @@ VmaDeviceMemoryBlock::VmaDeviceMemoryBlock(VmaAllocator hAllocator) :
|
|||||||
m_MemoryTypeIndex(UINT32_MAX),
|
m_MemoryTypeIndex(UINT32_MAX),
|
||||||
m_BlockVectorType(VMA_BLOCK_VECTOR_TYPE_COUNT),
|
m_BlockVectorType(VMA_BLOCK_VECTOR_TYPE_COUNT),
|
||||||
m_hMemory(VK_NULL_HANDLE),
|
m_hMemory(VK_NULL_HANDLE),
|
||||||
m_Size(0),
|
|
||||||
m_PersistentMap(false),
|
m_PersistentMap(false),
|
||||||
m_pMappedData(VMA_NULL),
|
m_pMappedData(VMA_NULL),
|
||||||
m_Metadata(hAllocator)
|
m_Metadata(hAllocator)
|
||||||
@ -5139,7 +5138,6 @@ void VmaDeviceMemoryBlock::Init(
|
|||||||
m_MemoryTypeIndex = newMemoryTypeIndex;
|
m_MemoryTypeIndex = newMemoryTypeIndex;
|
||||||
m_BlockVectorType = newBlockVectorType;
|
m_BlockVectorType = newBlockVectorType;
|
||||||
m_hMemory = newMemory;
|
m_hMemory = newMemory;
|
||||||
m_Size = newSize;
|
|
||||||
m_PersistentMap = persistentMap;
|
m_PersistentMap = persistentMap;
|
||||||
m_pMappedData = pMappedData;
|
m_pMappedData = pMappedData;
|
||||||
|
|
||||||
@ -5159,14 +5157,14 @@ void VmaDeviceMemoryBlock::Destroy(VmaAllocator allocator)
|
|||||||
m_pMappedData = VMA_NULL;
|
m_pMappedData = VMA_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocator->FreeVulkanMemory(m_MemoryTypeIndex, m_Size, m_hMemory);
|
allocator->FreeVulkanMemory(m_MemoryTypeIndex, m_Metadata.GetSize(), m_hMemory);
|
||||||
m_hMemory = VK_NULL_HANDLE;
|
m_hMemory = VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VmaDeviceMemoryBlock::Validate() const
|
bool VmaDeviceMemoryBlock::Validate() const
|
||||||
{
|
{
|
||||||
if((m_hMemory == VK_NULL_HANDLE) ||
|
if((m_hMemory == VK_NULL_HANDLE) ||
|
||||||
(m_Size == 0))
|
(m_Metadata.GetSize() == 0))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -5393,7 +5391,7 @@ VkResult VmaBlockVector::Allocate(
|
|||||||
if(res == VK_SUCCESS)
|
if(res == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
VmaDeviceMemoryBlock* const pBlock = m_Blocks[newBlockIndex];
|
VmaDeviceMemoryBlock* const pBlock = m_Blocks[newBlockIndex];
|
||||||
VMA_ASSERT(pBlock->m_Size >= vkMemReq.size);
|
VMA_ASSERT(pBlock->m_Metadata.GetSize() >= vkMemReq.size);
|
||||||
|
|
||||||
// Allocate from pBlock. Because it is empty, dstAllocRequest can be trivially filled.
|
// Allocate from pBlock. Because it is empty, dstAllocRequest can be trivially filled.
|
||||||
VmaAllocationRequest allocRequest;
|
VmaAllocationRequest allocRequest;
|
||||||
@ -5794,7 +5792,7 @@ VkResult VmaBlockVector::Defragment(
|
|||||||
if(pDefragmentationStats != VMA_NULL)
|
if(pDefragmentationStats != VMA_NULL)
|
||||||
{
|
{
|
||||||
++pDefragmentationStats->deviceMemoryBlocksFreed;
|
++pDefragmentationStats->deviceMemoryBlocksFreed;
|
||||||
pDefragmentationStats->bytesFreed += pBlock->m_Size;
|
pDefragmentationStats->bytesFreed += pBlock->m_Metadata.GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
VmaVectorRemove(m_Blocks, blockIndex);
|
VmaVectorRemove(m_Blocks, blockIndex);
|
||||||
|
Loading…
Reference in New Issue
Block a user