aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-06-21 18:17:41 +1200
committerTobin Ehlis <tobine@google.com>2016-06-23 14:55:21 -0600
commitc353ec205d3bc2a30335837b630c3de17c674114 (patch)
tree6d4f957c097d2c653aec7c6ee2553af536c96cb8 /layers/core_validation.cpp
parentbd1920f82bd3464df777437a87e9db4551ed60db (diff)
downloadusermoji-c353ec205d3bc2a30335837b630c3de17c674114.tar.xz
layers: Fix locking in ResetCommandPool
This got broken when some code moved around Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index bfb758b7..90695f55 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -5460,8 +5460,10 @@ ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetF
layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
bool skipCall = false;
+ std::unique_lock<std::mutex> lock(global_lock);
auto pPool = getCommandPoolNode(dev_data, commandPool);
skipCall |= checkCommandBuffersInFlight(dev_data, pPool, "reset command pool with");
+ lock.unlock();
if (skipCall)
return VK_ERROR_VALIDATION_FAILED_EXT;
@@ -5470,11 +5472,12 @@ ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetF
// Reset all of the CBs allocated from this pool
if (VK_SUCCESS == result) {
- std::lock_guard<std::mutex> lock(global_lock);
+ lock.lock();
clearCommandBuffersInFlight(dev_data, pPool);
for (auto cmdBuffer : pPool->commandBuffers) {
resetCB(dev_data, cmdBuffer);
}
+ lock.unlock();
}
return result;
}