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.
diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h
index bef168c..065135a 100644
--- a/layers/vk_layer_logging.h
+++ b/layers/vk_layer_logging.h
@@ -231,6 +231,23 @@
}
/*
+ * 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
* is only computed if a message needs to be logged