aboutsummaryrefslogtreecommitdiff
path: root/layers/vk_layer_utils.cpp
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2016-03-15 14:21:59 -0600
committerMark Lobodzinski <mark@lunarg.com>2016-03-16 16:37:37 -0600
commit0cce4785d303c763e2293dca9b522064bbe5e4c7 (patch)
tree4c8a03d9c9079a400a21d21b0778ce6b3fd2f5bf /layers/vk_layer_utils.cpp
parentcc838f0850abf58243bca037288303c05899bc88 (diff)
downloadusermoji-0cce4785d303c763e2293dca9b522064bbe5e4c7.tar.xz
layers: Move layer debug action initialization into layer_utils
Also removed dead code from the layer generation script. Change-Id: I64fdcaaf1aed8152de62079568c8e247333d8c61
Diffstat (limited to 'layers/vk_layer_utils.cpp')
-rw-r--r--layers/vk_layer_utils.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/layers/vk_layer_utils.cpp b/layers/vk_layer_utils.cpp
index 9fea3899..43ddc8d4 100644
--- a/layers/vk_layer_utils.cpp
+++ b/layers/vk_layer_utils.cpp
@@ -27,7 +27,9 @@
#include <string.h>
#include <string>
+#include <vector>
#include "vulkan/vulkan.h"
+#include "vk_layer_config.h"
#include "vk_layer_utils.h"
typedef struct _VULKAN_FORMAT_INFO {
@@ -608,3 +610,46 @@ VkStringErrorFlags vk_string_validate(const int max_length, const char *utf8) {
}
return result;
}
+
+void layer_debug_actions(debug_report_data *report_data, std::vector<VkDebugReportCallbackEXT> logging_callback,
+ const VkAllocationCallbacks *pAllocator, const char *layer_identifier) {
+
+ uint32_t report_flags = 0;
+ uint32_t debug_action = 0;
+ FILE *log_output = NULL;
+ const char *option_str;
+ VkDebugReportCallbackEXT callback;
+
+ std::string option_flags = layer_identifier;
+ std::string log_filename = layer_identifier;
+ option_flags.append(".report_flags");
+ log_filename.append(".log_filename");
+
+ // initialize layer options
+ report_flags = getLayerOptionFlags(option_flags.c_str(), 0);
+ getLayerOptionEnum(log_filename.c_str(), (uint32_t *)&debug_action);
+
+ if (debug_action & VK_DBG_LAYER_ACTION_LOG_MSG) {
+ option_str = getLayerOption(log_filename.c_str());
+ log_output = getLayerLogOutput(option_str, layer_identifier);
+ VkDebugReportCallbackCreateInfoEXT dbgCreateInfo;
+ memset(&dbgCreateInfo, 0, sizeof(dbgCreateInfo));
+ dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
+ dbgCreateInfo.flags = report_flags;
+ dbgCreateInfo.pfnCallback = log_callback;
+ dbgCreateInfo.pUserData = (void *)log_output;
+ layer_create_msg_callback(report_data, &dbgCreateInfo, pAllocator, &callback);
+ logging_callback.push_back(callback);
+ }
+
+ if (debug_action & VK_DBG_LAYER_ACTION_DEBUG_OUTPUT) {
+ VkDebugReportCallbackCreateInfoEXT dbgCreateInfo;
+ memset(&dbgCreateInfo, 0, sizeof(dbgCreateInfo));
+ dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
+ dbgCreateInfo.flags = report_flags;
+ dbgCreateInfo.pfnCallback = win32_debug_output_msg;
+ dbgCreateInfo.pUserData = NULL;
+ layer_create_msg_callback(report_data, &dbgCreateInfo, pAllocator, &callback);
+ logging_callback.push_back(callback);
+ }
+}