]> git.tdb.fi Git - libs/gui.git/commitdiff
Automatically break into debugger on Vulkan errors
authorMikko Rasa <tdb@tdb.fi>
Wed, 16 Mar 2022 10:13:48 +0000 (12:13 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 16 Mar 2022 10:13:48 +0000 (12:13 +0200)
source/graphics/vkxlib/vulkancontext.cpp

index 3b5476b123119e98c5861bb04bf2f0125ab0281e..ccd9a1eed7f73f002d8a2d81e7c489b2a448e062 100644 (file)
@@ -3,6 +3,7 @@
 #define VK_USE_PLATFORM_XLIB_KHR
 #include <vulkan/vulkan.h>
 #include <msp/core/application.h>
+#include <msp/debug/debugapi.h>
 #include <msp/io/print.h>
 #include "display_private.h"
 #include "vulkancontext.h"
@@ -254,9 +255,11 @@ VulkanContext::Private::Private():
        debug_report_callback(0)
 { }
 
-VkBool32 VulkanContext::Private::debug_report_func(VkDebugReportFlagsEXT, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *, const char *message, void *)
+VkBool32 VulkanContext::Private::debug_report_func(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *, const char *message, void *)
 {
        IO::print(IO::cerr, "%s\n", message);
+       if((flags&VK_DEBUG_REPORT_ERROR_BIT_EXT) && Debug::check_debugger()==Debug::GDB)
+               Debug::debug_break();
        return VK_FALSE;
 }