VmaDumpVis: Improved coloring based on new Usage parameter dumped in JSON.
@ -28,7 +28,15 @@ You can also use typical options:
|
||||
## Legend
|
||||
|
||||
* ![Free space](README_files/Legend_Bkg.png "Free space") Light gray without border - a space in Vulkan device memory block unused by any allocation.
|
||||
* ![Buffer](README_files/Legend_Buffer.png "Buffer") Yellow rectangle - buffer.
|
||||
* ![Image Optimal](README_files/Legend_ImageOptimal.png "Image Optimal") Aqua rectangle - image with TILING_OPTIMAL.
|
||||
* ![Image Linear](README_files/Legend_ImageLinear.png "Image Linear") Green rectangle - image with TILING_LINEAR.
|
||||
* ![Details](README_files/Legend_Details.png "Details") Black bar or rectangle - one or more allocations of any kind too small to be visualized as filled rectangles.
|
||||
* ![Buffer 1](README_files/Legend_Buffer_1.png "Buffer 1") Buffer with usage containing INDIRECT_BUFFER, VERTEX_BUFFER, or INDEX_BUFFER.
|
||||
* ![Buffer 2](README_files/Legend_Buffer_2.png "Buffer 2") Buffer with usage containing STORAGE_BUFFER or STORAGE_TEXEL_BUFFER.
|
||||
* ![Buffer 3](README_files/Legend_Buffer_3.png "Buffer 3") Buffer with usage containing UNIFORM_BUFFER or UNIFORM_TEXEL_BUFFER.
|
||||
* ![Buffer 4](README_files/Legend_Buffer_4.png "Buffer 4") Other buffer.
|
||||
* ![Image 1](README_files/Legend_Image_1.png "Image 1") Image with OPTIMAL tiling and usage containing DEPTH_STENCIL_ATTACHMENT.
|
||||
* ![Image 2](README_files/Legend_Image_2.png "Image 2") Image with OPTIMAL tiling and usage containing INPUT_ATTACHMENT, TRANSIENT_ATTACHMENT, or COLOR_ATTACHMENT.
|
||||
* ![Image 3](README_files/Legend_Image_3.png "Image 3") Image with OPTIMAL tiling and usage containing SAMPLED.
|
||||
* ![Image 4](README_files/Legend_Image_4.png "Image 4") Other image with OPTIMAL tiling.
|
||||
* ![Image Linear](README_files/Legend_Image_Linear.png "Image Linear") Image with LINEAR tiling.
|
||||
* ![Image Unknown](README_files/Legend_Image_Unknown.png "Image Unknown") Image with tiling unknown to the allocator.
|
||||
* ![Unknown](README_files/Legend_Unknown.png "Unknown") Allocation of unknown type.
|
||||
* ![Details](README_files/Legend_Details.png "Details") Black bar - one or more allocations of any kind too small to be visualized as filled rectangles.
|
||||
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 214 B |
BIN
tools/VmaDumpVis/README_files/Legend_Buffer_1.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
tools/VmaDumpVis/README_files/Legend_Buffer_2.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
tools/VmaDumpVis/README_files/Legend_Buffer_3.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
tools/VmaDumpVis/README_files/Legend_Buffer_4.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 964 B |
Before Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 215 B |
BIN
tools/VmaDumpVis/README_files/Legend_Image_1.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
tools/VmaDumpVis/README_files/Legend_Image_2.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
tools/VmaDumpVis/README_files/Legend_Image_3.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
tools/VmaDumpVis/README_files/Legend_Image_4.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
tools/VmaDumpVis/README_files/Legend_Image_Linear.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
tools/VmaDumpVis/README_files/Legend_Image_Unknown.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
tools/VmaDumpVis/README_files/Legend_Unknown.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
@ -32,7 +32,7 @@ FONT_SIZE = 10
|
||||
MAP_SIZE = 24
|
||||
COLOR_TEXT_H1 = (0, 0, 0, 255)
|
||||
COLOR_TEXT_H2 = (150, 150, 150, 255)
|
||||
COLOR_OUTLINE = (160, 160, 160, 255)
|
||||
COLOR_OUTLINE = (155, 155, 155, 255)
|
||||
COLOR_OUTLINE_HARD = (0, 0, 0, 255)
|
||||
COLOR_GRID_LINE = (224, 224, 224, 255)
|
||||
|
||||
@ -52,7 +52,7 @@ def ProcessBlock(dstBlockList, objBlock):
|
||||
dstBlockObj = {'Size':iBlockSize, 'Suballocations':[]}
|
||||
dstBlockList.append(dstBlockObj)
|
||||
for objSuballoc in arrSuballocs:
|
||||
dstBlockObj['Suballocations'].append((objSuballoc['Type'], int(objSuballoc['Size'])))
|
||||
dstBlockObj['Suballocations'].append((objSuballoc['Type'], int(objSuballoc['Size']), int(objSuballoc['Usage']) if ('Usage' in objSuballoc) else 0))
|
||||
|
||||
|
||||
def GetDataForMemoryType(iMemTypeIndex):
|
||||
@ -88,15 +88,33 @@ def CalcParams():
|
||||
return iImgSizeY, fPixelsPerByte
|
||||
|
||||
|
||||
def TypeToColor(sType):
|
||||
def TypeToColor(sType, iUsage):
|
||||
if sType == 'FREE':
|
||||
return 220, 220, 220, 255
|
||||
elif sType == 'BUFFER':
|
||||
return 255, 255, 0, 255
|
||||
if (iUsage & 0x1C0) != 0: # INDIRECT_BUFFER | VERTEX_BUFFER | INDEX_BUFFER
|
||||
return 255, 148, 148, 255 # Red
|
||||
elif (iUsage & 0x28) != 0: # STORAGE_BUFFER | STORAGE_TEXEL_BUFFER
|
||||
return 255, 187, 121, 255 # Orange
|
||||
elif (iUsage & 0x14) != 0: # UNIFORM_BUFFER | UNIFORM_TEXEL_BUFFER
|
||||
return 255, 255, 0, 255 # Yellow
|
||||
else:
|
||||
return 255, 255, 165, 255 # Light yellow
|
||||
elif sType == 'IMAGE_OPTIMAL':
|
||||
return 128, 255, 255, 255
|
||||
if (iUsage & 0x20) != 0: # DEPTH_STENCIL_ATTACHMENT
|
||||
return 246, 128, 255, 255 # Pink
|
||||
elif (iUsage & 0xD0) != 0: # INPUT_ATTACHMENT | TRANSIENT_ATTACHMENT | COLOR_ATTACHMENT
|
||||
return 179, 179, 255, 255 # Blue
|
||||
elif (iUsage & 0x4) != 0: # SAMPLED
|
||||
return 0, 255, 255, 255 # Aqua
|
||||
else:
|
||||
return 183, 255, 255, 255 # Light aqua
|
||||
elif sType == 'IMAGE_LINEAR':
|
||||
return 64, 255, 64, 255
|
||||
return 0, 255, 0, 255 # Green
|
||||
elif sType == 'IMAGE_UNKNOWN':
|
||||
return 0, 255, 164, 255 # Green/aqua
|
||||
elif sType == 'UNKNOWN':
|
||||
return 175, 175, 175, 255 # Gray
|
||||
assert False
|
||||
return 0, 0, 0, 255
|
||||
|
||||
@ -105,14 +123,14 @@ def DrawDedicatedAllocationBlock(draw, y, tDedicatedAlloc):
|
||||
global fPixelsPerByte
|
||||
iSizeBytes = tDedicatedAlloc[1]
|
||||
iSizePixels = int(iSizeBytes * fPixelsPerByte)
|
||||
draw.rectangle([IMG_MARGIN, y, IMG_MARGIN + iSizePixels, y + MAP_SIZE], fill=TypeToColor(tDedicatedAlloc[0]), outline=COLOR_OUTLINE)
|
||||
draw.rectangle([IMG_MARGIN, y, IMG_MARGIN + iSizePixels, y + MAP_SIZE], fill=TypeToColor(tDedicatedAlloc[0], tDedicatedAlloc[2]), outline=COLOR_OUTLINE)
|
||||
|
||||
|
||||
def DrawBlock(draw, y, objBlock):
|
||||
global fPixelsPerByte
|
||||
iSizeBytes = objBlock['Size']
|
||||
iSizePixels = int(iSizeBytes * fPixelsPerByte)
|
||||
draw.rectangle([IMG_MARGIN, y, IMG_MARGIN + iSizePixels, y + MAP_SIZE], fill=TypeToColor('FREE'), outline=None)
|
||||
draw.rectangle([IMG_MARGIN, y, IMG_MARGIN + iSizePixels, y + MAP_SIZE], fill=TypeToColor('FREE', 0), outline=None)
|
||||
iByte = 0
|
||||
iX = 0
|
||||
iLastHardLineX = -1
|
||||
@ -122,7 +140,8 @@ def DrawBlock(draw, y, objBlock):
|
||||
iXEnd = int(iByteEnd * fPixelsPerByte)
|
||||
if sType != 'FREE':
|
||||
if iXEnd > iX + 1:
|
||||
draw.rectangle([IMG_MARGIN + iX, y, IMG_MARGIN + iXEnd, y + MAP_SIZE], fill=TypeToColor(sType), outline=COLOR_OUTLINE)
|
||||
iUsage = tSuballoc[2]
|
||||
draw.rectangle([IMG_MARGIN + iX, y, IMG_MARGIN + iXEnd, y + MAP_SIZE], fill=TypeToColor(sType, iUsage), outline=COLOR_OUTLINE)
|
||||
# Hard line was been overwritten by rectangle outline: redraw it.
|
||||
if iLastHardLineX == iX:
|
||||
draw.line([IMG_MARGIN + iX, y, IMG_MARGIN + iX, y + MAP_SIZE], fill=COLOR_OUTLINE_HARD)
|
||||
@ -154,7 +173,7 @@ if 'DedicatedAllocations' in jsonSrc:
|
||||
iType = int(sType[5:])
|
||||
typeData = GetDataForMemoryType(iType)
|
||||
for objAlloc in tType[1]:
|
||||
typeData['DedicatedAllocations'].append((objAlloc['Type'], int(objAlloc['Size'])))
|
||||
typeData['DedicatedAllocations'].append((objAlloc['Type'], int(objAlloc['Size']), int(objAlloc['Usage']) if ('Usage' in objAlloc) else 0))
|
||||
if 'DefaultPools' in jsonSrc:
|
||||
for tType in jsonSrc['DefaultPools'].items():
|
||||
sType = tType[0]
|
||||
@ -172,7 +191,6 @@ if 'Pools' in jsonSrc:
|
||||
for objBlock in arrBlocks:
|
||||
ProcessBlock(typeData['CustomPoolBlocks'], objBlock)
|
||||
|
||||
|
||||
iImgSizeY, fPixelsPerByte = CalcParams()
|
||||
|
||||
img = Image.new('RGB', (IMG_SIZE_X, iImgSizeY), 'white')
|
||||
@ -234,6 +252,7 @@ Main data structure - variable `data` - is a dictionary. Key is integer - memory
|
||||
- Fixed key 'DedicatedAllocations'. Value is list of tuples, each containing:
|
||||
- [0]: Type : string
|
||||
- [1]: Size : integer
|
||||
- [2]: Usage : integer (0 if unknown)
|
||||
- Fixed key 'DefaultPoolBlocks'. Value is list of objects, each containing dictionary with:
|
||||
- Fixed key 'Size'. Value is int.
|
||||
- Fixed key 'Suballocations'. Value is list of tuples as above.
|
||||
|