From ff71cd1a856257c607bf933d436f0b5fd94568f9 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Thu, 18 Aug 2016 07:58:33 -0600 Subject: layers: Flag error on destroyed pipeline in-use --- layers/core_validation.cpp | 6 +++++- layers/core_validation_types.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 8d4e492c..b8c61a39 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -5733,10 +5733,14 @@ DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAlloca VKAPI_ATTR void VKAPI_CALL DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) { layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); - // TODO : Add detection for in-flight pipeline std::unique_lock lock(global_lock); auto pipe_node = getPipeline(dev_data, pipeline); if (pipe_node) { + if (pipe_node->in_use.load()) { + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, + reinterpret_cast(pipeline), __LINE__, DRAWSTATE_OBJECT_INUSE, "DS", + "Pipeline 0x%" PRIx64 " being destroyed while in use.", reinterpret_cast(pipeline)); + } // Any bound cmd buffers are now invalid invalidateCommandBuffers(pipe_node->cb_bindings, {reinterpret_cast(pipeline), VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT}); diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h index f36e3b2d..3e5d8336 100644 --- a/layers/core_validation_types.h +++ b/layers/core_validation_types.h @@ -507,7 +507,7 @@ class PIPELINE_NODE : public BASE_NODE { PIPELINE_NODE() : pipeline{}, graphicsPipelineCI{}, computePipelineCI{}, active_shaders(0), duplicate_shaders(0), active_slots(), vertexBindingDescriptions(), vertexAttributeDescriptions(), attachments(), blendConstantsEnabled(false), render_pass_ci(), - pipeline_layout() {} + pipeline_layout() { in_use.store(0); } void initGraphicsPipeline(const VkGraphicsPipelineCreateInfo *pCreateInfo) { graphicsPipelineCI.initialize(pCreateInfo); -- cgit v1.2.3