diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-12-06 08:26:05 -0700 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-12-07 12:16:49 -0700 |
| commit | 3ea2774ed27ca451851bdab5ac2a2d3593af119a (patch) | |
| tree | 3e7dc7bfe70ac8181b3413e4606d256792dc1d4c /layers/core_validation.cpp | |
| parent | eed5115a4577fde3fea99f669ee270222bbfaf18 (diff) | |
| download | usermoji-3ea2774ed27ca451851bdab5ac2a2d3593af119a.tar.xz | |
layers:Refactor GetFenceStatus in core_validation
Refactor GetFenceStatus to use Pre/Post pattern.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index cf2c6ef1..71e937d9 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -5254,23 +5254,27 @@ WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBo return result; } +static bool PreCallValidateGetFenceStatus(layer_data *dev_data, VkFence fence) { + return verifyWaitFenceState(dev_data, fence, "vkGetFenceStatus"); +} + +static bool PostCallRecordGetFenceStatus(layer_data *dev_data, VkFence fence) { return RetireFence(dev_data, fence); } + VKAPI_ATTR VkResult VKAPI_CALL GetFenceStatus(VkDevice device, VkFence fence) { layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); - bool skip_call = false; std::unique_lock<std::mutex> lock(global_lock); - skip_call = verifyWaitFenceState(dev_data, fence, "vkGetFenceStatus"); + bool skip = PreCallValidateGetFenceStatus(dev_data, fence); lock.unlock(); - - if (skip_call) + if (skip) return VK_ERROR_VALIDATION_FAILED_EXT; VkResult result = dev_data->dispatch_table.GetFenceStatus(device, fence); - lock.lock(); if (result == VK_SUCCESS) { - skip_call |= RetireFence(dev_data, fence); + lock.lock(); + skip |= PostCallRecordGetFenceStatus(dev_data, fence); + lock.unlock(); } - lock.unlock(); - if (skip_call) + if (skip) return VK_ERROR_VALIDATION_FAILED_EXT; return result; } |
