From dd582e224d97c984e9119b576daa03a5811e2750 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Mon, 4 Sep 2023 14:05:21 -0700 Subject: [PATCH] wgpu_core: Add logging to Instance::new. For each backend `blah`, log::debug/trace whether we were able to populate `Instance::blah`. --- wgpu-core/src/instance.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index ae1a395d85..0aee56ac6e 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -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 } }