From 0cce4785d303c763e2293dca9b522064bbe5e4c7 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Tue, 15 Mar 2016 14:21:59 -0600 Subject: layers: Move layer debug action initialization into layer_utils Also removed dead code from the layer generation script. Change-Id: I64fdcaaf1aed8152de62079568c8e247333d8c61 --- layers/image.cpp | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) (limited to 'layers/image.cpp') diff --git a/layers/image.cpp b/layers/image.cpp index ca7f223f..9d7f6cdb 100644 --- a/layers/image.cpp +++ b/layers/image.cpp @@ -70,35 +70,9 @@ struct layer_data { static unordered_map layer_data_map; -static void InitImage(layer_data *data, const VkAllocationCallbacks *pAllocator) { - VkDebugReportCallbackEXT callback; - uint32_t report_flags = getLayerOptionFlags("lunarg_image.report_flags", 0); - - uint32_t debug_action = 0; - getLayerOptionEnum("lunarg_image.debug_action", (uint32_t *)&debug_action); - if (debug_action & VK_DBG_LAYER_ACTION_LOG_MSG) { - FILE *log_output = NULL; - const char *option_str = getLayerOption("lunarg_image.log_filename"); - log_output = getLayerLogOutput(option_str, "lunarg_image"); - VkDebugReportCallbackCreateInfoEXT dbgInfo; - memset(&dbgInfo, 0, sizeof(dbgInfo)); - dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT; - dbgInfo.pfnCallback = log_callback; - dbgInfo.pUserData = log_output; - dbgInfo.flags = report_flags; - layer_create_msg_callback(data->report_data, &dbgInfo, pAllocator, &callback); - data->logging_callback.push_back(callback); - } +static void init_image(layer_data *my_data, const VkAllocationCallbacks *pAllocator) { - if (debug_action & VK_DBG_LAYER_ACTION_DEBUG_OUTPUT) { - VkDebugReportCallbackCreateInfoEXT dbgInfo; - memset(&dbgInfo, 0, sizeof(dbgInfo)); - dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT; - dbgInfo.pfnCallback = win32_debug_output_msg; - dbgInfo.flags = report_flags; - layer_create_msg_callback(data->report_data, &dbgInfo, pAllocator, &callback); - data->logging_callback.push_back(callback); - } + layer_debug_actions(my_data->report_data, my_data->logging_callback, pAllocator, "lunarg_image"); } VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL @@ -153,7 +127,7 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCall my_data->report_data = debug_report_create_instance(my_data->instance_dispatch_table, *pInstance, pCreateInfo->enabledExtensionCount, pCreateInfo->ppEnabledExtensionNames); - InitImage(my_data, pAllocator); + init_image(my_data, pAllocator); return result; } -- cgit v1.2.3