aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-06-21 18:10:47 +1200
committerTobin Ehlis <tobine@google.com>2016-06-23 14:55:21 -0600
commitbd1920f82bd3464df777437a87e9db4551ed60db (patch)
treefd73e9739eb542a424b3d1733bd3858427e97f8a /layers/core_validation.cpp
parentfbd8827201c1ee7baa1c81453eadeaa12de22a61 (diff)
downloadusermoji-bd1920f82bd3464df777437a87e9db4551ed60db.tar.xz
layers: Fix ResetFences validation vs update
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 8f63ce7d..bfb758b7 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -5481,29 +5481,39 @@ ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetF
VKAPI_ATTR VkResult VKAPI_CALL ResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
- VkResult result = VK_ERROR_VALIDATION_FAILED_EXT;
bool skipCall = false;
std::unique_lock<std::mutex> lock(global_lock);
for (uint32_t i = 0; i < fenceCount; ++i) {
auto pFence = getFenceNode(dev_data, pFences[i]);
- if (pFence) {
- if (pFence->state == FENCE_INFLIGHT) {
- skipCall |=
+ if (pFence && pFence->state == FENCE_INFLIGHT) {
+ skipCall |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT,
reinterpret_cast<const uint64_t &>(pFences[i]), __LINE__, DRAWSTATE_INVALID_FENCE, "DS",
"Fence 0x%" PRIx64 " is in use.", reinterpret_cast<const uint64_t &>(pFences[i]));
- }
- pFence->state = FENCE_UNSIGNALED;
-
- // TODO: these should really have already been enforced on
- // INFLIGHT->RETIRED transition.
- pFence->queues.clear();
- pFence->priorFences.clear();
}
}
lock.unlock();
- if (!skipCall)
- result = dev_data->device_dispatch_table->ResetFences(device, fenceCount, pFences);
+
+ if (skipCall)
+ return VK_ERROR_VALIDATION_FAILED_EXT;
+
+ VkResult result = dev_data->device_dispatch_table->ResetFences(device, fenceCount, pFences);
+
+ if (result == VK_SUCCESS) {
+ lock.lock();
+ for (uint32_t i = 0; i < fenceCount; ++i) {
+ auto pFence = getFenceNode(dev_data, pFences[i]);
+ if (pFence) {
+ pFence->state = FENCE_UNSIGNALED;
+ // TODO: these should really have already been enforced on
+ // INFLIGHT->RETIRED transition.
+ pFence->queues.clear();
+ pFence->priorFences.clear();
+ }
+ }
+ lock.unlock();
+ }
+
return result;
}