mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
VmaDumpVis: Gracefully handle cases where there is nothing to put on the image, e.g. the stats string was generated without detailed map enabled
Message is printed in that case and 1 is returned instead of division by zero error. Closes #125
This commit is contained in:
parent
115d2971ae
commit
f6a4037af4
@ -66,6 +66,20 @@ def GetDataForMemoryType(iMemTypeIndex):
|
|||||||
return newMemTypeData
|
return newMemTypeData
|
||||||
|
|
||||||
|
|
||||||
|
def IsDataEmpty():
|
||||||
|
global data
|
||||||
|
for dictMemType in data.values():
|
||||||
|
if 'DedicatedAllocations' in dictMemType and len(dictMemType['DedicatedAllocations']) > 0:
|
||||||
|
return False
|
||||||
|
if 'DefaultPoolBlocks' in dictMemType and len(dictMemType['DefaultPoolBlocks']) > 0:
|
||||||
|
return False
|
||||||
|
if 'CustomPools' in dictMemType:
|
||||||
|
for lBlockList in dictMemType['CustomPools'].values():
|
||||||
|
if len(lBlockList) > 0:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
# Returns tuple:
|
# Returns tuple:
|
||||||
# [0] image height : integer
|
# [0] image height : integer
|
||||||
# [1] pixels per byte : float
|
# [1] pixels per byte : float
|
||||||
@ -204,6 +218,10 @@ if 'Pools' in jsonSrc:
|
|||||||
for sBlockId, objBlock in objBlocks.items():
|
for sBlockId, objBlock in objBlocks.items():
|
||||||
ProcessBlock(dstBlockArray, int(sBlockId), objBlock, sAlgorithm)
|
ProcessBlock(dstBlockArray, int(sBlockId), objBlock, sAlgorithm)
|
||||||
|
|
||||||
|
if IsDataEmpty():
|
||||||
|
print("There is nothing to put on the image. Please make sure you generated the stats string with detailed map enabled.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
iImgSizeY, fPixelsPerByte = CalcParams()
|
iImgSizeY, fPixelsPerByte = CalcParams()
|
||||||
|
|
||||||
img = Image.new('RGB', (IMG_SIZE_X, iImgSizeY), 'white')
|
img = Image.new('RGB', (IMG_SIZE_X, iImgSizeY), 'white')
|
||||||
|
Loading…
Reference in New Issue
Block a user