aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtney@LunarG.com>2015-09-18 16:30:24 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-09-23 11:14:59 -0600
commitb971e7234cc5c0aea1236e612d6bd3a3cd74cfd9 (patch)
treef774c82fee6b925fcfc19837d3f31c4d46a2304c
parente27ff8feeaa451f4a4307ee6a46073fb027d4ec4 (diff)
downloadusermoji-b971e7234cc5c0aea1236e612d6bd3a3cd74cfd9.tar.xz
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.
-rw-r--r--layers/vk_layer_logging.h17
1 files changed, 17 insertions, 0 deletions
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
@@ -231,6 +231,23 @@ static inline PFN_vkVoidFunction debug_report_get_instance_proc_addr(
}
/*
+ * 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