Wgpu: Fix Error Message When No Windowing Backend Found

Created on 25 May 2020  Â·  4Comments  Â·  Source: gfx-rs/wgpu

Hello,

Got this error when running example:

➜  wgpu-rs git:(master) RUST_BACKTRACE=1 cargo run --example cube
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
     Running `target/debug/examples/cube`
[2020-05-25T08:18:10Z ERROR gfx_backend_vulkan] [loader] setupLoaderTermPhysDevs:  Failed to detect any valid GPUs in the current config
[2020-05-25T08:18:10Z ERROR gfx_backend_vulkan] [loader] vkEnumeratePhysicalDevices: Failed in dispatch call used to determine number of available GPUs
[2020-05-25T08:18:10Z ERROR gfx_backend_vulkan] [loader] setupLoaderTermPhysDevs:  Failed to detect any valid GPUs in the current config
[2020-05-25T08:18:10Z ERROR gfx_backend_vulkan] [loader] setupLoaderTrampPhysDevs:  Failed during dispatch call of 'vkEnumeratePhysicalDevices' to lower layers or loader.
[2020-05-25T08:18:10Z ERROR gfx_backend_vulkan] Could not enumerate physical devices! Initialization of a object has failed
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', examples/cube/../framework.rs:62:19
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1063
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:470
  11: rust_begin_unwind
             at src/libstd/panicking.rs:378
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  13: core::panicking::panic
             at src/libcore/panicking.rs:52
  14: core::option::Option<T>::unwrap
             at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libcore/macros/mod.rs:10
  15: cube::framework::run_async::{{closure}}
             at examples/cube/../framework.rs:62
  16: <std::future::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libstd/future.rs:44
  17: futures_executor::local_pool::block_on::{{closure}}
             at /home/bastien/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.5/src/local_pool.rs:317
  18: futures_executor::local_pool::run_executor::{{closure}}
             at /home/bastien/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.5/src/local_pool.rs:87
  19: std::thread::local::LocalKey<T>::try_with
             at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libstd/thread/local.rs:262
  20: std::thread::local::LocalKey<T>::with
             at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libstd/thread/local.rs:239
  21: futures_executor::local_pool::run_executor
             at /home/bastien/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.5/src/local_pool.rs:83
  22: futures_executor::local_pool::block_on
             at /home/bastien/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.5/src/local_pool.rs:317
  23: cube::framework::run
             at examples/cube/../framework.rs:198
  24: cube::main
             at examples/cube/main.rs:361
  25: std::rt::lang_start::{{closure}}
             at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libstd/rt.rs:67
  26: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  27: std::panicking::try::do_call
             at src/libstd/panicking.rs:303
  28: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:86
  29: std::panicking::try
             at src/libstd/panicking.rs:281
  30: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  31: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  32: std::rt::lang_start
             at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libstd/rt.rs:67
  33: main
  34: __libc_start_main
  35: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
  • Linux PC-Fixe-01 4.9.0-12-amd64 gfx-rs/wgpu-rs#1 SMP Debian 4.9.210-1 (2020-01-20) x86_64 GNU/Linux
  • Cedar [Radeon HD 5000/6000/7350/8350 Series]
➜  iced git:(master) ✗ sudo find /dev -group video
/dev/fb0
/dev/dri/card0
/dev/dri/renderD128
/dev/dri/controlD64
➜  iced git:(master) ✗ glxinfo | grep -i vendor
server glx vendor string: SGI
client glx vendor string: Mesa Project and SGI
    Vendor: X.Org (0x1002)
OpenGL vendor string: X.Org

Anything can i do ?

validation enhancement

Most helpful comment

Did you install vulkan-utils (ie via sudo apt install vulkan-utils)? I found this was necessary, and isn't AFAIK documented anywhere.

All 4 comments

It doesn't look like your platform supports any APIs that we can use. I.e. "Failed to detect any valid GPUs in the current config" comes from the Vulkan loader, which is a part of the Vulkan SDK in your system. Therefore, you are essentially blocked on https://github.com/gfx-rs/wgpu/issues/450

Did you install vulkan-utils (ie via sudo apt install vulkan-utils)? I found this was necessary, and isn't AFAIK documented anywhere.

Not quite the same, but I've gotten a similar error after upgrading to wgpu 0.6. I've been using this to enable xcb support (from https://github.com/gfx-rs/wgpu/pull/351):

[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
gfx-backend-vulkan = { version = "^ 0.5", features = ["xcb"] }

Of course, having forgotten to update that in tandem, I had two versions of gfx-hal simultaneously, with the important one missing xcb support.

That left me with the following, rather uninformative panic:

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-core-0.6.0/src/hub.rs:746:33

In hindsight, version = "*" is a much better idea here. But the error message could definitely be improved if support for the required windowing backend is missing.

Agreed, let's improve the error message there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ZKing1000 picture ZKing1000  Â·  23Comments

m4b picture m4b  Â·  14Comments

FlorianUekermann picture FlorianUekermann  Â·  18Comments

z2oh picture z2oh  Â·  13Comments

kvark picture kvark  Â·  15Comments