aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-05-17 18:47:09 +1200
committerTobin Ehlis <tobine@google.com>2016-05-19 08:48:42 -0600
commite4c92d5ab6ea4b6a36f4d142698da5cabaee154b (patch)
tree892c33f4b177635ac433f4c8269833561c9dbf18 /layers/core_validation.cpp
parentd2769d64be84e67a93a0df1503b4ea44c3d56f6b (diff)
downloadusermoji-e4c92d5ab6ea4b6a36f4d142698da5cabaee154b.tar.xz
layers: Simplify command buffer pool cleanup
We don't need to carefully pick through the pool's buffers, removing them. We're about to throw away the whole container. Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 4e584493..6e05d480 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -5386,15 +5386,13 @@ DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocatio
// Verify that command buffers in pool are complete (not in-flight)
VkBool32 result = checkAndClearCommandBuffersInFlight(dev_data, commandPool, "destroy command pool with");
// Must remove cmdpool from cmdpoolmap, after removing all cmdbuffers in its list from the commandPoolMap
- if (dev_data->commandPoolMap.find(commandPool) != dev_data->commandPoolMap.end()) {
- for (auto poolCb = dev_data->commandPoolMap[commandPool].commandBuffers.begin();
- poolCb != dev_data->commandPoolMap[commandPool].commandBuffers.end();) {
- clear_cmd_buf_and_mem_references(dev_data, *poolCb);
- auto del_cb = dev_data->commandBufferMap.find(*poolCb);
- delete (*del_cb).second; // delete CB info structure
+ auto pool_it = dev_data->commandPoolMap.find(commandPool);
+ if (pool_it != dev_data->commandPoolMap.end()) {
+ for (auto cb : pool_it->second.commandBuffers) {
+ clear_cmd_buf_and_mem_references(dev_data, cb);
+ auto del_cb = dev_data->commandBufferMap.find(cb);
+ delete del_cb->second; // delete CB info structure
dev_data->commandBufferMap.erase(del_cb); // Remove this command buffer
- poolCb = dev_data->commandPoolMap[commandPool].commandBuffers.erase(
- poolCb); // Remove CB reference from commandPoolMap's list
}
}
dev_data->commandPoolMap.erase(commandPool);