bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.26k stars 3.58k forks source link

Compute Task Pool (7)' panicked at crates\bevy_render\src\view\window\mod.rs:365:21: Couldn't get swap chain texture, operation unrecoverable: A timeout was encountered while trying to acquire the next frame #13150

Open kuolas opened 6 months ago

kuolas commented 6 months ago

Bevy version

Bevy 0.13.2 dac66e8

System information

`AdapterInfo { name: "Radeon (TM) Pro WX 9100", vendor: 4098, device: 26721, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "24.3.1 (AMD proprietary shader compiler)", backend: Vulkan }`

Additional information

`PS C:\Users\alvarok\Documents\GitHub\bevy> $env:RUST_BACKTRACE=1; cargo run --example breakout
    Finished dev [unoptimized + debuginfo] target(s) in 0.22s
     Running `target\debug\examples\breakout.exe`
2024-04-30T19:31:59.429536Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Pro", kernel: "22631", cpu: "AMD Ryzen 9 7900X 12-Core Processor", core_count: "12", memory: "31.2 GiB" }
2024-04-30T19:31:59.434310Z  INFO bevy_winit::system: Creating new window "App" (Entity { index: 0, generation: 1 })
2024-04-30T19:31:59.646336Z  INFO bevy_render::renderer: AdapterInfo { name: "Radeon (TM) Pro WX 9100", vendor: 4098, device: 26721, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "24.3.1 (AMD proprietary shader compiler)", backend: Vulkan }
2024-04-30T19:31:59.923003Z  INFO breakout::stepping: Bevy was compiled without stepping support. Run with `--features=bevy_debug_stepping` to enable stepping.
thread 'Compute Task Pool (7)' panicked at crates\bevy_render\src\view\window\mod.rs:365:21:
Couldn't get swap chain texture, operation unrecoverable: A timeout was encountered while trying to acquire the next frame
stack backtrace:
error: process didn't exit successfully: `target\debug\examples\breakout.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)`

What you did

Bevy breakout example does not run on my machine.

kristoff3r commented 6 months ago

It looks a bit like the issue handled here: https://github.com/bevyengine/bevy/blob/78bf48b87477a49785359f60172525d549fc0e26/crates/bevy_render/src/view/window/mod.rs#L303

Except it's on Windows. I have made a branch on top of v0.13.2 without that cfg line here, can you try and see if that fixes it?

bevy = { git = "https://github.com/kristoff3r/bevy.git", branch = "timeout" }
kuolas commented 6 months ago

It gives me this error

error[E0425]: cannot find value `render_instance` in this scope
   --> crates\bevy_render\src\view\window\mod.rs:300:13
    |
300 |             render_instance
    |             ^^^^^^^^^^^^^^^ help: a tuple struct with a similar name exists: `RenderInstance`
    |
   ::: crates\bevy_render\src\renderer\mod.rs:119:1
    |
119 | pub struct RenderInstance(pub Arc<Instance>);
    | --------------------------------------------- similarly named tuple struct `RenderInstance` defined here

For more information about this error, try `rustc --explain E0425`.
error: could not compile `bevy_render` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
kuolas commented 6 months ago

Line 255 says #[cfg(target_os = "linux")] render_instance: Res<RenderInstance>,

Removing #[cfg(target_os = "linux")] and running yields

PS C:\Users\alvarok\Documents\GitHub\bevy> cargo run --example breakout
warning: unused variable: `may_erroneously_timeout`
   --> crates\bevy_render\src\view\window\mod.rs:299:13
    |
299 |         let may_erroneously_timeout = || {
    |             ^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_may_erroneously_timeout`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: `bevy_render` (lib) generated 1 warning (run `cargo fix --lib -p bevy_render` to apply 1 suggestion)
    Finished dev [unoptimized + debuginfo] target(s) in 3.69s
     Running `target\debug\examples\breakout.exe`
2024-05-02T22:25:15.421500Z  INFO bevy_winit::system: Creating new window "App" (0v1)
2024-05-02T22:25:15.623565Z  INFO bevy_render::renderer: AdapterInfo { name: "Radeon (TM) Pro WX 9100", vendor: 4098, device: 26721, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "24.3.1 (AMD proprietary shader compiler)", backend: Vulkan }
2024-05-02T22:25:16.064344Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Pro", kernel: "22631", cpu: "AMD Ryzen 9 7900X 12-Core Processor", core_count: "12", memory: "31.2 GiB" }
thread 'Compute Task Pool (8)' panicked at crates\bevy_render\src\view\window\mod.rs:361:21:
Couldn't get swap chain texture, operation unrecoverable: A timeout was encountered while trying to acquire the next frame
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::prepare_windows`!
thread 'Compute Task Pool (8)' panicked at crates\bevy_render\src\pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError
error: process didn't exit successfully: `target\debug\examples\breakout.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

I am running AMD PRO edition drivers

Driver Version
23.19.12-240220a-400788C-AMD-Software-PRO-Edition
Vulkan™ Driver Version
2.0.279
Vulkan™ API Version
1.3.260
GPU1 - Radeon (TM) Pro WX 9100 - Primary/Discrete
VRAM1 - 16368 MB - HBM2 945 MHz
Driver Version - 23.19.12-240220a-400788C-AMD-Software-PRO-Edition
AMD Windows Driver Version - 31.0.21912.14
Direct3D API Version - 12.1
Vulkan™ API Version - 1.3.260
OpenCL™ API Version - 2.0
OpenGL® API Version - 4.6
Direct3D® Driver Version - 8.14.10.0251
Vulkan™ Driver Version - 2.0.279
OpenCL® Driver Version - 31.0.24027.1012
OpenGL® Driver Version - 24.02.230729_569461f
2D Driver Version - 8.1.1.1634
2D Driver File Path - /REGISTRY/MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4d36e968-e325-11ce-bfc1-08002be10318}/0000
UI Version - 2024.0307.1232.2016
AMD Audio Driver Version - 10.0.1.30
Driver Provider - Advanced Micro Devices, Inc.
Windows Edition - Windows 11 Professional (64 bit)
Windows Version - 23H2
kristoff3r commented 6 months ago

Ah, there's a bunch more cfg, specifically you also need to remove this one to check: https://github.com/kristoff3r/bevy/blob/f162c28068fa733caa4d1cc3251ab4ca5fdf98f3/crates/bevy_render/src/view/window/mod.rs#L353

kuolas commented 6 months ago

Removing #[cfg(target_os = "linux")] on line 353 yields

Running `target\debug\examples\breakout.exe`
2024-05-03T19:27:44.490317Z  INFO bevy_winit::system: Creating new window "App" (0v1)
2024-05-03T19:27:44.712185Z  INFO bevy_render::renderer: AdapterInfo { name: "Radeon (TM) Pro WX 9100", vendor: 4098, device: 26721, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "24.3.1 (AMD proprietary shader compiler)", backend: Vulkan }
2024-05-03T19:27:45.162774Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Pro", kernel: "22631", cpu: "AMD Ryzen 9 7900X 12-Core Processor", core_count: "12", memory: "31.2 GiB" }
error: process didn't exit successfully: `target\debug\examples\breakout.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

At least is not swap chain problem or timeout.

kristoff3r commented 6 months ago

Yeah ok then I'm out of ideas. It seems like your graphics driver just dies. Do wgpu examples or stuff like vkCube work on your machine? What about other bevy examples, or older versions of bevy? Are other games having problems?

kuolas commented 6 months ago

I've installed AMD 3rd Party Drivers from https://www.amernimezone.com and it seems to work.

2024-05-03T23:31:01.183945Z ERROR log: ID3D12CommandQueue::ExecuteCommandLists: Using IDXGISwapChain::Present on Command List (0x0000023A446007C0:'Internal DXGI CommandList'): Resource state (0x586FEC40: D3D12_RESOURCE_STATE_RENDER_TARGET) of resource (0x0000023A44679B40:'Unnamed ID3D12Resource Object') (subresource: 0) is invalid for use as a PRESENT_SOURCE. Expected State Bits (all): 0x586FEC20: D3D12_RESOURCE_STATE_[COMMON|PRESENT], Actual State: 0x586FEC00: D3D12_RESOURCE_STATE_RENDER_TARGET, Missing State: 0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT]. [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]

Screenshot 2024-05-03 203059

kuolas commented 6 months ago

It works on main branch commit 99b4fb6

image

I will keep looking other drivers, and test wgpu, and open a wgpu issue if it's the case.

Thank you for all your help and time.

lufog commented 3 weeks ago

I didn't notice it before, since I always compiled with wayland feature. When launched via xwayland, the application crashes when minimized. There is a possibility that this is not a Bevy problem, but a NVK driver problem.

    Finished `dev` profile [optimized + debuginfo] target(s) in 0.46s
     Running `target/debug/top_down_character_controller`
2024-10-23T20:07:41.766140Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1660 (NVK TU116)", vendor: 4318, device: 8580, device_type: DiscreteGpu, driver: "NVK", driver_info: "Mesa 24.2.5-arch1.1", backend: Vulkan }
2024-10-23T20:07:42.000673Z  INFO bevy_winit::system: Creating new window "App" (Entity { index: 0, generation: 1 })
2024-10-23T20:07:42.001273Z  INFO winit::platform_impl::linux::x11::window: Guessed window scale factor: 1
thread 'Compute Task Pool (0)' panicked at /home/aleksey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.14.2/src/view/window/mod.rs:365:21:
Couldn't get swap chain texture, operation unrecoverable: A timeout was encountered while trying to acquire the next frame
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e92993dbb43f0a5d17fe56e2d82f90435d6521c8/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/e92993dbb43f0a5d17fe56e2d82f90435d6521c8/library/core/src/panicking.rs:74:14
   2: bevy_render::view::window::prepare_windows
             at /home/aleksey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.14.2/src/view/window/mod.rs:365:21
   3: core::ops::function::FnMut::call_mut
             at /home/aleksey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5
   4: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /home/aleksey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:13
   5: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1,F2,F3,F4,F5,F6,F7,F8) .> Out>>::run::call_inner
             at /home/aleksey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.14.2/src/system/function_system.rs:710:21
   6: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1,F2,F3,F4,F5,F6,F7,F8) .> Out>>::run
             at /home/aleksey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.14.2/src/system/function_system.rs:713:17
   7: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe
             at /home/aleksey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.14.2/src/system/function_system.rs:534:19
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `bevy_render::view::window::prepare_windows`!

Bevy 0.14.2 Arch Linux, kernel 6.11.5, NVK/Mesa 24.2.5