Intercepting validation layer messages
In some circumstances, validation errors are so plentiful that it becomes impossible to know where the cause of the problem is. For that reason, it would be ideal to interrupt the execution of your program as soon as an error is detected, especially when debugging your application. The debug utility extension (VK_EXT_debug_utils
) allows you to install a callback function that is invoked whenever an error is detected.
In this recipe, you will learn how to install a debug callback to intercept error messages emitted by the validation layer and make your debugging sessions more productive.
Getting ready
To be able to set a callback whenever an error occurs, you need to enable the VK_EXT_debug_utils
extension. Please refer to the Getting ready section of the Naming Vulkan objects for easier debugging recipe to learn how to enable this extension when creating a Vulkan instance.
How to do it…
Before installing and using the callback...