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/trace whether we were able to
populate `Instance::blah`.
  • Loading branch information
jimblandy authored and bradwerth committed Sep 19, 2023
1 parent bbb3cd9 commit 7c47c49
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::trace!("Instance::new: backend {:?} not requested", A::VARIANT);
None
}
}
Expand Down

0 comments on commit 7c47c49

Please sign in to comment.