aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtney@LunarG.com>2015-10-05 14:41:34 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-10-08 16:55:33 -0600
commit3e077bf28ce67da08250a9a061ad14b38fbf47ec (patch)
treeaea5654df04124213cdc5fdebce8e2141f6f05e6
parent7d8342c6d9550e2d4d9b47dbb446872611ea1153 (diff)
downloadusermoji-3e077bf28ce67da08250a9a061ad14b38fbf47ec.tar.xz
layers: Add support for Windows DEBUG_OUTPUT logging
-rw-r--r--include/vk_layer.h3
-rwxr-xr-xlayers/vk_layer_config.cpp4
-rw-r--r--layers/vk_layer_logging.h25
3 files changed, 31 insertions, 1 deletions
diff --git a/include/vk_layer.h b/include/vk_layer.h
index 82b66ffc..c41f2ebc 100644
--- a/include/vk_layer.h
+++ b/include/vk_layer.h
@@ -203,7 +203,8 @@ typedef enum VkLayerDbgAction_
VK_DBG_LAYER_ACTION_IGNORE = 0x0,
VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
- VK_DBG_LAYER_ACTION_BREAK = 0x4
+ VK_DBG_LAYER_ACTION_BREAK = 0x4,
+ VK_DBG_LAYER_ACTION_DEBUG_OUTPUT = 0x8,
} VkLayerDbgAction;
// ------------------------------------------------------------------------------------------------
diff --git a/layers/vk_layer_config.cpp b/layers/vk_layer_config.cpp
index 66254c74..1d8bde27 100755
--- a/layers/vk_layer_config.cpp
+++ b/layers/vk_layer_config.cpp
@@ -59,6 +59,10 @@ static VkLayerDbgAction stringToDbgAction(const char *_enum)
return VK_DBG_LAYER_ACTION_IGNORE;
else if (!strcmp(_enum, "VK_DBG_LAYER_ACTION_LOG_MSG"))
return VK_DBG_LAYER_ACTION_LOG_MSG;
+#ifdef WIN32
+ else if (!strcmp(_enum, "VK_DBG_LAYER_ACTION_DEBUG_OUTPUT"))
+ return VK_DBG_LAYER_ACTION_DEBUG_OUTPUT;
+#endif
else if (!strcmp(_enum, "VK_DBG_LAYER_ACTION_BREAK"))
return VK_DBG_LAYER_ACTION_BREAK;
return (VkLayerDbgAction) 0;
diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h
index c7ac17e6..171861da 100644
--- a/layers/vk_layer_logging.h
+++ b/layers/vk_layer_logging.h
@@ -299,4 +299,29 @@ static inline VkBool32 VKAPI log_callback(
return false;
}
+
+static inline VkBool32 VKAPI win32_debug_output_msg(
+ VkFlags msgFlags,
+ VkDbgObjectType objType,
+ uint64_t srcObject,
+ size_t location,
+ int32_t msgCode,
+ const char* pLayerPrefix,
+ const char* pMsg,
+ void* pUserData)
+{
+#ifdef WIN32
+ char msg_flags[30];
+ char buf[2048];
+
+ print_msg_flags(msgFlags, msg_flags);
+ _snprintf(buf, sizeof(buf)-1, "%s (%s): object: 0x%" PRIxLEAST64 " type: %d location: %zu msgCode: %d: %s\n",
+ pLayerPrefix, msg_flags, srcObject, objType, location, msgCode, pMsg);
+
+ OutputDebugString(buf);
+#endif
+
+ return false;
+}
+
#endif // LAYER_LOGGING_H