mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-26 00:24:35 +00:00
Fixed VmaDumpVis.py to respect new "Algorithm" parameter.
This commit is contained in:
parent
0591535eb1
commit
6f09752db7
@ -46,12 +46,11 @@ args = argParser.parse_args()
|
||||
data = {}
|
||||
|
||||
|
||||
def ProcessBlock(dstBlockList, iBlockId, objBlock, bLinearAlgorithm):
|
||||
def ProcessBlock(dstBlockList, iBlockId, objBlock, sAlgorithm):
|
||||
iBlockSize = int(objBlock['TotalBytes'])
|
||||
arrSuballocs = objBlock['Suballocations']
|
||||
dstBlockObj = {'ID': iBlockId, 'Size':iBlockSize, 'Suballocations':[]}
|
||||
if bLinearAlgorithm:
|
||||
dstBlockObj['LinearAlgorithm'] = True
|
||||
dstBlockObj['Algorithm'] = sAlgorithm
|
||||
for objSuballoc in arrSuballocs:
|
||||
dstBlockObj['Suballocations'].append((objSuballoc['Type'], int(objSuballoc['Size']), int(objSuballoc['Usage']) if ('Usage' in objSuballoc) else 0))
|
||||
dstBlockList.append(dstBlockObj)
|
||||
@ -187,18 +186,18 @@ if 'DefaultPools' in jsonSrc:
|
||||
iType = int(sType[5:])
|
||||
typeData = GetDataForMemoryType(iType)
|
||||
for sBlockId, objBlock in tType[1]['Blocks'].items():
|
||||
ProcessBlock(typeData['DefaultPoolBlocks'], int(sBlockId), objBlock, False)
|
||||
ProcessBlock(typeData['DefaultPoolBlocks'], int(sBlockId), objBlock, '')
|
||||
if 'Pools' in jsonSrc:
|
||||
objPools = jsonSrc['Pools']
|
||||
for sPoolId, objPool in objPools.items():
|
||||
iType = int(objPool['MemoryTypeIndex'])
|
||||
typeData = GetDataForMemoryType(iType)
|
||||
objBlocks = objPool['Blocks']
|
||||
bLinearAlgorithm = 'LinearAlgorithm' in objPool and objPool['LinearAlgorithm']
|
||||
sAlgorithm = objPool.get('Algorithm', '')
|
||||
dstBlockArray = []
|
||||
typeData['CustomPools'][int(sPoolId)] = dstBlockArray
|
||||
for sBlockId, objBlock in objBlocks.items():
|
||||
ProcessBlock(dstBlockArray, int(sBlockId), objBlock, bLinearAlgorithm)
|
||||
ProcessBlock(dstBlockArray, int(sBlockId), objBlock, sAlgorithm)
|
||||
|
||||
iImgSizeY, fPixelsPerByte = CalcParams()
|
||||
|
||||
@ -247,11 +246,11 @@ for iMemTypeIndex in sorted(data.keys()):
|
||||
index = 0
|
||||
for iPoolId, listPool in dictMemType['CustomPools'].items():
|
||||
for objBlock in listPool:
|
||||
if 'LinearAlgorithm' in objBlock:
|
||||
linearAlgorithmStr = ' (linear algorithm)';
|
||||
if 'Algorithm' in objBlock:
|
||||
sAlgorithm = ' (Algorithm: %s)' % (objBlock['Algorithm']);
|
||||
else:
|
||||
linearAlgorithmStr = '';
|
||||
draw.text((IMG_MARGIN, y), "Custom pool %d%s block %d" % (iPoolId, linearAlgorithmStr, objBlock['ID']), fill=COLOR_TEXT_H2, font=font)
|
||||
sAlgorithm = '';
|
||||
draw.text((IMG_MARGIN, y), "Custom pool %d%s block %d" % (iPoolId, sAlgorithm, objBlock['ID']), fill=COLOR_TEXT_H2, font=font)
|
||||
y += FONT_SIZE + IMG_MARGIN
|
||||
DrawBlock(draw, y, objBlock)
|
||||
y += MAP_SIZE + IMG_MARGIN
|
||||
@ -273,6 +272,6 @@ Main data structure - variable `data` - is a dictionary. Key is integer - memory
|
||||
- Key is integer pool ID. 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 'LinearAlgorithm'. Optional. Value is True.
|
||||
- Fixed key 'Algorithm'. Optional. Value is string.
|
||||
- Fixed key 'Suballocations'. Value is list of tuples as above.
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user