Wayland: Buffer size is not divisible by scale
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version
0.10.1
## \[Optional\] Relevant system information
```ignore
AdapterInfo { name: "AMD Radeon RX 6800 XT", vendor: 4098, device: 29631, device_type: DiscreteGpu, driver: "AMD open-source driver", driver_info: "2023.Q2.2 (LLPC)", backend: Vulkan }
```
## What you did
```rust
App::new().add_plugins(DefaultPlugins).run();
```
The wayland feature is enabled.
## What went wrong
The app crashed immediately.
## Additional information
Here's the program output, with some clearly irrelevant lines removed:
```
2023-06-20T03:59:58.978330Z INFO bevy_winit::system: Creating new window "Bevy App" (0v0)
2023-06-20T03:59:59.022262Z INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 6800 XT", vendor: 4098, device: 29631, device_type: DiscreteGpu, driver: "AMD open-source driver", driver_info: "2023.Q2.2 (LLPC)", backend: Vulkan }
2023-06-20T03:59:59.109263Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux rolling Arch Linux", kernel: "6.3.8-zen1-1-zen", cpu: "AMD Ryzen 9 5950X 16-Core Processor", core_count: "16", memory: "62.7 GiB" }
2023-06-20T03:59:59.115921Z INFO bevy_input::gamepad: Gamepad { id: 0 } Connected
wl_surface@21: error 2: Buffer size (958x527) is not divisible by scale (2)
warning: queue 0x55b365a88790 destroyed while proxies still attached:
wl_registry@57 still attached
warning: queue 0x55b365a88790 destroyed while proxies still attached:
wl_registry@60 still attached
thread 'main' panicked at 'Error in Surface::configure: parent device is lost', /home/matt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.15.1/src/backend/direct.rs:316:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'Compute Task Pool (19)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', /home/matt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.10.1/src/schedule/executor/multi_threaded.rs:194:60
thread '' panicked at 'called `Option::unwrap()` on a `None` value', /home/matt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.10.1/src/task_pool.rs:376:49
thread 'Compute Task Pool (14)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/matt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.10.1/src/pipelined_rendering.rs:136:45
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/matt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.10.1/src/task_pool.rs:376:49
```
I think this has something to do with my compositor, Sway, initially giving a window size that is not a multiple of the scale. The crash only happens if I make the window occupy certain sizes on a HIDPI display. For example, on my 4K monitor, opening a window that takes up half of the height of the desktop (at seemingly any width) causes the crash.
Using XWayland avoids the crash.
Contributor guide
Research direction
Start by reproducing the crash with Bevy 0.10.1 on Wayland/Sway using a HiDPI display and the DefaultPlugins example. Trace window creation in bevy_winit through the wgpu Surface::configure call, then verify the fix with the reported non-divisible buffer sizes; done means the application no longer loses the device or panics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100