gfx-rs/gfx

Vulkan Panic: ERROR_INITIALIZATION_FAILED on NV

John-Nagle opened this issue · 1 comments

Short info header:

  • GFX version: 0.7.0
  • OS: Ubuntu 20.04 LTS.
  • GPU: NVidia 3070, driver 460.32.03

Panicked at 'internal error: entered unreachable code: Unexpected result - driver bug? Err(ERROR_INITIALIZATION_FAILED)', /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-vulkan-0.7.0/src/device.rs:1953:18

Looking at the code in device.rs, it looks like the Vulkan driver returned ERROR_INITIALIZATION_FAILED and the code in device.rs didn't have a match case for that, so it reached the default case and panicked.

Why the driver returned that status I do not know. There are recent reports on NVidia forums of games crashing with that error:

https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/428627/vulkan-errorinitializationfailed-on-win10-with-gtx/

So NVidia may have changed something that affects this.

This is from a program of mine using "rend3", which uses "gfx". It's happened twice, both times during window resizing. It's just loading a big scene into the GPU, which can then be explored. Visually, everything looks fine. My program, which is 100% safe Rust, is not doing much except refreshing the scene and responding to window events.

Backtraces follow:

00002 frames over 01.15s. Min: 558.37ms; Average: 576.98ms; 95%: 595.59ms; 99%: 595.59ms; Max: 595.59ms; StdDev: 18.61ms
00002 frames over 01.18s. Min: 588.25ms; Average: 589.56ms; 95%: 590.87ms; 99%: 590.87ms; Max: 590.87ms; StdDev: 01.31ms
thread '' panicked at 'internal error: entered unreachable code: Unexpected result - driver bug? Err(ERROR_INITIALIZATION_FAILED)', /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-vulkan-0.7.0/src/device.rs:1953:18
stack backtrace:
0: rust_begin_unwind
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
1: std::panicking::begin_panic_fmt
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:437:5
2: gfx_backend_vulkan::device::::create_swapchain
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-vulkan-0.7.0/src/device.rs:1953:18
3: <gfx_backend_vulkan::window::Surface as gfx_hal::window::PresentationSurface<gfx_backend_vulkan::Backend>>::configure_swapchain
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-vulkan-0.7.0/src/window.rs:367:35
4: wgpu_core::device::<impl wgpu_core::hub::Global>::device_create_swap_chain
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-core-0.7.0/src/device/mod.rs:4180:13
5: <wgpu::backend::direct::Context as wgpu::Context>::device_create_swap_chain
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.0/src/backend/direct.rs:801:15
6: wgpu::Device::create_swap_chain
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.0/src/lib.rs:1623:17
7: rend3::renderer::util::create_swapchain
at /home/john/.cargo/git/checkouts/rend3-e03f89403de3386a/c51c19f/rend3/src/renderer/util.rs:10:5
8: rend3::renderer::resources::RendererGlobalResources::update::{{closure}}
at /home/john/.cargo/git/checkouts/rend3-e03f89403de3386a/c51c19f/rend3/src/renderer/resources.rs:81:39
9: core::option::Option::map
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/option.rs:453:29
10: rend3::renderer::resources::RendererGlobalResources::update
at /home/john/.cargo/git/checkouts/rend3-e03f89403de3386a/c51c19f/rend3/src/renderer/resources.rs:81:17
11: rend3::renderer::render::render_loop::{{closure}}
at /home/john/.cargo/git/checkouts/rend3-e03f89403de3386a/c51c19f/rend3/src/renderer/render.rs:390:13
12: <core::future::from_generator::GenFuture as core::future::future::Future>::poll
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/future/mod.rs:80:19
13: <tracing_futures::Instrumented as core::future::future::Future>::poll
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-futures-0.2.4/src/lib.rs:258:9
14: <std::panic::AssertUnwindSafe as core::future::future::Future>::poll
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panic.rs:339:9
15: <std::panic::AssertUnwindSafe as core::future::future::Future>::poll
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panic.rs:339:9
16: <switchyard::CatchUnwind as core::future::future::Future>::poll::{{closure}}
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/switchyard-0.1.1/src/lib.rs:179:42
17: <std::panic::AssertUnwindSafe as core::ops::function::FnOnce<()>>::call_once
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panic.rs:322:9
18: std::panicking::try::do_call
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:381:40
19: __rust_try
20: std::panicking::try
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:345:19
21: std::panic::catch_unwind
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panic.rs:396:14
22: <switchyard::CatchUnwind as core::future::future::Future>::poll
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/switchyard-0.1.1/src/lib.rs:179:9
23: switchyard::Switchyard::spawn_local::{{closure}}::{{closure}}
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/switchyard-0.1.1/src/lib.rs:502:32
24: <core::future::from_generator::GenFuture as core::future::future::Future>::poll
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/future/mod.rs:80:19
25: <core::pin::Pin

as core::future::future::Future>::poll
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/future/future.rs:119:9
26: switchyard::task::ThreadLocalTask::poll
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/switchyard-0.1.1/src/task.rs:270:26
27: switchyard::worker::body::{{closure}}
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/switchyard-0.1.1/src/worker.rs:132:34
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
thread 'main' panicked at 'Job panicked!', /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/switchyard-0.1.1/src/lib.rs:153:78
stack backtrace:
0: std::panicking::begin_panic
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:521:12
1: <switchyard::JoinHandle as core::future::future::Future>::poll::{{closure}}
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/switchyard-0.1.1/src/lib.rs:153:78
2: core::result::Result<T,E>::unwrap_or_else
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/result.rs:825:23
3: <switchyard::JoinHandle as core::future::future::Future>::poll
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/switchyard-0.1.1/src/lib.rs:153:53
4: pollster::block_on
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/pollster-0.2.1/src/lib.rs:131:15
5: slscenetester::displaystate::{{closure}}
at /home/john/projects/sl/SL-test-viewer/slscenetester/src/main.rs:496:13
6: winit::platform_impl::platform::sticky_exit_callback
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/mod.rs:736:5
7: winit::platform_impl::platform::x11::EventLoop::run_return
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/x11/mod.rs:320:21
8: winit::platform_impl::platform::x11::EventLoop::run
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/x11/mod.rs:398:9
9: winit::platform_impl::platform::EventLoop::run
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/mod.rs:652:56
10: winit::event_loop::EventLoop::run
at /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/event_loop.rs:154:9
11: slscenetester::displaystate
at /home/john/projects/sl/SL-test-viewer/slscenetester/src/main.rs:342:5
12: slscenetester::main
at /home/john/projects/sl/SL-test-viewer/slscenetester/src/main.rs:616:5
13: core::ops::function::FnOnce::call_once
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/ops/function.rs:227:5

kvark commented

Let's make the backend expect this error and turn it into a swapchain creation failure.