diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-07-08 15:42:38 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-07-13 11:29:38 -0600 |
| commit | 685d5140674aca747386a6fdf974280e557d895a (patch) | |
| tree | 24de4902b0b2b8f10a128527579f8cc80cef473e | |
| parent | 54091cf3b7b2068543a931aca5af206adfa475f8 (diff) | |
| download | usermoji-685d5140674aca747386a6fdf974280e557d895a.tar.xz | |
layers: Add binding between cmd buffer and pipeline
Track all pipelines bound to a cmd buffer and if any of them are destroyed
set the cmd buffer as invalid.
| -rw-r--r-- | layers/core_validation.cpp | 22 | ||||
| -rw-r--r-- | layers/core_validation.h | 2 |
2 files changed, 21 insertions, 3 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 126345a8..98cab913 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -658,6 +658,8 @@ static const char *object_type_to_string(VkDebugReportObjectTypeEXT type) { return "event"; case VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT: return "query pool"; + case VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT: + return "pipeline"; default: return "unknown"; } @@ -3761,6 +3763,12 @@ static void removeCommandBufferBinding(layer_data *dev_data, VK_OBJECT const *ob qp_node->cb_bindings.erase(cb_node); break; } + case VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT: { + auto pipe_node = getPipeline(dev_data, reinterpret_cast<VkPipeline>(object->handle)); + if (pipe_node) + pipe_node->cb_bindings.erase(cb_node); + break; + } default: assert(0); // unhandled object type } @@ -5403,8 +5411,16 @@ DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAlloca VKAPI_ATTR void VKAPI_CALL DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) { - get_my_data_ptr(get_dispatch_key(device), layer_data_map)->device_dispatch_table->DestroyPipeline(device, pipeline, pAllocator); - // TODO : Clean up any internal data structures using this obj. + layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); + dev_data->device_dispatch_table->DestroyPipeline(device, pipeline, pAllocator); + + auto pipe_node = getPipeline(dev_data, pipeline); + if (pipe_node) { + // Any bound cmd buffers are now invalid + invalidateCommandBuffers(pipe_node->cb_bindings, + {reinterpret_cast<uint64_t &>(pipeline), VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT}); + dev_data->pipelineMap.erase(pipeline); + } } VKAPI_ATTR void VKAPI_CALL @@ -6577,6 +6593,8 @@ CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindP (uint64_t)pipeline, __LINE__, DRAWSTATE_INVALID_PIPELINE, "DS", "Attempt to bind Pipeline 0x%" PRIxLEAST64 " that doesn't exist!", (uint64_t)(pipeline)); } + addCommandBufferBinding(&getPipeline(dev_data, pipeline)->cb_bindings, + {reinterpret_cast<uint64_t &>(pipeline), VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT}, pCB); } lock.unlock(); if (!skip_call) diff --git a/layers/core_validation.h b/layers/core_validation.h index 9a004414..6a5a0a4d 100644 --- a/layers/core_validation.h +++ b/layers/core_validation.h @@ -125,7 +125,7 @@ struct IMAGE_LAYOUT_NODE { VkFormat format; }; -class PIPELINE_NODE { +class PIPELINE_NODE : public BASE_NODE { public: VkPipeline pipeline; safe_VkGraphicsPipelineCreateInfo graphicsPipelineCI; |
