From ab32819639c274019fd17736f8341cc04a5e6d7b Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Fri, 4 Sep 2015 13:52:24 -0600 Subject: layers: Add bailout flag to debug report callback Layer validation tests will deliberately induce errors that the validation layer should catch. In these cases we don't really want the layer to call down the chain once it's detected a failure. We can't know that in the layer so changing the return value on the callback from void to VkBool32 so that the callback can indicate if the call should continue or not. true = bail. That allows the call chain to execute normally, not segfault in the driver and allow the test to clean things up. --- layers/mem_tracker.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'layers/mem_tracker.cpp') diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp index 62f4b268..7fa6e4c1 100644 --- a/layers/mem_tracker.cpp +++ b/layers/mem_tracker.cpp @@ -2428,17 +2428,22 @@ VK_LAYER_EXPORT VkResult VKAPI vkResetCommandBuffer( VkCmdBuffer cmdBuffer, VkCmdBufferResetFlags flags) { + VkBool32 bail = false; + loader_platform_thread_lock_mutex(&globalLock); // Verify that CB is complete (not in-flight) if (!checkCBCompleted(cmdBuffer)) { // TODO : Want cmdBuffer to be srcObj here - log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, MEMTRACK_RESET_CB_WHILE_IN_FLIGHT, "MEM", + bail = log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, MEMTRACK_RESET_CB_WHILE_IN_FLIGHT, "MEM", "Resetting CB %p before it has completed. You must check CB flag before " "calling vkResetCommandBuffer().", cmdBuffer); } // Clear memory references as this point. clear_cmd_buf_and_mem_references(cmdBuffer); loader_platform_thread_unlock_mutex(&globalLock); + if (bail) { + return VK_ERROR_UNKNOWN; + } VkResult result = get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->ResetCommandBuffer(cmdBuffer, flags); return result; } -- cgit v1.2.3