Module vulkano::instance::debug

source ·
Expand description

Debug messenger called by intermediate layers or by the driver.

When working on an application, it is recommended to register a debug messenger. For example if you enable the validation layers provided by the official Vulkan SDK, they will warn you about invalid API usages or performance problems by calling this callback. The callback can also be called by the driver or by whatever intermediate layer is activated.

Note that the vulkano library can also emit messages to warn you about performance issues. TODO: ^ that’s not the case yet, need to choose whether we keep this idea


use vulkano::instance::debug::{DebugUtilsMessenger, DebugUtilsMessengerCreateInfo};

let _callback = unsafe {
        DebugUtilsMessengerCreateInfo::user_callback(Arc::new(|msg| {
            println!("Debug callback: {:?}", msg.description);

The type of msg in the callback is Message.

Note that you must keep the _callback object alive for as long as you want your callback to be callable. If you don’t store the return value of DebugUtilsMessenger’s constructor in a variable, it will be immediately destroyed and your callback will not work.


A label to associate with a span of work in a queue.
Severity of message.
Type of message.
Registration of a callback called by validation layers.
Parameters to create a DebugUtilsMessenger.
A message received by the callback.


Error that can happen when creating a DebugUtilsMessenger.
Features of the validation layer to disable.
Features of the validation layer to enable.