aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-05-05 13:18:20 -0600
committerTobin Ehlis <tobine@google.com>2016-05-05 16:05:18 -0600
commit89af9e55233505748b663ea5c22ec5e73253d9a2 (patch)
tree37257d460554fe81e0f42cb20a4fdb202564266e /layers/core_validation.cpp
parenta66f11f6bc9a7849b99c67e106861765263d8d02 (diff)
downloadusermoji-89af9e55233505748b663ea5c22ec5e73253d9a2.tar.xz
layers: Fix descriptorSet cleanup bugs
When we deleted DescriptorSet* objects we weren't removing them from the setMap.
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index f5e3de59..71c62df5 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -3479,8 +3479,9 @@ static void deletePools(layer_data *my_data) {
if (my_data->descriptorPoolMap.size() <= 0)
return;
for (auto ii = my_data->descriptorPoolMap.begin(); ii != my_data->descriptorPoolMap.end(); ++ii) {
- // TODODS : Is this correct now?
+ // Remove this pools' sets from setMap and delete them
for (auto ds : (*ii).second->sets) {
+ my_data->setMap.erase(ds->GetSet());
delete ds;
}
}
@@ -3497,8 +3498,9 @@ static void clearDescriptorPool(layer_data *my_data, const VkDevice device, cons
} else {
// TODO: validate flags
// For every set off of this pool, clear it, remove from setMap, and free cvdescriptorset::DescriptorSet
- // TODODS : Updated this code for new DescriptorSet class, is below all we need?
for (auto ds : pPool->sets) {
+ // Remove this pools' sets from setMap and delete them
+ my_data->setMap.erase(ds->GetSet());
delete ds;
}
// Reset available count for each type and available sets for this pool
@@ -5946,7 +5948,7 @@ vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t
// Update available descriptor sets in pool
pPoolNode->availableSets += count;
- // For each freed descriptor add it back into the pool as available
+ // For each freed descriptor add its resources back into the pool as available and remove from setMap
for (uint32_t i = 0; i < count; ++i) {
cvdescriptorset::DescriptorSet *pSet = dev_data->setMap[pDescriptorSets[i]]; // getSetNode() without locking
invalidateBoundCmdBuffers(dev_data, pSet);
@@ -5956,6 +5958,8 @@ vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t
poolSizeCount = pSet->GetDescriptorCountFromIndex(j);
pPoolNode->availableDescriptorTypeCount[typeIndex] += poolSizeCount;
}
+ delete pSet;
+ dev_data->setMap.erase(pDescriptorSets[i]);
}
lock.unlock();
}