struct layer_data {
debug_report_data *report_data;
// TODO: put instance data here
- VkDbgMsgCallback logging_callback;
+ std::vector<VkDbgMsgCallback> logging_callback;
layer_data() :
- report_data(nullptr),
- logging_callback(nullptr)
+ report_data(nullptr)
{};
};
uint32_t debug_action = 0;
FILE *log_output = NULL;
const char *option_str;
+ VkDbgMsgCallback callback;
// initialize ShaderChecker options
report_flags = getLayerOptionFlags("ShaderCheckerReportFlags", 0);
getLayerOptionEnum("ShaderCheckerDebugAction", (uint32_t *) &debug_action);
{
option_str = getLayerOption("ShaderCheckerLogFilename");
log_output = getLayerLogOutput(option_str, "ShaderChecker");
- layer_create_msg_callback(my_data->report_data, report_flags, log_callback, (void *) log_output, &my_data->logging_callback);
+ layer_create_msg_callback(my_data->report_data, report_flags, log_callback, (void *) log_output, &callback);
+ my_data->logging_callback.push_back(callback);
+ }
+
+ if (debug_action & VK_DBG_LAYER_ACTION_DEBUG_OUTPUT) {
+ layer_create_msg_callback(my_data->report_data, report_flags, win32_debug_output_msg, NULL, &callback);
+ my_data->logging_callback.push_back(callback);
}
if (!globalLockInitialized)
// Clean up logging callback, if any
layer_data *my_data = get_my_data_ptr(key, layer_data_map);
- if (my_data->logging_callback) {
- layer_destroy_msg_callback(my_data->report_data, my_data->logging_callback);
+ while (my_data->logging_callback.size() > 0) {
+ VkDbgMsgCallback callback = my_data->logging_callback.back();
+ layer_destroy_msg_callback(my_data->report_data, callback);
+ my_data->logging_callback.pop_back();
}
layer_debug_report_destroy_instance(my_data->report_data);