From 950863eef13e54eb4ce53a85ef10111fea31519c Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Tue, 23 Jun 2015 08:50:27 -0600 Subject: screenshot: Need a DestroyInstance Need way to clean up resources allocated at CreateInstance. --- layers/screenshot.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'layers/screenshot.cpp') diff --git a/layers/screenshot.cpp b/layers/screenshot.cpp index 19b1d4aa..90d5c037 100644 --- a/layers/screenshot.cpp +++ b/layers/screenshot.cpp @@ -288,6 +288,18 @@ VkResult VKAPI vkCreateInstance( return result; } +// hook DestroyInstance to remove tableInstanceMap entry +VK_LAYER_EXPORT VkResult VKAPI vkDestroyInstance(VkInstance instance) +{ + // Grab the key before the instance is destroyed. + dispatch_key key = get_dispatch_key(instance); + VkLayerInstanceDispatchTable *pTable = get_dispatch_table(screenshot_instance_table_map, instance); + VkResult res = pTable->DestroyInstance(instance); + + screenshot_instance_table_map.erase(key); + return res; +} + static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo, VkDevice device) { uint32_t i, ext_idx; -- cgit v1.2.3