From 849ffee6d36b3f7c6e6723c4b62f56822c3741e5 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Thu, 19 May 2016 15:27:18 -0600 Subject: layers: Add default layer error message config Allows layers to output error messages even if no vk_layer_settings.txt config file is present. Sets defaults to LOG_MSG, error, stdout. A layer settings file will override any default values. If no settings file is present and an app creates a debug callback, the default callbacks will be removed and unregistered. Change-Id: I49f37189665816df58c258b9e9629f2bf76751c8 --- layers/vk_layer_utils.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'layers/vk_layer_utils.cpp') diff --git a/layers/vk_layer_utils.cpp b/layers/vk_layer_utils.cpp index 1c362706..d028ca65 100644 --- a/layers/vk_layer_utils.cpp +++ b/layers/vk_layer_utils.cpp @@ -604,11 +604,20 @@ VkStringErrorFlags vk_string_validate(const int max_length, const char *utf8) { return result; } +// Debug callbacks get created in three ways: +// o Application-defined debug callbacks +// o Through settings in a vk_layer_settings.txt file +// o By default, if neither an app-defined debug callback nor a vk_layer_settings.txt file is present +// +// At layer initialization time, default logging callbacks are created to output layer error messages. +// If a vk_layer_settings.txt file is present its settings will override any default settings. +// +// If a vk_layer_settings.txt file is present and an application defines a debug callback, both callbacks +// will be active. If no vk_layer_settings.txt file is present, creating an application-defined debug +// callback will cause the default callbacks to be unregisterd and removed. void layer_debug_actions(debug_report_data *report_data, std::vector &logging_callback, - const VkAllocationCallbacks *pAllocator, const char *layer_identifier) { + const VkAllocationCallbacks *pAllocator, const char *layer_identifier) { - uint32_t report_flags = 0; - uint32_t debug_action = 0; VkDebugReportCallbackEXT callback = VK_NULL_HANDLE; std::string report_flags_key = layer_identifier; @@ -618,9 +627,11 @@ void layer_debug_actions(debug_report_data *report_data, std::vector