From 179449ccc08b26b4f13fa4b9d793ab46fd8b93f3 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Mon, 19 Dec 2016 11:16:14 -0700 Subject: [PATCH] layers:Clean up descriptor set layout on destroy Erase destroyed descriptorSetLayout from map. --- layers/core_validation.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 46ea89eb..09b41329 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -6107,11 +6107,16 @@ DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks * } } +static void PostCallRecordDestroyDescriptorSetLayout(layer_data *dev_data, VkDescriptorSetLayout ds_layout) { + dev_data->descriptorSetLayoutMap.erase(ds_layout); +} + VKAPI_ATTR void VKAPI_CALL DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks *pAllocator) { - // TODO : Clean up any internal data structures using this obj. - get_my_data_ptr(get_dispatch_key(device), layer_data_map) - ->dispatch_table.DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); + layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); + dev_data->dispatch_table.DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); + std::unique_lock lock(global_lock); + PostCallRecordDestroyDescriptorSetLayout(dev_data, descriptorSetLayout); } static bool PreCallValidateDestroyDescriptorPool(layer_data *dev_data, VkDescriptorPool pool, -- 2.34.1