aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGabríel Arthúr Pétursson <gabriel@system.is>2018-03-20 21:52:06 +0000
committerDave Houlton <daveh@lunarg.com>2018-04-04 16:16:14 -0600
commite86bb48e0aa57fb85865447c8d573cc724d71920 (patch)
tree1e6ef9310b828dc70ac44bab518ea562a000a109 /scripts
parentbd6c0d64e053529cf7947582a5b960bcfee538e6 (diff)
downloadusermoji-e86bb48e0aa57fb85865447c8d573cc724d71920.tar.xz
layers: Destroy object tracking after reporting undestroyed objects
Fixes a memleak in VkLayerTest.LeakAnObject.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/object_tracker_generator.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/object_tracker_generator.py b/scripts/object_tracker_generator.py
index e5475ec7..00b9bcd6 100644
--- a/scripts/object_tracker_generator.py
+++ b/scripts/object_tracker_generator.py
@@ -331,6 +331,7 @@ class ObjectTrackerOutputGenerator(OutputGenerator):
# Check if the parameter passed in is a pointer to an array
def paramIsArray(self, param):
return param.attrib.get('len') is not None
+
#
# Generate the object tracker undestroyed object validation function
def GenReportFunc(self):
@@ -342,6 +343,19 @@ class ObjectTrackerOutputGenerator(OutputGenerator):
output_func += ' DeviceReportUndestroyedObjects(device, %s, error_code);\n' % (self.GetVulkanObjType(handle))
output_func += '}\n'
return output_func
+
+ #
+ # Generate the object tracker undestroyed object destruction function
+ def GenDestroyFunc(self):
+ output_func = ''
+ output_func += 'void DestroyUndestroyedObjects(VkDevice device) {\n'
+ output_func += ' DeviceDestroyUndestroyedObjects(device, kVulkanObjectTypeCommandBuffer);\n'
+ for handle in self.object_types:
+ if self.isHandleTypeNonDispatchable(handle):
+ output_func += ' DeviceDestroyUndestroyedObjects(device, %s);\n' % (self.GetVulkanObjType(handle))
+ output_func += '}\n'
+ return output_func
+
#
# Called at beginning of processing as file is opened
def beginFile(self, genOpts):
@@ -401,8 +415,12 @@ class ObjectTrackerOutputGenerator(OutputGenerator):
# Build undestroyed objects reporting function
report_func = self.GenReportFunc()
self.newline()
+ # Build undestroyed objects destruction function
+ destroy_func = self.GenDestroyFunc()
+ self.newline()
write('// ObjectTracker undestroyed objects validation function', file=self.outFile)
write('%s' % report_func, file=self.outFile)
+ write('%s' % destroy_func, file=self.outFile)
# Actually write the interface to the output file.
if (self.emit):
self.newline()