diff options
| author | Courtney Goeltzenleuchter <courtneygo@google.com> | 2015-12-01 14:11:38 -0700 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2015-12-17 11:20:07 -0700 |
| commit | af1951c9e575379ff0b68dc3586e38dd64012d3a (patch) | |
| tree | faf6e41c66eb161ae2bd2f63cb8c553581a19253 | |
| parent | 92fb5f46d48234276f40cb1c4c22f24dbf391009 (diff) | |
| download | usermoji-af1951c9e575379ff0b68dc3586e38dd64012d3a.tar.xz | |
cube: Update debug report support
Add break callback (it's been removed from the extension).
Grab function pointer for DebugReportMessageLUNARG.
| -rw-r--r-- | demos/cube.c | 29 |
1 files 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 <string.h> #include <stdbool.h> #include <assert.h> +#include <signal.h> #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; |
