mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-25 05:20:05 +00:00
Further development of custom pool names
This commit is contained in:
parent
a020fb81cb
commit
49defd6056
@ -3113,8 +3113,6 @@ static void TestPool_SameSize()
|
||||
vmaGetPoolName(g_hAllocator, pool, &fetchedPoolName);
|
||||
TEST(strcmp(fetchedPoolName, POOL_NAME) == 0);
|
||||
|
||||
SaveAllocatorStatsToFile(L"TEST.json");//DELME
|
||||
|
||||
vmaSetPoolName(g_hAllocator, pool, nullptr);
|
||||
}
|
||||
|
||||
|
@ -2512,14 +2512,21 @@ Possible return values:
|
||||
*/
|
||||
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 @@ void VmaBlockVector::PrintDetailedMap(class VmaJsonWriter& json)
|
||||
|
||||
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 @@ void VmaAllocator_T::PrintDetailedMap(VmaJsonWriter& json)
|
||||
{
|
||||
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);
|
||||
|
@ -189,13 +189,18 @@ if 'DefaultPools' in jsonSrc:
|
||||
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 @@ for iMemTypeIndex in sorted(data.keys()):
|
||||
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 @@ Main data structure - variable `data` - is a dictionary. Key is integer - memory
|
||||
- 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.
|
||||
|
Loading…
Reference in New Issue
Block a user