Skip to content

Commit

Permalink
Merge #3565
Browse files Browse the repository at this point in the history
3565: [vk] don't spew anything on panic r=kvark a=kvark

Fixes #3386


Co-authored-by: Dzmitry Malyshau <[email protected]>
  • Loading branch information
bors[bot] and kvark authored Jan 5, 2021
2 parents fc199ca + 5c11954 commit 0de7534
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/backend/vulkan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ use std::{
ffi::{CStr, CString},
fmt, mem, slice,
sync::Arc,
thread,
};

#[cfg(feature = "use-rtld-next")]
Expand Down Expand Up @@ -196,6 +197,9 @@ unsafe extern "system" fn debug_utils_messenger_callback(
p_callback_data: *const vk::DebugUtilsMessengerCallbackDataEXT,
_user_data: *mut std::os::raw::c_void,
) -> vk::Bool32 {
if thread::panicking() {
return vk::FALSE;
}
let callback_data = *p_callback_data;

let message_severity = match message_severity {
Expand Down Expand Up @@ -279,6 +283,10 @@ unsafe extern "system" fn debug_report_callback(
description: *const std::os::raw::c_char,
_user_data: *mut std::os::raw::c_void,
) -> vk::Bool32 {
if thread::panicking() {
return vk::FALSE;
}

let level = match type_ {
vk::DebugReportFlagsEXT::ERROR => log::Level::Error,
vk::DebugReportFlagsEXT::WARNING => log::Level::Warn,
Expand Down

0 comments on commit 0de7534

Please sign in to comment.