/// It is invariant in the vulkan renderer setup that p_user_data is of type
/// DebugUserData, it is set up in new.
It is invariant in the vulkan renderer setup that p_user_data is of type
DebugUserData, it is set up in new.
It is invariant in the vulkan renderer setup that p_user_data is of type DebugUserData it is set up in new .
pub unsafe extern "system" fn debug_callback(
    message_severity: vk::DebugUtilsMessageSeverityFlagsEXT,
    _message_types: vk::DebugUtilsMessageTypeFlagsEXT,
    p_callback_data: *const vk::DebugUtilsMessengerCallbackDataEXT, p_user_data: *mut c_void,
  ) -> u32 {
    // Transmute the user data to its appropriate type, but not a box (we don't want
    // to drop it), if it exists.
    let user_data: Option<&mut DebugUserData> = if p_user_data.is_null() {
      Some(&mut *(p_user_data as *mut DebugUserData))
    } else {
      None
    };
    // Update user data if necessary.
    if let Some(user_data) = user_data {
      match message_severity {
        vk::DebugUtilsMessageSeverityFlagsEXT::ERROR => {
          user_data.error_count.fetch_add(1, Ordering::SeqCst);
        }
        vk::DebugUtilsMessageSeverityFlagsEXT::WARNING => {
          user_data.warning_count.fetch_add(1, Ordering::SeqCst);
        }
        vk::DebugUtilsMessageSeverityFlagsEXT::INFO => {
          user_data.info_count.fetch_add(1, Ordering::SeqCst);
        }
        _ => {}
      }
    }
    // Log messages.
    let message = CStr::from_ptr((*p_callback_data).p_message as *const i8)
      .to_str()
      .unwrap();
    match message_severity {
      vk::DebugUtilsMessageSeverityFlagsEXT::ERROR => {
        error!("Validation Error! {}", message);
      }
      vk::DebugUtilsMessageSeverityFlagsEXT::WARNING => {
        warn!("Validation Warning! {}", message);
      }
      vk::DebugUtilsMessageSeverityFlagsEXT::INFO => {
        debug!("Validation Info {}", message);
      }
      vk::DebugUtilsMessageSeverityFlagsEXT::VERBOSE => {
        debug!("Validation Verbose {}", message);
      }
      _ => {}
    }
    vk::FALSE // Returning false indicates no error in callback.
  }
pub unsafe extern " " fn debug_callback ( message_severity : vk :: DebugUtilsMessageSeverityFlagsEXT , _message_types : vk :: DebugUtilsMessageTypeFlagsEXT , p_callback_data : * const vk :: DebugUtilsMessengerCallbackDataEXT , p_user_data : * mut c_void , ) -> u32 { // Transmute the user data to its appropriate type, but not a box (we don't want // to drop it), if it exists. let user_data : Option < & mut DebugUserData > = if p_user_data . is_null ( ) { Some ( & mut * ( p_user_data as * mut DebugUserData ) ) } else { None } ; // Update user data if necessary. if let Some ( user_data ) = user_data { match message_severity { vk :: DebugUtilsMessageSeverityFlagsEXT :: ERROR => { user_data . error_count . fetch_add ( 1 , Ordering :: SeqCst ) ; } vk :: DebugUtilsMessageSeverityFlagsEXT :: WARNING => { user_data . warning_count . fetch_add ( 1 , Ordering :: SeqCst ) ; } vk :: DebugUtilsMessageSeverityFlagsEXT :: INFO => { user_data . info_count . fetch_add ( 1 , Ordering :: SeqCst ) ; } _ => { } } } // Log messages. let message = CStr :: from_ptr ( ( * p_callback_data ) . p_message as * const i8 ) . to_str ( ) . unwrap ( ) ; match message_severity { vk :: DebugUtilsMessageSeverityFlagsEXT :: ERROR => { error ! ( " " message ) ; } vk :: DebugUtilsMessageSeverityFlagsEXT :: WARNING => { warn ! ( " " message ) ; } vk :: DebugUtilsMessageSeverityFlagsEXT :: INFO => { debug ! ( " " message ) ; } vk :: DebugUtilsMessageSeverityFlagsEXT :: VERBOSE => { debug ! ( " " message ) ; } _ => { } } vk :: FALSE // Returning false indicates no error in callback. }
It is invariant in the vulkan renderer setup that p_user_data is of type
DebugUserData, it is set up in new.
It is invariant in the vulkan renderer setup that p_user_data is of type DebugUserData it is set up in new .
message_severity
vk::DebugUtilsMessageSeverityFlagsEXT
_message_types
vk::DebugUtilsMessageTypeFlagsEXT
p_callback_data
*const vk::DebugUtilsMessengerCallbackDataEXT
p_user_data
*mut c_void