Fix VMA_STATS_STRING_ENABLED 0 with VMA_DEBUG_LOG

This commit is contained in:
Tiago Chaves 2022-01-30 16:40:32 -03:00 committed by GitHub
parent 08759cbec5
commit c0aa0ad54c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6048,6 +6048,8 @@ void VmaBlockMetadata::DebugLogAllocation(VkDeviceSize offset, VkDeviceSize size
VmaAllocation allocation = reinterpret_cast<VmaAllocation>(userData); VmaAllocation allocation = reinterpret_cast<VmaAllocation>(userData);
userData = allocation->GetUserData(); userData = allocation->GetUserData();
#if VMA_STATS_STRING_ENABLED
if (userData != VMA_NULL && allocation->IsUserDataString()) if (userData != VMA_NULL && allocation->IsUserDataString())
{ {
VMA_DEBUG_LOG("UNFREED ALLOCATION; Offset: %llu; Size: %llu; UserData: %s; Type: %s; Usage: %u", VMA_DEBUG_LOG("UNFREED ALLOCATION; Offset: %llu; Size: %llu; UserData: %s; Type: %s; Usage: %u",
@ -6062,6 +6064,18 @@ void VmaBlockMetadata::DebugLogAllocation(VkDeviceSize offset, VkDeviceSize size
VMA_SUBALLOCATION_TYPE_NAMES[allocation->GetSuballocationType()], VMA_SUBALLOCATION_TYPE_NAMES[allocation->GetSuballocationType()],
allocation->GetBufferImageUsage()); allocation->GetBufferImageUsage());
} }
#else
if (userData != VMA_NULL && allocation->IsUserDataString())
{
VMA_DEBUG_LOG("UNFREED ALLOCATION; Offset: %llu; Size: %llu; UserData: %s",
offset, size, reinterpret_cast<const char*>(userData));
}
else
{
VMA_DEBUG_LOG("UNFREED ALLOCATION; Offset: %llu; Size: %llu; UserData: %p",
offset, size, userData);
}
#endif // VMA_STATS_STRING_ENABLED
} }
} }