From 08dcf42bc295262e95ab0e17907e16fb914cf32d Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Wed, 28 Sep 2016 13:51:51 -0600 Subject: [PATCH] layers: Add debug marker extension support to PV Added parameter validation for Debug Marker functions SetObjectTag, SetObjectName, Begin, and Insert. Change-Id: I4e95b350a822fe296cbd750ea228a7d98e29241a --- layers/parameter_validation.cpp | 67 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/layers/parameter_validation.cpp b/layers/parameter_validation.cpp index 2bc8d38..8329bf4 100644 --- a/layers/parameter_validation.cpp +++ b/layers/parameter_validation.cpp @@ -5077,6 +5077,66 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(VkDevice device, uint32 return result; } +// VK_EXT_debug_marker Extension +VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { + VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + bool skip_call = false; + layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); + assert(my_data != NULL); + + skip_call |= parameter_validation_vkDebugMarkerSetObjectTagEXT(my_data->report_data, pTagInfo); + + if (!skip_call) { + result = get_dispatch_table(pc_device_table_map, device)->DebugMarkerSetObjectTagEXT(device, pTagInfo); + + validate_result(my_data->report_data, "vkDebugMarkerSetObjectTagEXT", result); + } + + return result; +} + +VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { + VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + bool skip_call = false; + layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); + assert(my_data != NULL); + + skip_call |= parameter_validation_vkDebugMarkerSetObjectNameEXT(my_data->report_data, pNameInfo); + + if (!skip_call) { + VkResult result = get_dispatch_table(pc_device_table_map, device)->DebugMarkerSetObjectNameEXT(device, pNameInfo); + + validate_result(my_data->report_data, "vkDebugMarkerSetObjectNameEXT", result); + } + + return result; +} + +VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { + bool skip_call = false; + layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); + assert(my_data != NULL); + + skip_call |= parameter_validation_vkCmdDebugMarkerBeginEXT(my_data->report_data, pMarkerInfo); + + if (!skip_call) { + get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo); + } +} + +VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { + bool skip_call = false; + layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); + assert(my_data != NULL); + + skip_call |= parameter_validation_vkCmdDebugMarkerInsertEXT(my_data->report_data, pMarkerInfo); + + if (!skip_call) { + get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo); + } +} + + static PFN_vkVoidFunction intercept_core_instance_command(const char *name); static PFN_vkVoidFunction intercept_core_device_command(const char *name); @@ -5288,7 +5348,12 @@ static PFN_vkVoidFunction intercept_core_device_command(const char *name) { {"vkCmdNextSubpass", reinterpret_cast(CmdNextSubpass)}, {"vkCmdExecuteCommands", reinterpret_cast(CmdExecuteCommands)}, {"vkCmdEndRenderPass", reinterpret_cast(CmdEndRenderPass)}, - }; + {"vkDebugMarkerSetObjectTagEXT", reinterpret_cast(DebugMarkerSetObjectTagEXT) }, + {"vkDebugMarkerSetObjectNameEXT", reinterpret_cast(DebugMarkerSetObjectNameEXT) }, + {"vkCmdDebugMarkerBeginEXT", reinterpret_cast(CmdDebugMarkerBeginEXT) }, + {"vkCmdDebugMarkerInsertEXT", reinterpret_cast(CmdDebugMarkerInsertEXT) }, +}; + for (size_t i = 0; i < ARRAY_SIZE(core_device_commands); i++) { if (!strcmp(core_device_commands[i].name, name)) -- 2.7.4