Further development of custom pool names
diff --git a/src/Tests.cpp b/src/Tests.cpp
index 3481028..a46d441 100644
--- a/src/Tests.cpp
+++ b/src/Tests.cpp
@@ -3113,8 +3113,6 @@
         vmaGetPoolName(g_hAllocator, pool, &fetchedPoolName);

         TEST(strcmp(fetchedPoolName, POOL_NAME) == 0);

 

-        SaveAllocatorStatsToFile(L"TEST.json");//DELME

-

         vmaSetPoolName(g_hAllocator, pool, nullptr);

     }

 

diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h
index e6ceda2..d0fcdee 100644
--- a/src/vk_mem_alloc.h
+++ b/src/vk_mem_alloc.h
@@ -2512,14 +2512,21 @@
 */

 VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckPoolCorruption(VmaAllocator allocator, VmaPool pool);

 

-/** TODO

+/** \brief Retrieves name of a custom pool.

+

+After the call `ppName` is either null or points to an internally-owned null-terminated string

+containing name of the pool that was previously set. The pointer becomes invalid when the pool is

+destroyed or its name is changed using vmaSetPoolName().

 */

 VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName(

     VmaAllocator allocator,

     VmaPool pool,

     const char** ppName);

 

-/* TODO

+/* \brief Sets name of a custom pool.

+

+`pName` can be either null or pointer to a null-terminated string with new name for the pool.

+Function makes internal copy of the string, so it can be changed or freed immediately after this call.

 */

 VMA_CALL_PRE void VMA_CALL_POST vmaSetPoolName(

     VmaAllocator allocator,

@@ -12418,6 +12425,13 @@
 

     if(m_IsCustomPool)

     {

+        const char* poolName = m_hParentPool->GetName();

+        if(poolName != VMA_NULL && poolName[0] != '\0')

+        {

+            json.WriteString("Name");

+            json.WriteString(poolName);

+        }

+

         json.WriteString("MemoryTypeIndex");

         json.WriteNumber(m_MemoryTypeIndex);

 

@@ -15819,15 +15833,6 @@
             {

                 json.BeginString();

                 json.ContinueString(m_Pools[poolIndex]->GetId());

-                const char* poolName = m_Pools[poolIndex]->GetName();

-                if(poolName != VMA_NULL && poolName[0] != '\0')

-                {

-                    json.ContinueString(" ");

-                    json.ContinueString(poolName);

-                }

-                else

-                {

-                }

                 json.EndString();

 

                 m_Pools[poolIndex]->m_BlockVector.PrintDetailedMap(json);

diff --git a/tools/VmaDumpVis/VmaDumpVis.py b/tools/VmaDumpVis/VmaDumpVis.py
index 6bec3ee..c71d04b 100644
--- a/tools/VmaDumpVis/VmaDumpVis.py
+++ b/tools/VmaDumpVis/VmaDumpVis.py
@@ -189,13 +189,18 @@
             ProcessBlock(typeData['DefaultPoolBlocks'], int(sBlockId), objBlock, '')

 if 'Pools' in jsonSrc:

     objPools = jsonSrc['Pools']

-    for sPoolName, objPool in objPools.items():

+    for sPoolId, objPool in objPools.items():

         iType = int(objPool['MemoryTypeIndex'])

         typeData = GetDataForMemoryType(iType)

         objBlocks = objPool['Blocks']

         sAlgorithm = objPool.get('Algorithm', '')

+        sName = objPool.get('Name', None)

+        if sName:

+            sFullName = sPoolId + ' "' + sName + '"'

+        else:

+            sFullName = sPoolId

         dstBlockArray = []

-        typeData['CustomPools'][sPoolName] = dstBlockArray

+        typeData['CustomPools'][sFullName] = dstBlockArray

         for sBlockId, objBlock in objBlocks.items():

             ProcessBlock(dstBlockArray, int(sBlockId), objBlock, sAlgorithm)

 

@@ -255,7 +260,7 @@
                 sAlgorithm = ' (Algorithm: %s)' % (objBlock['Algorithm'])

             else:

                 sAlgorithm = ''

-            draw.text((IMG_MARGIN, y), "Custom pool \"%s\"%s block %d" % (sPoolName, sAlgorithm, objBlock['ID']), fill=COLOR_TEXT_H2, font=font)

+            draw.text((IMG_MARGIN, y), "Custom pool %s%s block %d" % (sPoolName, sAlgorithm, objBlock['ID']), fill=COLOR_TEXT_H2, font=font)

             y += FONT_SIZE + IMG_MARGIN

             DrawBlock(draw, y, objBlock)

             y += MAP_SIZE + IMG_MARGIN

@@ -274,7 +279,7 @@
     - Fixed key 'Size'. Value is int.

     - Fixed key 'Suballocations'. Value is list of tuples as above.

 - Fixed key 'CustomPools'. Value is dictionary.

-  - Key is string with pool name. Value is list of objects representing memory blocks, each containing dictionary with:

+  - Key is string with pool ID/name. Value is list of objects representing memory blocks, each containing dictionary with:

     - Fixed key 'ID'. Value is int.

     - Fixed key 'Size'. Value is int.

     - Fixed key 'Algorithm'. Optional. Value is string.