aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtney@LunarG.com>2015-06-14 11:29:24 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-06-18 10:22:56 -0600
commite11ee846bbf144a303e68460690f51c8991943c1 (patch)
tree4ba40359bbabec315cf4e8fba2bc23d9ad0a4d20
parent191000bb52e9fe9c10d43d1375d64b18f1413285 (diff)
downloadusermoji-e11ee846bbf144a303e68460690f51c8991943c1.tar.xz
layers: Add logging callback function for layers
Now that new debug report mechanism is in place, need a callback function to output a log message. Can then have layers register callback with debug_report to have messages sent to stdout / FILE as well as whatever the application asked for.
-rw-r--r--layers/layer_logging.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/layers/layer_logging.h b/layers/layer_logging.h
index 68155a63..4b1fbcca 100644
--- a/layers/layer_logging.h
+++ b/layers/layer_logging.h
@@ -125,12 +125,14 @@ static inline debug_report_data *layer_debug_report_create_device(
debug_report_data *instance_debug_data,
VkDevice device)
{
- /* DEBUG_REPORT shared data between Instance and Device */
+ /* DEBUG_REPORT shares data between Instance and Device,
+ * so just return instance's data pointer */
return instance_debug_data;
}
static inline void layer_debug_report_destroy_device(VkDevice device)
{
+ /* Nothing to do since we're using instance data record */
}
static inline VkResult layer_create_msg_callback(
@@ -239,5 +241,21 @@ static inline void log_msg(
pLayerPrefix, str);
}
-#endif // LAYER_LOGGING_H
+static inline void VKAPI log_callback(
+ VkFlags msgFlags,
+ VkObjectType objType,
+ VkObject srcObject,
+ size_t location,
+ int32_t msgCode,
+ const char* pLayerPrefix,
+ const char* pMsg,
+ void* pUserData)
+{
+ char msg_flags[30];
+
+ print_msg_flags(msgFlags, msg_flags);
+ fprintf((FILE *) pUserData, "%s(%s): object: 0x%p type: %d location: %zu msgCode: %d: %s",
+ pLayerPrefix, msg_flags, srcObject, objType, location, msgCode, pMsg);
+}
+#endif // LAYER_LOGGING_H