From 5bc033f19d14cde355201ea4e2ba5461fa2bf3e1 Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Mon, 20 Nov 2017 14:09:49 +0100 Subject: [PATCH] Fixed reporting UserData in JSON dump for dedicated allocations. --- src/vk_mem_alloc.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h index 8501e0b..3e6f0a7 100644 --- a/src/vk_mem_alloc.h +++ b/src/vk_mem_alloc.h @@ -7570,11 +7570,27 @@ void VmaAllocator_T::PrintDetailedMap(VmaJsonWriter& json) const VmaAllocation hAlloc = (*pDedicatedAllocVector)[i]; json.BeginObject(true); + json.WriteString("Type"); + json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[hAlloc->GetSuballocationType()]); + json.WriteString("Size"); json.WriteNumber(hAlloc->GetSize()); - json.WriteString("Type"); - json.WriteString(VMA_SUBALLOCATION_TYPE_NAMES[hAlloc->GetSuballocationType()]); + 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(); }