diff options
| author | Mike Stroyan <mike@LunarG.com> | 2015-08-18 14:48:34 -0600 |
|---|---|---|
| committer | Mike Stroyan <mike@LunarG.com> | 2015-09-23 12:33:57 -0600 |
| commit | 4da03f9c3105cbc6abe39faf7feb1337accf8229 (patch) | |
| tree | 582880daf6dfe31a5a4d5a5df6f8c4ded23349f7 | |
| parent | ab87a35c3cce98a78db804e40ea1b60f5f864f53 (diff) | |
| download | usermoji-4da03f9c3105cbc6abe39faf7feb1337accf8229.tar.xz | |
layers: VkDestroyInstance+VkDestroyDevice clear ObjectTracker maps
Don't complain about lingering objects more than once.
Once their device or instance is gone don't keep their information around.
This should change dramatically to have independent maps for each instance/device.
Don't complain about other devices remaining in vkDestroyDevice.
| -rwxr-xr-x | vk-layer-generate.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/vk-layer-generate.py b/vk-layer-generate.py index a4409bbd..990bfedf 100755 --- a/vk-layer-generate.py +++ b/vk-layer-generate.py @@ -1373,7 +1373,7 @@ class ObjectTrackerSubcommand(Subcommand): gedi_txt.append(' destroy_obj(instance, instance);') gedi_txt.append(' // Report any remaining objects in LL') for o in vulkan.core.objects: - if o in ['VkPhysicalDevice', 'VkQueue']: + if o in ['VkInstance', 'VkPhysicalDevice', 'VkQueue']: continue gedi_txt.append(' for (auto it = %sMap.begin(); it != %sMap.end(); ++it) {' % (o, o)) gedi_txt.append(' OBJTRACK_NODE* pNode = it->second;') @@ -1381,6 +1381,7 @@ class ObjectTrackerSubcommand(Subcommand): gedi_txt.append(' "OBJ ERROR : %s object 0x%" PRIxLEAST64 " has not been destroyed.", string_VkDbgObjectType(pNode->objType),') gedi_txt.append(' pNode->vkObj);') gedi_txt.append(' }') + gedi_txt.append(' %sMap.clear();' % (o)) gedi_txt.append('') gedi_txt.append(' dispatch_key key = get_dispatch_key(instance);') gedi_txt.append(' VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ObjectTracker_instance_table_map, instance);') @@ -1395,11 +1396,15 @@ class ObjectTrackerSubcommand(Subcommand): gedi_txt.append(' layer_debug_report_destroy_instance(mid(instance));') gedi_txt.append(' layer_data_map.erase(pInstanceTable);') gedi_txt.append('') - gedi_txt.append(' ObjectTracker_instance_table_map.erase(key);') gedi_txt.append(' instanceExtMap.erase(pInstanceTable);') - gedi_txt.append(' assert(ObjectTracker_instance_table_map.size() == 0 && "Should not have any instance mappings hanging around");') - gedi_txt.append('') gedi_txt.append(' loader_platform_thread_unlock_mutex(&objLock);') + # The loader holds a mutex that protects this from other threads + gedi_txt.append(' ObjectTracker_instance_table_map.erase(key);') + gedi_txt.append(' if (ObjectTracker_instance_table_map.empty()) {') + gedi_txt.append(' // Release mutex when destroying last instance.') + gedi_txt.append(' loader_platform_thread_delete_mutex(&objLock);') + gedi_txt.append(' objLockInitialized = 0;') + gedi_txt.append(' }') gedi_txt.append('}') gedi_txt.append('') return "\n".join(gedi_txt) @@ -1416,7 +1421,7 @@ class ObjectTrackerSubcommand(Subcommand): gedd_txt.append(' destroy_obj(device, device);') gedd_txt.append(' // Report any remaining objects in LL') for o in vulkan.core.objects: - if o in ['VkInstance', 'VkPhysicalDevice', 'VkQueue']: + if o in ['VkInstance', 'VkPhysicalDevice', 'VkQueue', 'VkDevice']: continue gedd_txt.append(' for (auto it = %sMap.begin(); it != %sMap.end(); ++it) {' % (o, o)) gedd_txt.append(' OBJTRACK_NODE* pNode = it->second;') @@ -1424,6 +1429,7 @@ class ObjectTrackerSubcommand(Subcommand): gedd_txt.append(' "OBJ ERROR : %s object 0x%" PRIxLEAST64 " has not been destroyed.", string_VkDbgObjectType(pNode->objType),') gedd_txt.append(' pNode->vkObj);') gedd_txt.append(' }') + gedd_txt.append(' %sMap.clear();' % (o)) gedd_txt.append('') gedd_txt.append(" // Clean up Queue's MemRef Linked Lists") gedd_txt.append(' destroyQueueMemRefLists();') |
