Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
This repository was archived by the owner on Jun 18, 2021. It is now read-only.

New surface runtime panic #224

@Roba1993

Description

@Roba1993

Hi guys,

I don't know if this is a real bug or just missing documentation, but I get an runtime panic when I run the following code:

        device.create_swap_chain(
            &wgpu::Surface::create(window),
            &wgpu::SwapChainDescriptor {
                usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
                format: wgpu::TextureFormat::Bgra8UnormSrgb,
                width: size.width,
                height: size.height,
                present_mode: wgpu::PresentMode::Vsync,
            },
        );

The problem here is that when I resize the window and I create a new swap_chain, I also create a new surface. This leads directly to the crash in runtime. When I not create a new surface and just use the inital one instead the crash is not happening.

Here is the backtrace:

     Running `target\debug\shoox.exe`
thread 'main' panicked at 'internal error: entered unreachable code: Unexpected result - driver bug? Err(ERROR_VALIDATION_FAILED_EXT)', C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-vulkan-0.4.2\src\device.rs:2108:18
stack backtrace:
   0: core::fmt::write
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libcore\fmt\mod.rs:1052
   1: std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\io\mod.rs:1426
   2: std::sys_common::backtrace::_print
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\sys_common\backtrace.rs:62
   3: std::sys_common::backtrace::print
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\sys_common\backtrace.rs:49
   4: std::panicking::default_hook::{{closure}}
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:204
   5: std::panicking::default_hook
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:224
   6: std::panicking::rust_panic_with_hook
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:472
   7: std::panicking::begin_panic_handler
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:380
   8: std::panicking::begin_panic_fmt
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:334
   9: gfx_backend_vulkan::device::{{impl}}::create_swapchain
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-vulkan-0.4.2\src\device.rs:2108
  10: gfx_backend_vulkan::window::{{impl}}::configure_swapchain
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-vulkan-0.4.2\src\window.rs:448
  11: wgpu_native::device::device_create_swap_chain<gfx_backend_vulkan::Backend>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-native-0.4.3\src\device.rs:2091
  12: wgpu_native::device::wgpu_device_create_swap_chain
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-native-0.4.3\src\device.rs:2125
  13: wgpu::Device::create_swap_chain
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-0.4.0\src\lib.rs:834
  14: shoox::render::Render::create_swapchain
             at .\src\render.rs:136
  15: shoox::render::Render::resize
             at .\src\render.rs:59
  16: shoox::render::{{impl}}::run
             at .\src\render.rs:18
  17: shred::system::{{impl}}::run_now<shoox::render::Render>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\shred-0.10.2\src\system.rs:140
  18: shred::dispatch::dispatcher::Dispatcher::dispatch_thread_local
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\shred-0.10.2\src\dispatch\dispatcher.rs:113
  19: shoox::main::{{closure}}
             at .\src\main.rs:55
  20: winit::platform_impl::platform::event_loop::{{impl}}::run_return::{{closure}}<(),closure-0>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop.rs:204
  21: alloc::boxed::{{impl}}::call_mut<(winit::event::Event<()>, mut winit::event_loop::ControlFlow*),FnMut<(winit::event::Event<()>, mut winit::event_loop::ControlFlow*)>>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\src\liballoc\boxed.rs:1022
  22: winit::platform_impl::platform::event_loop::runner::{{impl}}::call_event_handler::{{closure}}<()>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop\runner.rs:467
  23: std::panic::{{impl}}::call_once<(),closure-0>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\src\libstd\panic.rs:318
  24: std::panicking::try::do_call<std::panic::AssertUnwindSafe<closure-0>,()>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\src\libstd\panicking.rs:305
  25: panic_unwind::__rust_maybe_catch_panic
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libpanic_unwind\lib.rs:86
  26: std::panicking::try<(),std::panic::AssertUnwindSafe<closure-0>>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\src\libstd\panicking.rs:281
  27: std::panic::catch_unwind<std::panic::AssertUnwindSafe<closure-0>,()>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\src\libstd\panic.rs:394
  28: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<()>::call_event_handler<()>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop\runner.rs:465
  29: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<()>::process_event<()>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop\runner.rs:371
  30: winit::platform_impl::platform::event_loop::runner::ELRShared<()>::send_event_unbuffered<()>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop\runner.rs:121
  31: winit::platform_impl::platform::event_loop::runner::ELRShared<()>::send_event<()>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop\runner.rs:106
  32: winit::platform_impl::platform::event_loop::SubclassInput<()>::send_event<()>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop.rs:102
  33: winit::platform_impl::platform::event_loop::public_window_callback<()>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop.rs:686
  34: DefSubclassProc
  35: DefSubclassProc
  36: AddClipboardFormatListener
  37: CallWindowProcW
  38: CallWindowProcW
  39: glDebugEntry
  40: AddClipboardFormatListener
  41: CallWindowProcW
  42: CallWindowProcW
  43: IsRectEmpty
  44: KiUserCallbackDispatcher
  45: GetSystemMetrics
  46: IsThemeActive
  47: OpenThemeData
  48: OpenThemeData
  49: GetSystemMetrics
  50: winit::platform_impl::platform::event_loop::public_window_callback<()>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop.rs:832
  51: DefSubclassProc
  52: DefSubclassProc
  53: AddClipboardFormatListener
  54: CallWindowProcW
  55: CallWindowProcW
  56: glDebugEntry
  57: AddClipboardFormatListener
  58: CallWindowProcW
  59: CallWindowProcW
  60: IsRectEmpty
  61: KiUserCallbackDispatcher
  62: GetSystemMetrics
  63: IsThemeActive
  64: OpenThemeData
  65: OpenThemeData
  66: GetSystemMetrics
  67: AddClipboardFormatListener
  68: CallWindowProcW
  69: CallWindowProcW
  70: Ordinal234
  71: DefSubclassProc
  72: DefSubclassProc
  73: winit::platform_impl::platform::event_loop::public_window_callback<()>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop.rs:660
  74: DefSubclassProc
  75: DefSubclassProc
  76: AddClipboardFormatListener
  77: CallWindowProcW
  78: CallWindowProcW
  79: glDebugEntry
  80: AddClipboardFormatListener
  81: CallWindowProcW
  82: DispatchMessageW
  83: DispatchMessageW
  84: winit::platform_impl::platform::event_loop::EventLoop<()>::run_return<(),closure-0>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop.rs:234
  85: winit::platform_impl::platform::event_loop::EventLoop<()>::run<(),closure-0>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\platform_impl\windows\event_loop.rs:189
  86: winit::event_loop::EventLoop<()>::run<(),closure-0>
             at C:\Users\Roba\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.22.0\src\event_loop.rs:148
  87: shoox::main
             at .\src\main.rs:28
  88: std::rt::lang_start::{{closure}}<()>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\src\libstd\rt.rs:67
  89: std::rt::lang_start_internal::{{closure}}::{{closure}}
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\rt.rs:52
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\shoox.exe` (exit code: 101)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions