Running with wayland enabled under sway results in ERROR_SURFACE_LOST_KHR
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
**Bevy version**: 0.21.5
I wrote a very simple app that moves a blue box around the screen. Source below. I've successfully run the app on my mac laptop.
Running on my arch/sway dev machine with `features = ["wayland"]` results in the following error:
```
2023-11-30T13:14:59.537409Z INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 6650 XT (RADV NAVI23)", vendor: 4098, device: 29679, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 23.1.9-manjaro1.1", backend: Vulkan }
2023-11-30T13:14:59.842066Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 23.1.0 Manjaro Linux", kernel: "6.1.63-1-MANJARO", cpu: "AMD Ryzen 7 5800X 8-Core Processor", core_count: "8", memory: "31.3 GiB" }
2023-11-30T13:15:00.004048Z ERROR wgpu_hal::vulkan::adapter: get_physical_device_surface_formats: ERROR_SURFACE_LOST_KHR
thread 'main' panicked at /home/colinmarc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.17.2/src/backend/direct.rs:771:18:
Error in Surface::configure: Validation Error
Caused by:
Requested format Bgra8UnormSrgb is not in list of supported formats: []
```
I've tested wgpu examples and they work fine.
## Source
```
use bevy::{prelude::*, window::WindowResolution};
const SIZE: f32 = 32.0;
#[derive(Component)]
struct Box(u8);
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
title: "Latency Test".to_string(),
// resolution: WindowResolution::new(SIZE * 8.0, SIZE * 8.0),
..Default::default()
}),
..Default::default()
}))
.insert_resource(ClearColor(Color::BLACK))
.add_systems(Startup, setup)
.add_systems(Update, (update_on_keypress, bevy::window::close_on_esc))
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
commands.spawn((
SpriteBundle {
sprite: Sprite {
color: Color::BLUE,
custom_size: Some(Vec2::new(SIZE, SIZE)),
anchor: bevy::sprite::Anchor::TopLeft,
..default()
},
transform: Transform::from_translation(Vec3::new(SIZE * -4.0, SIZE * 4.0, 0.0)),
..default()
},
Box(0),
));
}
fn update_on_keypress(
keyboard_input: Res>,
mut query: Query<(&mut Box, &mut Transform)>,
) {
if keyboard_input.just_pressed(KeyCode::Space) {
for (mut b, mut transform) in &mut query {
b.0 = (b.0 + 1) % 64;
let y = b.0 / 8;
let x = b.0 % 8;
transform.translation.x = SIZE * (-4.0 + x as f32);
transform.translation.y = SIZE * (4.0 - y as f32);
}
}
}
```
Contributor guide
Research direction
Start by reproducing the Bevy 0.21.5 app with the `wayland` feature on Arch/Sway and compare it with the working wgpu examples. Trace the window and Vulkan surface setup associated with the reported `ERROR_SURFACE_LOST_KHR` and empty supported-format list; done means the sample runs without the surface-configuration panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, rust
- Domain
- game-dev, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100