Setting up Vulkan's debugging capabilities
Once we have created a Vulkan instance, we can start tracking all possible errors and warnings that may be produced by the validation layer. To do so, we should create a couple of callback functions and register them with the Vulkan instance. In this recipe, we will learn how to set up and use them.
How to do it...
There are two callback functions that catch the debug output from Vulkan: vulkanDebugCallback()
and vulkanDebugReportCallback()
. Let's get started:
- The first function,
vulkanDebugCallback()
prints all messages coming into the system console:static VKAPI_ATTR VkBool32 VKAPI_CALL vulkanDebugCallback( VkDebugUtilsMessageSeverityFlagBitsEXT Severity, VkDebugUtilsMessageTypeFlagsEXT Type, const VkDebugUtilsMessengerCallbackDataEXT* CallbackData, void* UserData) { printf("Validation layer: %s\n", CallbackData-...