From af1951c9e575379ff0b68dc3586e38dd64012d3a Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Tue, 1 Dec 2015 14:11:38 -0700 Subject: cube: Update debug report support Add break callback (it's been removed from the extension). Grab function pointer for DebugReportMessageLUNARG. --- demos/cube.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/demos/cube.c b/demos/cube.c index 59e4fef7..277e53af 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -31,6 +31,7 @@ #include #include #include +#include #ifdef _WIN32 #pragma comment(linker, "/subsystem:windows") @@ -257,7 +258,7 @@ void dumpVec4(const char *note, vec4 vector) VkBool32 dbgFunc( VkFlags msgFlags, - VkDebugReportObjectTypeLUNARG objType, + VkDebugReportObjectTypeLUNARG objType, uint64_t srcObject, size_t location, int32_t msgCode, @@ -299,6 +300,25 @@ VkBool32 dbgFunc( return false; } +VkBool32 BreakCallback( + VkFlags msgFlags, + VkDebugReportObjectTypeLUNARG objType, + uint64_t srcObject, + size_t location, + int32_t msgCode, + const char* pLayerPrefix, + const char* pMsg, + const void* pUserData) +{ +#ifndef WIN32 + raise(SIGTRAP); +#else + DebugBreak(); +#endif + + return false; +} + typedef struct _SwapchainBuffers { VkImage image; VkCommandBuffer cmd; @@ -397,8 +417,8 @@ struct demo { bool use_break; PFN_vkCreateDebugReportCallbackLUNARG CreateDebugReportCallback; PFN_vkDestroyDebugReportCallbackLUNARG DestroyDebugReportCallback; - PFN_vkDebugReportCallbackLUNARG dbgBreakCallback; VkDebugReportCallbackLUNARG msg_callback; + PFN_vkDebugReportMessageLUNARG DebugReportMessage; uint32_t current_buffer; uint32_t queue_count; @@ -2325,6 +2345,11 @@ static void demo_init_vk(struct demo *demo) ERR_EXIT("GetProcAddr: Unable to find vkDestroyDebugReportCallbackLUNARG\n", "vkGetProcAddr Failure"); } + demo->DebugReportMessage = (PFN_vkDebugReportMessageLUNARG) vkGetInstanceProcAddr(demo->inst, "vkDebugReportMessageLUNARG"); + if (!demo->DebugReportMessage) { + ERR_EXIT("GetProcAddr: Unable to find vkDebugReportMessageLUNARG\n", + "vkGetProcAddr Failure"); + } PFN_vkDebugReportCallbackLUNARG callback; -- cgit v1.2.3