mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-29 09:54:35 +00:00
Implemented vmaCalculateVirtualBlockStats
This commit is contained in:
parent
72949fa9d8
commit
9a091e8ccb
@ -6891,6 +6891,10 @@ public:
|
|||||||
{
|
{
|
||||||
m_Metadata->SetAllocationUserData(offset, userData);
|
m_Metadata->SetAllocationUserData(offset, userData);
|
||||||
}
|
}
|
||||||
|
void CalculateStats(VmaStatInfo& outStatInfo) const
|
||||||
|
{
|
||||||
|
m_Metadata->CalcAllocationStatInfo(outStatInfo);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VmaBlockMetadata* m_Metadata;
|
VmaBlockMetadata* m_Metadata;
|
||||||
@ -18403,7 +18407,10 @@ VMA_CALL_PRE void VMA_CALL_POST vmaSetVirtualAllocationUserData(VmaVirtualBlock
|
|||||||
VMA_CALL_PRE void VMA_CALL_POST vmaCalculateVirtualBlockStats(VmaVirtualBlock VMA_NOT_NULL virtualBlock,
|
VMA_CALL_PRE void VMA_CALL_POST vmaCalculateVirtualBlockStats(VmaVirtualBlock VMA_NOT_NULL virtualBlock,
|
||||||
VmaStatInfo* VMA_NOT_NULL pStatInfo)
|
VmaStatInfo* VMA_NOT_NULL pStatInfo)
|
||||||
{
|
{
|
||||||
VMA_ASSERT(0 && "TODO implement");
|
VMA_ASSERT(virtualBlock != VK_NULL_HANDLE && pStatInfo != VMA_NULL);
|
||||||
|
VMA_DEBUG_LOG("vmaCalculateVirtualBlockStats");
|
||||||
|
VMA_DEBUG_GLOBAL_MUTEX_LOCK;
|
||||||
|
virtualBlock->CalculateStats(*pStatInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
VMA_CALL_PRE void VMA_CALL_POST vmaBuildVirtualBlockStatsString(VmaVirtualBlock VMA_NOT_NULL virtualBlock,
|
VMA_CALL_PRE void VMA_CALL_POST vmaBuildVirtualBlockStatsString(VmaVirtualBlock VMA_NOT_NULL virtualBlock,
|
||||||
|
@ -2747,16 +2747,16 @@ static void TestVirtualBlocks()
|
|||||||
TEST(alloc2Offset < blockSize);
|
TEST(alloc2Offset < blockSize);
|
||||||
TEST(alloc2Offset + 4 * MEGABYTE <= alloc0Offset || alloc0Offset + 8 * MEGABYTE <= alloc2Offset); // Check if they don't overlap.
|
TEST(alloc2Offset + 4 * MEGABYTE <= alloc0Offset || alloc0Offset + 8 * MEGABYTE <= alloc2Offset); // Check if they don't overlap.
|
||||||
|
|
||||||
#if 0
|
|
||||||
// # Calculate statistics
|
// # Calculate statistics
|
||||||
|
|
||||||
StatInfo statInfo = {};
|
VmaStatInfo statInfo = {};
|
||||||
block->CalculateStats(&statInfo);
|
vmaCalculateVirtualBlockStats(block, &statInfo);
|
||||||
CHECK_BOOL(statInfo.AllocationCount == 2);
|
TEST(statInfo.allocationCount == 2);
|
||||||
CHECK_BOOL(statInfo.BlockCount == 1);
|
TEST(statInfo.blockCount == 1);
|
||||||
CHECK_BOOL(statInfo.UsedBytes == blockSize);
|
TEST(statInfo.usedBytes == blockSize);
|
||||||
CHECK_BOOL(statInfo.UnusedBytes + statInfo.UsedBytes == blockSize);
|
TEST(statInfo.unusedBytes + statInfo.usedBytes == blockSize);
|
||||||
|
|
||||||
|
#if 0
|
||||||
// # Generate JSON dump
|
// # Generate JSON dump
|
||||||
|
|
||||||
WCHAR* json = nullptr;
|
WCHAR* json = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user