Skip to content

DX12 backend panics when window is resized #15077

@akimakinai

Description

@akimakinai

Bevy version

master

[Optional] Relevant system information

AdapterInfo { name: "NVIDIA GeForce RTX 3060 Ti", vendor: 4318, device: 9353, device_type: DiscreteGpu, driver: "32.0.15.5599", driver_info: "", backend: Dx12 }

What you did

Run any example with DX12 backend and resize the window.

What went wrong

Terminated with a panic.

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.80s
     Running `target\debug\examples\bloom_2d.exe`
2024-09-07T09:31:13.698140Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Pro", kernel: "22631", cpu: "11th Gen Intel(R) Core(TM) i7-11700F @ 2.50GHz", core_count: "8", memory: "15.8 GiB" }
2024-09-07T09:31:13.876694Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 3060 Ti", vendor: 4318, device: 9353, device_type: DiscreteGpu, driver: "32.0.15.5599", driver_info: "", backend: Dx12 }
2024-09-07T09:31:14.521009Z  INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
2024-09-07T09:31:15.876281Z ERROR wgpu_hal::dx12: ResizeBuffers failed: 0x887A0001    
2024-09-07T09:31:15.876492Z ERROR wgpu_core::device::global: surface configuration failed: window is in use
thread 'Compute Task Pool (2)' panicked at E:\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\backend\wgpu_core.rs:786:18:
Error in Surface::configure: Validation Error

Caused by:
  Invalid surface

stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\panicking.rs:665
   1: core::panicking::panic_fmt
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\core\src\panicking.rs:74
   2: wgpu::backend::wgpu_core::ContextWgpuCore::handle_error_fatal<enum2$<wgpu_core::present::ConfigureSurfaceError> >
             at E:\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\backend\wgpu_core.rs:317
   3: wgpu::backend::wgpu_core::impl$7::surface_configure
             at E:\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\backend\wgpu_core.rs:786
   4: wgpu::context::impl$5::surface_configure<wgpu::backend::wgpu_core::ContextWgpuCore>
             at E:\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\context.rs:2169
   5: wgpu::Surface::configure
             at E:\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\lib.rs:5658
   6: bevy_render::renderer::render_device::RenderDevice::configure_surface
             at .\crates\bevy_render\src\renderer\render_device.rs:197
   7: bevy_render::view::window::create_surfaces
             at .\crates\bevy_render\src\view\window\mod.rs:437
   8: core::ops::function::FnMut::call_mut<void (*)(bevy_ecs::change_detection::Res<bevy_render::view::window::ExtractedWindows>,bevy_ecs::change_detection::ResMut<bevy_render::view::window::WindowSurfaces>,bevy_ecs::change_detection::Res<bevy_render::renderer::
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\core\src\ops\function.rs:166
   9: core::ops::function::impls::impl$3::call_mut<tuple$<bevy_ecs::change_detection::Res<bevy_render::view::window::ExtractedWindows>,bevy_ecs::change_detection::ResMut<bevy_render::view::window::WindowSurfaces>,bevy_ecs::change_detection::Res<bevy_render::rend
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\core\src\ops\function.rs:294
  10: bevy_ecs::system::function_system::impl$37::run::call_inner<tuple$<>,bevy_ecs::change_detection::Res<bevy_render::view::window::ExtractedWindows>,bevy_ecs::change_detection::ResMut<bevy_render::view::window::WindowSurfaces>,bevy_ecs::change_detection::Res<
             at .\crates\bevy_ecs\src\system\function_system.rs:798
  11: bevy_ecs::system::function_system::impl$37::run<tuple$<>,void (*)(bevy_ecs::change_detection::Res<bevy_render::view::window::ExtractedWindows>,bevy_ecs::change_detection::ResMut<bevy_render::view::window::WindowSurfaces>,bevy_ecs::change_detection::Res<bev
             at .\crates\bevy_ecs\src\system\function_system.rs:801
  12: bevy_ecs::system::function_system::impl$7::run_unsafe<void (*)(bevy_ecs::change_detection::Res<bevy_render::view::window::ExtractedWindows>,bevy_ecs::change_detection::ResMut<bevy_render::view::window::WindowSurfaces>,bevy_ecs::change_detection::Res<bevy_r
             at .\crates\bevy_ecs\src\system\function_system.rs:622

Additional information

wgpu examples (v22.1.0 and master) don't crash when resizing window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorO-DX12Specific to the DX12 render APIS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions