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

Examples

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

let _callback = unsafe {
    DebugUtilsMessenger::new(
        instance,
        DebugUtilsMessengerCreateInfo::user_callback(
            DebugUtilsMessengerCallback::new(|message_severity, message_type, callback_data| {
                println!("Debug callback: {:?}", callback_data.message);
            }),
        ),
    ).ok()
};

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.

Structs

Enums