Skip to content

Commit

Permalink
wgpu_core: Add logging to Instance::new.
Browse files Browse the repository at this point in the history
For each backend `blah`, log::debug whether we were able to populate
`Instance::blah`.
  • Loading branch information
jimblandy committed Sep 4, 2023
1 parent 54a7f0e commit 2b201fa
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion wgpu-core/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,22 @@ impl Instance {
dx12_shader_compiler: instance_desc.dx12_shader_compiler.clone(),
gles_minor_version: instance_desc.gles_minor_version,
};
unsafe { hal::Instance::init(&hal_desc).ok() }
match unsafe { hal::Instance::init(&hal_desc) } {
Ok(instance) => {
log::debug!("Instance::new: created {:?} backend", A::VARIANT);
Some(instance)
}
Err(err) => {
log::debug!(
"Instance::new: failed to create {:?} backend: {:?}",
A::VARIANT,
err
);
None
}
}
} else {
log::debug!("Instance::new: backend {:?} not requested", A::VARIANT);
None
}
}
Expand Down

0 comments on commit 2b201fa

Please sign in to comment.