diff options
| author | Michael Lentine <mlentine@google.com> | 2016-01-27 17:02:39 -0600 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2016-01-27 17:53:26 -0700 |
| commit | a3a7fd6cb59a00866de2b46763522351d0d1f7c5 (patch) | |
| tree | e9986d5d3e108afe290a382d994dd12c8cabf33d | |
| parent | 3943d717e54c6f4618ea9866215b70d20b62863d (diff) | |
| download | usermoji-a3a7fd6cb59a00866de2b46763522351d0d1f7c5.tar.xz | |
layers: MR171, Validate pool cannot be reset when buffer in use in draw_state
| -rw-r--r-- | layers/draw_state.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 46b6d8fa..e3b9e218 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -3665,6 +3665,23 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool( layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + bool skip_call = false; + loader_platform_thread_lock_mutex(&globalLock); + auto pool_data = dev_data->commandPoolMap.find(commandPool); + if (pool_data != dev_data->commandPoolMap.end()) { + for (auto cmdBuffer : pool_data->second.commandBuffers) { + if (dev_data->inFlightCmdBuffers.count(cmdBuffer)) { + skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT, reinterpret_cast<uint64_t>(commandPool), + __LINE__, DRAWSTATE_OBJECT_INUSE, "DS", "Cannot reset command pool %" PRIx64 " when allocated command buffer %" PRIx64 " is in use.", + reinterpret_cast<uint64_t>(commandPool), reinterpret_cast<uint64_t>(cmdBuffer)); + } + } + } + loader_platform_thread_unlock_mutex(&globalLock); + + if (skip_call) + return VK_ERROR_VALIDATION_FAILED_EXT; + result = dev_data->device_dispatch_table->ResetCommandPool(device, commandPool, flags); // Reset all of the CBs allocated from this pool if (VK_SUCCESS == result) { |
