mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-29 09:54:35 +00:00
VmaDumpVis.py: Fixed wrong visualization of custom pools that have multiple blocks.
This commit is contained in:
parent
90eb51c225
commit
ee79c63d61
@ -52,9 +52,9 @@ def ProcessBlock(dstBlockList, iBlockId, objBlock, bLinearAlgorithm):
|
|||||||
dstBlockObj = {'ID': iBlockId, 'Size':iBlockSize, 'Suballocations':[]}
|
dstBlockObj = {'ID': iBlockId, 'Size':iBlockSize, 'Suballocations':[]}
|
||||||
if bLinearAlgorithm:
|
if bLinearAlgorithm:
|
||||||
dstBlockObj['LinearAlgorithm'] = True
|
dstBlockObj['LinearAlgorithm'] = True
|
||||||
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))
|
||||||
|
dstBlockList.append(dstBlockObj)
|
||||||
|
|
||||||
|
|
||||||
def GetDataForMemoryType(iMemTypeIndex):
|
def GetDataForMemoryType(iMemTypeIndex):
|
||||||
@ -77,15 +77,18 @@ def CalcParams():
|
|||||||
iMaxBlockSize = 0
|
iMaxBlockSize = 0
|
||||||
for dictMemType in data.values():
|
for dictMemType in data.values():
|
||||||
iImgSizeY += IMG_MARGIN + FONT_SIZE
|
iImgSizeY += IMG_MARGIN + FONT_SIZE
|
||||||
iImgSizeY += len(dictMemType['DedicatedAllocations']) * (IMG_MARGIN * 2 + FONT_SIZE + MAP_SIZE)
|
lDedicatedAllocations = dictMemType['DedicatedAllocations']
|
||||||
for tDedicatedAlloc in dictMemType['DedicatedAllocations']:
|
iImgSizeY += len(lDedicatedAllocations) * (IMG_MARGIN * 2 + FONT_SIZE + MAP_SIZE)
|
||||||
|
for tDedicatedAlloc in lDedicatedAllocations:
|
||||||
iMaxBlockSize = max(iMaxBlockSize, tDedicatedAlloc[1])
|
iMaxBlockSize = max(iMaxBlockSize, tDedicatedAlloc[1])
|
||||||
iImgSizeY += len(dictMemType['DefaultPoolBlocks']) * (IMG_MARGIN * 2 + FONT_SIZE + MAP_SIZE)
|
lDefaultPoolBlocks = dictMemType['DefaultPoolBlocks']
|
||||||
for objBlock in dictMemType['DefaultPoolBlocks']:
|
iImgSizeY += len(lDefaultPoolBlocks) * (IMG_MARGIN * 2 + FONT_SIZE + MAP_SIZE)
|
||||||
|
for objBlock in lDefaultPoolBlocks:
|
||||||
iMaxBlockSize = max(iMaxBlockSize, objBlock['Size'])
|
iMaxBlockSize = max(iMaxBlockSize, objBlock['Size'])
|
||||||
iImgSizeY += len(dictMemType['CustomPools']) * (IMG_MARGIN * 2 + FONT_SIZE + MAP_SIZE)
|
dCustomPools = dictMemType['CustomPools']
|
||||||
for listPool in dictMemType['CustomPools'].values():
|
for lBlocks in dCustomPools.values():
|
||||||
for objBlock in listPool:
|
iImgSizeY += len(lBlocks) * (IMG_MARGIN * 2 + FONT_SIZE + MAP_SIZE)
|
||||||
|
for objBlock in lBlocks:
|
||||||
iMaxBlockSize = max(iMaxBlockSize, objBlock['Size'])
|
iMaxBlockSize = max(iMaxBlockSize, objBlock['Size'])
|
||||||
fPixelsPerByte = (IMG_SIZE_X - IMG_MARGIN * 2) / float(iMaxBlockSize)
|
fPixelsPerByte = (IMG_SIZE_X - IMG_MARGIN * 2) / float(iMaxBlockSize)
|
||||||
return iImgSizeY, fPixelsPerByte
|
return iImgSizeY, fPixelsPerByte
|
||||||
@ -192,9 +195,9 @@ if 'Pools' in jsonSrc:
|
|||||||
typeData = GetDataForMemoryType(iType)
|
typeData = GetDataForMemoryType(iType)
|
||||||
objBlocks = objPool['Blocks']
|
objBlocks = objPool['Blocks']
|
||||||
bLinearAlgorithm = 'LinearAlgorithm' in objPool and objPool['LinearAlgorithm']
|
bLinearAlgorithm = 'LinearAlgorithm' in objPool and objPool['LinearAlgorithm']
|
||||||
for sBlockId, objBlock in objBlocks.items():
|
|
||||||
dstBlockArray = []
|
dstBlockArray = []
|
||||||
typeData['CustomPools'][int(sPoolId)] = dstBlockArray
|
typeData['CustomPools'][int(sPoolId)] = dstBlockArray
|
||||||
|
for sBlockId, objBlock in objBlocks.items():
|
||||||
ProcessBlock(dstBlockArray, int(sBlockId), objBlock, bLinearAlgorithm)
|
ProcessBlock(dstBlockArray, int(sBlockId), objBlock, bLinearAlgorithm)
|
||||||
|
|
||||||
iImgSizeY, fPixelsPerByte = CalcParams()
|
iImgSizeY, fPixelsPerByte = CalcParams()
|
||||||
@ -267,7 +270,7 @@ Main data structure - variable `data` - is a dictionary. Key is integer - memory
|
|||||||
- Fixed key 'Size'. Value is int.
|
- Fixed key 'Size'. Value is int.
|
||||||
- Fixed key 'Suballocations'. Value is list of tuples as above.
|
- Fixed key 'Suballocations'. Value is list of tuples as above.
|
||||||
- Fixed key 'CustomPools'. Value is dictionary.
|
- Fixed key 'CustomPools'. Value is dictionary.
|
||||||
- Key is integer pool ID. Value is list of objects, each containing dictionary with:
|
- 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 '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 'LinearAlgorithm'. Optional. Value is True.
|
||||||
|
Loading…
Reference in New Issue
Block a user