mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
JSON detailed dump: added parameters "CreationFrameIndex" and "Usage" (which are usage flags from VkImageCreateInfo or VkBufferCreateInfo).
This commit is contained in:
parent
7b08b8f375
commit
c22103d183
@ -3780,6 +3780,10 @@ public:
|
|||||||
m_MapCount(0),
|
m_MapCount(0),
|
||||||
m_Flags(userDataString ? (uint8_t)FLAG_USER_DATA_STRING : 0)
|
m_Flags(userDataString ? (uint8_t)FLAG_USER_DATA_STRING : 0)
|
||||||
{
|
{
|
||||||
|
#if VMA_STATS_STRING_ENABLED
|
||||||
|
m_CreationFrameIndex = currentFrameIndex;
|
||||||
|
m_BufferImageUsage = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~VmaAllocation_T()
|
~VmaAllocation_T()
|
||||||
@ -3906,6 +3910,19 @@ public:
|
|||||||
VkResult DedicatedAllocMap(VmaAllocator hAllocator, void** ppData);
|
VkResult DedicatedAllocMap(VmaAllocator hAllocator, void** ppData);
|
||||||
void DedicatedAllocUnmap(VmaAllocator hAllocator);
|
void DedicatedAllocUnmap(VmaAllocator hAllocator);
|
||||||
|
|
||||||
|
#if VMA_STATS_STRING_ENABLED
|
||||||
|
uint32_t GetCreationFrameIndex() const { return m_CreationFrameIndex; }
|
||||||
|
uint32_t GetBufferImageUsage() const { return m_BufferImageUsage; }
|
||||||
|
|
||||||
|
void InitBufferImageUsage(uint32_t bufferImageUsage)
|
||||||
|
{
|
||||||
|
VMA_ASSERT(m_BufferImageUsage == 0);
|
||||||
|
m_BufferImageUsage = bufferImageUsage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintParameters(class VmaJsonWriter& json) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VkDeviceSize m_Alignment;
|
VkDeviceSize m_Alignment;
|
||||||
VkDeviceSize m_Size;
|
VkDeviceSize m_Size;
|
||||||
@ -3943,6 +3960,11 @@ private:
|
|||||||
DedicatedAllocation m_DedicatedAllocation;
|
DedicatedAllocation m_DedicatedAllocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if VMA_STATS_STRING_ENABLED
|
||||||
|
uint32_t m_CreationFrameIndex;
|
||||||
|
uint32_t m_BufferImageUsage; // 0 if unknown.
|
||||||
|
#endif
|
||||||
|
|
||||||
void FreeUserDataString(VmaAllocator hAllocator);
|
void FreeUserDataString(VmaAllocator hAllocator);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -5128,6 +5150,53 @@ bool VmaAllocation_T::MakeLost(uint32_t currentFrameIndex, uint32_t frameInUseCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VMA_STATS_STRING_ENABLED
|
||||||
|
|
||||||
|
// Correspond to values of enum VmaSuballocationType.
|
||||||
|
static const char* VMA_SUBALLOCATION_TYPE_NAMES[] = {
|
||||||
|
"FREE",
|
||||||
|
"UNKNOWN",
|
||||||
|
"BUFFER",
|
||||||
|
"IMAGE_UNKNOWN",
|
||||||
|
"IMAGE_LINEAR",
|
||||||
|
"IMAGE_OPTIMAL",
|
||||||
|
};
|
||||||
|
|
||||||
|
void VmaAllocation_T::PrintParameters(class VmaJsonWriter& json) const
|
||||||
|
{
|
||||||
|
json.WriteString("Type");
|
||||||
|
json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[m_SuballocationType]);
|
||||||
|
|
||||||
|
json.WriteString("Size");
|
||||||
|
json.WriteNumber(m_Size);
|
||||||
|
|
||||||
|
if(m_pUserData != VMA_NULL)
|
||||||
|
{
|
||||||
|
json.WriteString("UserData");
|
||||||
|
if(IsUserDataString())
|
||||||
|
{
|
||||||
|
json.WriteString((const char*)m_pUserData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
json.BeginString();
|
||||||
|
json.ContinueString_Pointer(m_pUserData);
|
||||||
|
json.EndString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
json.WriteString("CreationFrameIndex");
|
||||||
|
json.WriteNumber(m_CreationFrameIndex);
|
||||||
|
|
||||||
|
if(m_BufferImageUsage != 0)
|
||||||
|
{
|
||||||
|
json.WriteString("Usage");
|
||||||
|
json.WriteNumber(m_BufferImageUsage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void VmaAllocation_T::FreeUserDataString(VmaAllocator hAllocator)
|
void VmaAllocation_T::FreeUserDataString(VmaAllocator hAllocator)
|
||||||
{
|
{
|
||||||
VMA_ASSERT(IsUserDataString());
|
VMA_ASSERT(IsUserDataString());
|
||||||
@ -5228,16 +5297,6 @@ void VmaAllocation_T::DedicatedAllocUnmap(VmaAllocator hAllocator)
|
|||||||
|
|
||||||
#if VMA_STATS_STRING_ENABLED
|
#if VMA_STATS_STRING_ENABLED
|
||||||
|
|
||||||
// Correspond to values of enum VmaSuballocationType.
|
|
||||||
static const char* VMA_SUBALLOCATION_TYPE_NAMES[] = {
|
|
||||||
"FREE",
|
|
||||||
"UNKNOWN",
|
|
||||||
"BUFFER",
|
|
||||||
"IMAGE_UNKNOWN",
|
|
||||||
"IMAGE_LINEAR",
|
|
||||||
"IMAGE_OPTIMAL",
|
|
||||||
};
|
|
||||||
|
|
||||||
static void VmaPrintStatInfo(VmaJsonWriter& json, const VmaStatInfo& stat)
|
static void VmaPrintStatInfo(VmaJsonWriter& json, const VmaStatInfo& stat)
|
||||||
{
|
{
|
||||||
json.BeginObject();
|
json.BeginObject();
|
||||||
@ -5533,32 +5592,20 @@ void VmaBlockMetadata::PrintDetailedMap(class VmaJsonWriter& json) const
|
|||||||
{
|
{
|
||||||
json.BeginObject(true);
|
json.BeginObject(true);
|
||||||
|
|
||||||
json.WriteString("Type");
|
|
||||||
json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[suballocItem->type]);
|
|
||||||
|
|
||||||
json.WriteString("Size");
|
|
||||||
json.WriteNumber(suballocItem->size);
|
|
||||||
|
|
||||||
json.WriteString("Offset");
|
json.WriteString("Offset");
|
||||||
json.WriteNumber(suballocItem->offset);
|
json.WriteNumber(suballocItem->offset);
|
||||||
|
|
||||||
if(suballocItem->type != VMA_SUBALLOCATION_TYPE_FREE)
|
if(suballocItem->type == VMA_SUBALLOCATION_TYPE_FREE)
|
||||||
{
|
{
|
||||||
const void* pUserData = suballocItem->hAllocation->GetUserData();
|
json.WriteString("Type");
|
||||||
if(pUserData != VMA_NULL)
|
json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[VMA_SUBALLOCATION_TYPE_FREE]);
|
||||||
{
|
|
||||||
json.WriteString("UserData");
|
json.WriteString("Size");
|
||||||
if(suballocItem->hAllocation->IsUserDataString())
|
json.WriteNumber(suballocItem->size);
|
||||||
{
|
}
|
||||||
json.WriteString((const char*)pUserData);
|
else
|
||||||
}
|
{
|
||||||
else
|
suballocItem->hAllocation->PrintParameters(json);
|
||||||
{
|
|
||||||
json.BeginString();
|
|
||||||
json.ContinueString_Pointer(pUserData);
|
|
||||||
json.EndString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
json.EndObject();
|
json.EndObject();
|
||||||
@ -8517,31 +8564,9 @@ void VmaAllocator_T::PrintDetailedMap(VmaJsonWriter& json)
|
|||||||
|
|
||||||
for(size_t i = 0; i < pDedicatedAllocVector->size(); ++i)
|
for(size_t i = 0; i < pDedicatedAllocVector->size(); ++i)
|
||||||
{
|
{
|
||||||
const VmaAllocation hAlloc = (*pDedicatedAllocVector)[i];
|
|
||||||
json.BeginObject(true);
|
json.BeginObject(true);
|
||||||
|
const VmaAllocation hAlloc = (*pDedicatedAllocVector)[i];
|
||||||
json.WriteString("Type");
|
hAlloc->PrintParameters(json);
|
||||||
json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[hAlloc->GetSuballocationType()]);
|
|
||||||
|
|
||||||
json.WriteString("Size");
|
|
||||||
json.WriteNumber(hAlloc->GetSize());
|
|
||||||
|
|
||||||
const void* pUserData = hAlloc->GetUserData();
|
|
||||||
if(pUserData != VMA_NULL)
|
|
||||||
{
|
|
||||||
json.WriteString("UserData");
|
|
||||||
if(hAlloc->IsUserDataString())
|
|
||||||
{
|
|
||||||
json.WriteString((const char*)pUserData);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
json.BeginString();
|
|
||||||
json.ContinueString_Pointer(pUserData);
|
|
||||||
json.EndString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
json.EndObject();
|
json.EndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9319,6 +9344,9 @@ VkResult vmaCreateBuffer(
|
|||||||
if(res >= 0)
|
if(res >= 0)
|
||||||
{
|
{
|
||||||
// All steps succeeded.
|
// All steps succeeded.
|
||||||
|
#if VMA_STATS_STRING_ENABLED
|
||||||
|
(*pAllocation)->InitBufferImageUsage(pBufferCreateInfo->usage);
|
||||||
|
#endif
|
||||||
if(pAllocationInfo != VMA_NULL)
|
if(pAllocationInfo != VMA_NULL)
|
||||||
{
|
{
|
||||||
allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);
|
allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);
|
||||||
@ -9394,6 +9422,9 @@ VkResult vmaCreateImage(
|
|||||||
if(res >= 0)
|
if(res >= 0)
|
||||||
{
|
{
|
||||||
// All steps succeeded.
|
// All steps succeeded.
|
||||||
|
#if VMA_STATS_STRING_ENABLED
|
||||||
|
(*pAllocation)->InitBufferImageUsage(pImageCreateInfo->usage);
|
||||||
|
#endif
|
||||||
if(pAllocationInfo != VMA_NULL)
|
if(pAllocationInfo != VMA_NULL)
|
||||||
{
|
{
|
||||||
allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);
|
allocator->GetAllocationInfo(*pAllocation, pAllocationInfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user