From 2d2a9e3df3487cd8379496dbde612daa51153dfc Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Tue, 29 Mar 2022 17:24:48 +0200 Subject: [PATCH] Fixed bug with assert failure when JSON dump is created while a custom pool exist with specified string name --- include/vk_mem_alloc.h | 4 ++-- src/Tests.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index c2d5d46..256b654 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -16006,8 +16006,8 @@ void VmaAllocator_T::PrintDetailedMap(VmaJsonWriter& json) json.ContinueString_Size(index++); if (pool->GetName()) { - json.WriteString(" - "); - json.WriteString(pool->GetName()); + json.ContinueString(" - "); + json.ContinueString(pool->GetName()); } json.EndString(); diff --git a/src/Tests.cpp b/src/Tests.cpp index baee5c4..5c90ef0 100644 --- a/src/Tests.cpp +++ b/src/Tests.cpp @@ -5175,6 +5175,11 @@ static void TestPool_SameSize() vmaGetPoolName(g_hAllocator, pool, &fetchedPoolName); 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); }