mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-22 23:05:43 +00:00
Minor fix and doc improvement to debug callbacks
This commit is contained in:
parent
27e19de9c4
commit
76622f6376
@ -7,11 +7,12 @@
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
//! Debug callback called by validation layers.
|
||||
//! Debug callback called by intermediate layers or by the driver.
|
||||
//!
|
||||
//! When working on an application, it is recommended to register a debug callback. This callback
|
||||
//! will be called by validation layers whenever necessary to warn you about invalid API usages
|
||||
//! or performance problems.
|
||||
//! When working on an application, it is recommended to register a debug callback. 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
|
||||
@ -29,6 +30,8 @@
|
||||
//! }).ok();
|
||||
//! ```
|
||||
//!
|
||||
//! The type of `msg` in the callback is [`Message`](struct.Message.html).
|
||||
//!
|
||||
//! 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 `DebugCallback`'s constructor in a
|
||||
//! variable, it will be immediately destroyed and your callback will not work.
|
||||
@ -68,7 +71,7 @@ impl DebugCallback {
|
||||
/// Panics generated by calling `user_callback` are ignored.
|
||||
pub fn new<F>(instance: &Arc<Instance>, messages: MessageTypes, user_callback: F)
|
||||
-> Result<DebugCallback, DebugCallbackCreationError>
|
||||
where F: Fn(&Message) + 'static + panic::RefUnwindSafe
|
||||
where F: Fn(&Message) + 'static + Send + panic::RefUnwindSafe
|
||||
{
|
||||
if !instance.loaded_extensions().ext_debug_report {
|
||||
return Err(DebugCallbackCreationError::MissingExtension);
|
||||
@ -156,7 +159,7 @@ impl DebugCallback {
|
||||
#[inline]
|
||||
pub fn errors_and_warnings<F>(instance: &Arc<Instance>, user_callback: F)
|
||||
-> Result<DebugCallback, DebugCallbackCreationError>
|
||||
where F: Fn(&Message) + 'static + panic::RefUnwindSafe
|
||||
where F: Fn(&Message) + Send + 'static + panic::RefUnwindSafe
|
||||
{
|
||||
DebugCallback::new(instance, MessageTypes::errors_and_warnings(), user_callback)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user