diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-09-19 13:10:37 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-09-22 07:21:24 -0600 |
| commit | 8f969432a0f658eb28b70717bc84c4bb87d59469 (patch) | |
| tree | e34161b2d9d9d4fe8ec6a22a909679b97589d529 | |
| parent | 7a2d99d5d038c6b20cc6d900f17fea8b0ef4107e (diff) | |
| download | usermoji-8f969432a0f658eb28b70717bc84c4bb87d59469.tar.xz | |
layers: Add in-use check for imageView
Add DestroyImageView time, make sure imageView is not in use.
| -rw-r--r-- | layers/core_validation.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index ca036216..12bc8a09 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -5798,9 +5798,21 @@ GetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements VKAPI_ATTR void VKAPI_CALL DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) { - // TODO : Clean up any internal data structures using this obj. - get_my_data_ptr(get_dispatch_key(device), layer_data_map) - ->device_dispatch_table->DestroyImageView(device, imageView, pAllocator); + layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); + bool skip = false; + std::unique_lock<std::mutex> lock(global_lock); + auto view_state = getImageViewState(dev_data, imageView); + if (view_state) { + VK_OBJECT obj_struct = {reinterpret_cast<uint64_t &>(imageView), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT}; + skip |= ValidateObjectNotInUse(dev_data, view_state, obj_struct); + // Any bound cmd buffers are now invalid + invalidateCommandBuffers(view_state->cb_bindings, obj_struct); + } + if (!skip) { + dev_data->imageViewMap.erase(imageView); + lock.unlock(); + dev_data->device_dispatch_table->DestroyImageView(device, imageView, pAllocator); + } } VKAPI_ATTR void VKAPI_CALL |
