bevyengine / bevyengine/bevy

Parent device is lost

Open
#13,472 5 comments 0 reactions 0 assignees View on GitHub
A-Windowing C-Bug O-Windows
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version
```
bevy = "0.13.2"
```

## Relevant system information
- Rust verion: 1.78
- OS: Windows 11 23H2

```
AdapterInfo { name: "AMD Radeon RX 5600 XT", vendor: 4098, device: 29471, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "24.5.1 (AMD proprietary shader compiler)", backend: Vulkan }
```

## What you did
All what I've tried to do is set my app's primary window mode to fullscreen as follows:
```rs
impl Plugin for GameSetupPlugin {
fn build(&self, app: &mut App) {
app.add_systems(Update, toggle_fullscreen)
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
name: Some(String::from("cooktory")),
title: String::from("Cooktory"),
resolution: WindowResolution::new(600.0, 400.0),
present_mode: PresentMode::AutoVsync,
prevent_default_event_handling: false,
..Default::default()
}),
..Default::default()
}));
}
}

fn toggle_fullscreen(mut window: Query<&mut Window>, input: Res>) {
let mut window = window.single_mut();

if input.just_pressed(KeyCode::F11) {
match window.mode {
WindowMode::Fullscreen => window.mode = WindowMode::Windowed,
_ => window.mode = WindowMode::Fullscreen,
}
}
}
```

## What went wrong
I was simply expecting to have a fullscreen window but everytime I hit **F11** to do so the app crashes entirely spitting the following error:
```
thread 'Compute Task Pool (3)' panicked at C:\Users\tarik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.19.4\src\backend\wgpu_core.rs:724:18:
Error in Surface::configure: Validation Error

Caused by:
Parent device is lost

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::create_surfaces`!
thread 'Compute Task Pool (3)' panicked at C:\Users\tarik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.13.2\src\pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError
error: process didn't exit successfully: `target\debug\cooktory.exe` (exit code: 101)
```

## Additional information
I've tried to run the compiled debug binary on my laptop (hardware information are listed down below) and everything worked flawlessly.
```
2024-05-22T02:08:00.755257Z INFO bevy_winit::system: Creating new window "Cooktory" (0v1)
2024-05-22T02:08:00.972624Z INFO bevy_render::renderer: AdapterInfo { name: "Intel(R) UHD Graphics", vendor: 32902, device: 39745, device_type: IntegratedGpu, driver: "Intel Corporation", driver_info: "Intel driver", backend: Vulkan }
2024-05-22T02:08:01.726417Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Pro", kernel: "22631", cpu: "Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz", core_count: "4", memory: "7.6 GiB" }
```
I thought the issue is AMD related but I found an open issue from the official Bevy's repository [#3225](https://github.com/wez/wezterm/issues/3225) and an other one from the [gfx-rs/wgpu](https://github.com/gfx-rs/wgpu) [#2519](https://github.com/gfx-rs/wgpu/issues/2519), the graphics API Bevy renderer uses as far as I know, which both users seamingly have a Nvidia GPU.

Contributor guide

Open the contributing guide

Research direction

Reproduce the fullscreen toggle on Bevy 0.13.2 with Windows, the AMD Radeon RX 5600 XT, and the Vulkan backend. Start at bevy_render::view::window::create_surfaces and the reported wgpu Surface::configure error, then compare behavior with the provided Intel laptop details; done means fullscreen switching no longer loses the parent device or panics.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.