Catch panic from Instance::preinitialized
This commit is contained in:
parent
058cf4c149
commit
8b355baede
1 changed files with 20 additions and 6 deletions
|
@ -165,12 +165,26 @@ pub(crate) extern "system" fn create_instance(
|
|||
// DXVK workaround, it creates the instance twice with different properties
|
||||
if ext_names.contains(&VkString::new("VK_KHR_surface")) {
|
||||
unsafe {
|
||||
let ins = match Instance::preinitialized(
|
||||
*instance,
|
||||
proc_addr,
|
||||
&ext_names,
|
||||
(*(*create_info).pApplicationInfo).apiVersion,
|
||||
) {
|
||||
let panic_result =
|
||||
match std::panic::catch_unwind(|| -> anyhow::Result<std::sync::Arc<Instance>> {
|
||||
Instance::preinitialized(
|
||||
*instance,
|
||||
proc_addr,
|
||||
&ext_names,
|
||||
(*(*create_info).pApplicationInfo).apiVersion,
|
||||
)
|
||||
}) {
|
||||
Ok(panic_ok) => panic_ok,
|
||||
Err(err) => {
|
||||
write_log!(format!(
|
||||
"catched a panic from Instance::preinitialized: {:?}",
|
||||
err
|
||||
));
|
||||
return VK_ERROR_INITIALIZATION_FAILED;
|
||||
}
|
||||
};
|
||||
|
||||
let ins = match panic_result {
|
||||
Ok(ins) => ins,
|
||||
Err(err) => {
|
||||
write_log!(format!("-> local instance creation failed: {:?}", err));
|
||||
|
|
Loading…
Reference in a new issue