From 4c0eb627a04186251aea4b63581ca74ccab0a956 Mon Sep 17 00:00:00 2001 From: John Zulauf Date: Wed, 17 Jan 2018 11:06:34 -0700 Subject: layers: Add validation for destroyed layouts Add three tests to flag with descriptor set update operations are being done to descriptor sets with destroyed descriptor set layouts. The tests use overload VUID (generic "must be valid * handles) which need to be replaced with specific ones when they are added to the spec. VALIDATION_ERROR_15c00280 (write dst must be valid) -> write dst created from destroyed layout VALIDATION_ERROR_03207601 (copy dst must be valid) -> copy dst created from destroyed layout VALIDATION_ERROR_0322d201 (copy src must be valid) -> copy src create from destroyed layout Change-Id: I8a3edc67b3e86037cdaa6353176814abfddef1a0 --- layers/core_validation.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index edd42a9f..a515e43c 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -138,7 +138,7 @@ struct layer_data { unordered_map commandPoolMap; unordered_map descriptorPoolMap; unordered_map setMap; - unordered_map> descriptorSetLayoutMap; + unordered_map> descriptorSetLayoutMap; unordered_map pipelineLayoutMap; unordered_map> memObjMap; unordered_map fenceMap; @@ -3981,7 +3981,11 @@ VKAPI_ATTR void VKAPI_CALL DestroySampler(VkDevice device, VkSampler sampler, co } static void PostCallRecordDestroyDescriptorSetLayout(layer_data *dev_data, VkDescriptorSetLayout ds_layout) { - dev_data->descriptorSetLayoutMap.erase(ds_layout); + auto layout_it = dev_data->descriptorSetLayoutMap.find(ds_layout); + if (layout_it != dev_data->descriptorSetLayoutMap.end()) { + layout_it->second.get()->MarkDestroyed(); + dev_data->descriptorSetLayoutMap.erase(layout_it); + } } VKAPI_ATTR void VKAPI_CALL DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, -- cgit v1.2.3