From b971e7234cc5c0aea1236e612d6bd3a3cd74cfd9 Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Fri, 18 Sep 2015 16:30:24 -0600 Subject: layers: Add function to check if msg will be logged A layer can use will_log_msg to determine if any output at the designated notification level(s) will be sent somewhere. This will allow a validation layer to avoid high compute validation tests if the results are going to be looked at. --- layers/vk_layer_logging.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h index bef168cc..065135a6 100644 --- a/layers/vk_layer_logging.h +++ b/layers/vk_layer_logging.h @@ -230,6 +230,23 @@ static inline PFN_vkVoidFunction debug_report_get_instance_proc_addr( return NULL; } +/* + * Checks if the message will get logged. + * Allows layer to defer collecting & formating data if the + * message will be discarded. + */ +static inline VkBool32 will_log_msg( + debug_report_data *debug_data, + VkFlags msgFlags) +{ + if (!debug_data || !(debug_data->active_flags & msgFlags)) { + /* message is not wanted */ + return false; + } + + return true; +} + /* * Output log message via DEBUG_REPORT * Takes format and variable arg list so that output string -- cgit v1.2.3