mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
Added 'LinearAlgorithm' member to JSON dump format and its usage in VmaDumpVis.py.
This commit is contained in:
parent
35e9aca80f
commit
477b22ebf1
@ -4927,7 +4927,6 @@ public:
|
|||||||
~VmaPool_T();
|
~VmaPool_T();
|
||||||
|
|
||||||
uint32_t GetId() const { return m_Id; }
|
uint32_t GetId() const { return m_Id; }
|
||||||
uint32_t GetFlags() const { return m_Flags; }
|
|
||||||
void SetId(uint32_t id) { VMA_ASSERT(m_Id == 0); m_Id = id; }
|
void SetId(uint32_t id) { VMA_ASSERT(m_Id == 0); m_Id = id; }
|
||||||
|
|
||||||
#if VMA_STATS_STRING_ENABLED
|
#if VMA_STATS_STRING_ENABLED
|
||||||
@ -4936,7 +4935,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_Id;
|
uint32_t m_Id;
|
||||||
uint32_t m_Flags;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class VmaDefragmentator
|
class VmaDefragmentator
|
||||||
@ -9205,8 +9203,7 @@ VmaPool_T::VmaPool_T(
|
|||||||
createInfo.frameInUseCount,
|
createInfo.frameInUseCount,
|
||||||
true, // isCustomPool
|
true, // isCustomPool
|
||||||
(createInfo.flags & VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT) != 0), // linearAlgorithm
|
(createInfo.flags & VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT) != 0), // linearAlgorithm
|
||||||
m_Id(0),
|
m_Id(0)
|
||||||
m_Flags(createInfo.flags)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9798,6 +9795,12 @@ void VmaBlockVector::PrintDetailedMap(class VmaJsonWriter& json)
|
|||||||
json.WriteString("FrameInUseCount");
|
json.WriteString("FrameInUseCount");
|
||||||
json.WriteNumber(m_FrameInUseCount);
|
json.WriteNumber(m_FrameInUseCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(m_LinearAlgorithm)
|
||||||
|
{
|
||||||
|
json.WriteString("LinearAlgorithm");
|
||||||
|
json.WriteBool(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -12165,6 +12168,7 @@ void VmaAllocator_T::PrintDetailedMap(VmaJsonWriter& json)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom pools
|
||||||
{
|
{
|
||||||
VmaMutexLock lock(m_PoolsMutex, m_UseMutex);
|
VmaMutexLock lock(m_PoolsMutex, m_UseMutex);
|
||||||
const size_t poolCount = m_Pools.size();
|
const size_t poolCount = m_Pools.size();
|
||||||
|
@ -46,10 +46,12 @@ args = argParser.parse_args()
|
|||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
|
|
||||||
def ProcessBlock(dstBlockList, iBlockId, objBlock):
|
def ProcessBlock(dstBlockList, iBlockId, objBlock, bLinearAlgorithm):
|
||||||
iBlockSize = int(objBlock['TotalBytes'])
|
iBlockSize = int(objBlock['TotalBytes'])
|
||||||
arrSuballocs = objBlock['Suballocations']
|
arrSuballocs = objBlock['Suballocations']
|
||||||
dstBlockObj = {'ID': iBlockId, 'Size':iBlockSize, 'Suballocations':[]}
|
dstBlockObj = {'ID': iBlockId, 'Size':iBlockSize, 'Suballocations':[]}
|
||||||
|
if bLinearAlgorithm:
|
||||||
|
dstBlockObj['LinearAlgorithm'] = True
|
||||||
dstBlockList.append(dstBlockObj)
|
dstBlockList.append(dstBlockObj)
|
||||||
for objSuballoc in arrSuballocs:
|
for objSuballoc in arrSuballocs:
|
||||||
dstBlockObj['Suballocations'].append((objSuballoc['Type'], int(objSuballoc['Size']), int(objSuballoc['Usage']) if ('Usage' in objSuballoc) else 0))
|
dstBlockObj['Suballocations'].append((objSuballoc['Type'], int(objSuballoc['Size']), int(objSuballoc['Usage']) if ('Usage' in objSuballoc) else 0))
|
||||||
@ -182,16 +184,18 @@ if 'DefaultPools' in jsonSrc:
|
|||||||
iType = int(sType[5:])
|
iType = int(sType[5:])
|
||||||
typeData = GetDataForMemoryType(iType)
|
typeData = GetDataForMemoryType(iType)
|
||||||
for sBlockId, objBlock in tType[1]['Blocks'].items():
|
for sBlockId, objBlock in tType[1]['Blocks'].items():
|
||||||
ProcessBlock(typeData['DefaultPoolBlocks'], int(sBlockId), objBlock)
|
ProcessBlock(typeData['DefaultPoolBlocks'], int(sBlockId), objBlock, False)
|
||||||
if 'Pools' in jsonSrc:
|
if 'Pools' in jsonSrc:
|
||||||
objPools = jsonSrc['Pools']
|
objPools = jsonSrc['Pools']
|
||||||
for sPoolId, objPool in objPools.items():
|
for sPoolId, objPool in objPools.items():
|
||||||
iType = int(objPool['MemoryTypeIndex'])
|
iType = int(objPool['MemoryTypeIndex'])
|
||||||
typeData = GetDataForMemoryType(iType)
|
typeData = GetDataForMemoryType(iType)
|
||||||
objBlocks = objPool['Blocks']
|
objBlocks = objPool['Blocks']
|
||||||
|
bLinearAlgorithm = 'LinearAlgorithm' in objPool and objPool['LinearAlgorithm']
|
||||||
for sBlockId, objBlock in objBlocks.items():
|
for sBlockId, objBlock in objBlocks.items():
|
||||||
typeData['CustomPools'][int(sPoolId)] = []
|
dstBlockArray = []
|
||||||
ProcessBlock(typeData['CustomPools'][int(sPoolId)], int(sBlockId), objBlock)
|
typeData['CustomPools'][int(sPoolId)] = dstBlockArray
|
||||||
|
ProcessBlock(dstBlockArray, int(sBlockId), objBlock, bLinearAlgorithm)
|
||||||
|
|
||||||
iImgSizeY, fPixelsPerByte = CalcParams()
|
iImgSizeY, fPixelsPerByte = CalcParams()
|
||||||
|
|
||||||
@ -240,7 +244,11 @@ for iMemTypeIndex in sorted(data.keys()):
|
|||||||
index = 0
|
index = 0
|
||||||
for iPoolId, listPool in dictMemType['CustomPools'].items():
|
for iPoolId, listPool in dictMemType['CustomPools'].items():
|
||||||
for objBlock in listPool:
|
for objBlock in listPool:
|
||||||
draw.text((IMG_MARGIN, y), "Custom pool %d block %d" % (iPoolId, objBlock['ID']), fill=COLOR_TEXT_H2, font=font)
|
if 'LinearAlgorithm' in objBlock:
|
||||||
|
linearAlgorithmStr = ' (linear algorithm)';
|
||||||
|
else:
|
||||||
|
linearAlgorithmStr = '';
|
||||||
|
draw.text((IMG_MARGIN, y), "Custom pool %d%s block %d" % (iPoolId, linearAlgorithmStr, objBlock['ID']), fill=COLOR_TEXT_H2, font=font)
|
||||||
y += FONT_SIZE + IMG_MARGIN
|
y += FONT_SIZE + IMG_MARGIN
|
||||||
DrawBlock(draw, y, objBlock)
|
DrawBlock(draw, y, objBlock)
|
||||||
y += MAP_SIZE + IMG_MARGIN
|
y += MAP_SIZE + IMG_MARGIN
|
||||||
@ -262,5 +270,6 @@ Main data structure - variable `data` - is a dictionary. Key is integer - memory
|
|||||||
- Key is integer pool ID. Value is list of objects, each containing dictionary with:
|
- Key is integer pool ID. Value is list of objects, each containing dictionary with:
|
||||||
- Fixed key 'ID'. Value is int.
|
- Fixed key 'ID'. Value is int.
|
||||||
- Fixed key 'Size'. Value is int.
|
- Fixed key 'Size'. Value is int.
|
||||||
|
- Fixed key 'LinearAlgorithm'. Optional. Value is True.
|
||||||
- Fixed key 'Suballocations'. Value is list of tuples as above.
|
- Fixed key 'Suballocations'. Value is list of tuples as above.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user