From 7b9c7df9429752dec171c56c272bef2d8e464715 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Fri, 15 Apr 2016 11:59:39 -0600 Subject: layers: Fix vkResetDescriptorPool When we reset descriptor pool, need to remove the allocated descriptors from setMap and free them. --- layers/core_validation.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 15191b5a..c1ea5677 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -4194,12 +4194,17 @@ static void clearDescriptorPool(layer_data *my_data, const VkDevice device, cons "Unable to find pool node for pool %#" PRIxLEAST64 " specified in vkResetDescriptorPool() call", (uint64_t)pool); } else { // TODO: validate flags - // For every set off of this pool, clear it + // For every set off of this pool, clear it, remove from setMap, and free SET_NODE SET_NODE *pSet = pPool->pSets; + SET_NODE *pFreeSet = pSet; while (pSet) { clearDescriptorSet(my_data, pSet->set); + my_data->setMap.erase(pSet->set); + pFreeSet = pSet; pSet = pSet->pNext; + delete pFreeSet; } + pPool->pSets = nullptr; // Reset available count for each type and available sets for this pool for (uint32_t i = 0; i < pPool->availableDescriptorTypeCount.size(); ++i) { pPool->availableDescriptorTypeCount[i] = pPool->maxDescriptorTypeCount[i]; -- cgit v1.2.3