From a8899d101cae5004a1dfc8a758f60d0bb81674f6 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Wed, 28 Sep 2016 12:45:29 -0600 Subject: [PATCH] layers: Add debug marker extension support to OT Added object_tracker checking for Debug Marker functions SetObjectTag, SetObjectName, Begin, End, and Insert. Change-Id: Ibc13192bed2003d176df97719c9162b90051b703 --- layers/object_tracker.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/layers/object_tracker.cpp b/layers/object_tracker.cpp index 2177dca..73f634d 100644 --- a/layers/object_tracker.cpp +++ b/layers/object_tracker.cpp @@ -3587,6 +3587,61 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelin return result; } +// VK_EXT_debug_marker Extension +VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { + bool skip_call = VK_FALSE; + std::unique_lock lock(global_lock); + skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); + lock.unlock(); + if (skip_call) { + return VK_ERROR_VALIDATION_FAILED_EXT; + } + VkResult result = get_dispatch_table(ot_device_table_map, device)->DebugMarkerSetObjectTagEXT(device, pTagInfo); + return result; +} + +VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { + bool skip_call = VK_FALSE; + std::unique_lock lock(global_lock); + skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); + lock.unlock(); + if (skip_call) { + return VK_ERROR_VALIDATION_FAILED_EXT; + } + VkResult result = get_dispatch_table(ot_device_table_map, device)->DebugMarkerSetObjectNameEXT(device, pNameInfo); + return result; +} + +VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { + bool skip_call = VK_FALSE; + std::unique_lock lock(global_lock); + skip_call |= ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); + lock.unlock(); + if (!skip_call) { + get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo); + } +} + +VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerEndEXT(VkCommandBuffer commandBuffer) { + bool skip_call = VK_FALSE; + std::unique_lock lock(global_lock); + skip_call |= ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); + lock.unlock(); + if (!skip_call) { + get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDebugMarkerEndEXT(commandBuffer); + } +} + +VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { + bool skip_call = VK_FALSE; + std::unique_lock lock(global_lock); + skip_call |= ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); + lock.unlock(); + if (!skip_call) { + get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo); + } +} + static inline PFN_vkVoidFunction InterceptCoreDeviceCommand(const char *name) { if (!name || name[0] != 'v' || name[1] != 'k') return NULL; @@ -3834,6 +3889,16 @@ static inline PFN_vkVoidFunction InterceptCoreDeviceCommand(const char *name) { return (PFN_vkVoidFunction)CmdEndRenderPass; if (!strcmp(name, "CmdExecuteCommands")) return (PFN_vkVoidFunction)CmdExecuteCommands; + if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) + return (PFN_vkVoidFunction)DebugMarkerSetObjectTagEXT; + if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) + return (PFN_vkVoidFunction)DebugMarkerSetObjectNameEXT; + if (!strcmp(name, "CmdDebugMarkerBeginEXT")) + return (PFN_vkVoidFunction)CmdDebugMarkerBeginEXT; + if (!strcmp(name, "CmdDebugMarkerEndEXT")) + return (PFN_vkVoidFunction)CmdDebugMarkerEndEXT; + if (!strcmp(name, "CmdDebugMarkerInsertEXT")) + return (PFN_vkVoidFunction)CmdDebugMarkerInsertEXT; return NULL; } -- 2.7.4