Fixed bug with assert failure when JSON dump is created while a custom pool exist with specified string name

This commit is contained in:
Adam Sawicki 2022-03-29 17:24:48 +02:00
parent 5b598e0a35
commit 2d2a9e3df3
2 changed files with 7 additions and 2 deletions

View File

@ -16006,8 +16006,8 @@ void VmaAllocator_T::PrintDetailedMap(VmaJsonWriter& json)
json.ContinueString_Size(index++); json.ContinueString_Size(index++);
if (pool->GetName()) if (pool->GetName())
{ {
json.WriteString(" - "); json.ContinueString(" - ");
json.WriteString(pool->GetName()); json.ContinueString(pool->GetName());
} }
json.EndString(); json.EndString();

View File

@ -5175,6 +5175,11 @@ static void TestPool_SameSize()
vmaGetPoolName(g_hAllocator, pool, &fetchedPoolName); vmaGetPoolName(g_hAllocator, pool, &fetchedPoolName);
TEST(strcmp(fetchedPoolName, POOL_NAME) == 0); TEST(strcmp(fetchedPoolName, POOL_NAME) == 0);
// Generate JSON dump. There was a bug with this...
char* json = nullptr;
vmaBuildStatsString(g_hAllocator, &json, VK_TRUE);
vmaFreeStatsString(g_hAllocator, json);
vmaSetPoolName(g_hAllocator, pool, nullptr); vmaSetPoolName(g_hAllocator, pool, nullptr);
} }