Open domhel opened 2 years ago
AFAIK, it would not work on in WSL on Windows 10 because it doesn't support WSLg at all. I noted a segfault in the Vulkan driver in this issue: https://github.com/gfx-rs/wgpu/issues/2213 It isn't a bug in wgpu
(since it happens with the ash
examples too) but I did create that issue to track the bug.
An update on this?
According to https://github.com/gfx-rs/wgpu/issues/2213#issuecomment-979645414 using gles instead of vulkan works.
I see that for direct use of wpgu, but how can I instruct bevy to use gles?
Using the WGPU_BACKEND=gles
env var I believe.
Still getting a seg fault, unfortunately. Although I do see a window appear for half a second :/
Still getting a seg fault, unfortunately. Although I do see a window appear for half a second :/
Same for me, I'm using bevy 0.6 now but it doesn't change anything.
This can be fixed by updating Mesa. In short:
$ sudo add-apt-repository ppa:kisak/kisak-mesa
$ sudo apt update
$ sudo apt upgrade
Using the Vulkan adapter (llvmpipe, software rasterization):
(Look at those CPUs go! 🔥)
Using GLES (hardware acceleration via DirectX) does not work with Bevy:
2022-01-16T21:45:10.315947Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 1 : GL_INVALID_ENUM in glBindTexture(target = GL_TEXTURE_CUBE_MAP_ARRAY)
That's https://github.com/gfx-rs/wgpu/issues/1746
edit: I was hoping that software rasterization with the GL backend would work better, but it does not. There's a different error:
$ WGPU_BACKEND=gl LIBGL_ALWAYS_SOFTWARE=true cargo run --example lighting
...
2022-01-16T22:15:38.750508Z INFO bevy_render::renderer: AdapterInfo { name: "llvmpipe (LLVM 13.0.0, 256 bits)", vendor: 0, device: 0, device_type: Cpu, backend: Gl }
...
2022-01-16T22:15:38.882431Z ERROR wgpu_core::device: surface configuration failed: incompatible window kind
thread 'main' panicked at 'Error in Surface::configure: invalid surface', /home/jay/.cargo/git/checkouts/wgpu-53e70f8674b08dd4/0183e7d/wgpu/src/backend/direct.rs:214:9
This looks like https://github.com/gfx-rs/wgpu/issues/2335 but sadly it is not! That bug is already fixed on the latest main branch, and I used it with a Cargo patch without success.
edit 2: AHA! It is the same bug:
$ WGPU_BACKEND=gl LIBGL_ALWAYS_SOFTWARE=true WINIT_UNIX_BACKEND=wayland cargo run --example lighting
...
thread 'main' panicked at 'wayland feature is not enabled', /home/jay/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/mod.rs:593:21
Bevy only enables X11 by default, but wgpu
prefers Wayland. We can fix that:
$ WGPU_BACKEND=gl LIBGL_ALWAYS_SOFTWARE=true cargo run --example lighting --features wayland
...
2022-01-16T22:38:46.470309Z INFO bevy_render::renderer: AdapterInfo { name: "llvmpipe (LLVM 13.0.0, 256 bits)", vendor: 0, device: 0, device_type: Cpu, backend: Gl }
...
2022-01-16T22:38:46.649707Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default
thread 'main' panicked at 'wgpu error: Validation Error
Caused by:
In Device::create_render_pipeline
note: label = `pbr_opaque_mesh_pipeline`
Internal error in FRAGMENT shader: gsamplerCubeArrayShadow isn't supported in textureGrad, textureLod or texture with bias
But we can't fix that easily.
I get the same error, but when I run a simpler example like window_settings
with wayland under either of gl or vulkan, I get no error and yet the app exits quickly without showing a window. I attached both trace level logs, but nothing stands out in them to my untrained eye.
vulkan.log
gl.log
I get two errors:
error: failed to run custom build command for `wayland-sys v0.29.4`
Caused by:
process didn't exit successfully: `/home/eber/rust/my_bevy_game/target/debug/build/wayland-sys-d7529aee7d899372/build-script-build` (exit status: 101)
And
error: failed to run custom build command for `smithay-client-toolkit v0.15.4`
Caused by:
process didn't exit successfully: `/home/eber/rust/my_bevy_game/target/debug/build/smithay-client-toolkit-8f97c7ef00c3919f/build-script-build` (exit status: 101)
I appreciate any help.
Thanks for the answer @bjorn3,
Yes, this happen when I enable wayland support, but when don't I get the following error, and in other posts I find that we'll solve it enabling wayland.
❯ cargo run
Blocking waiting for file lock on package cache
Finished dev [unoptimized + debuginfo] target(s) in 0.25s
Running `target/debug/my_bevy_game`
thread 'main' panicked at 'Failed to initialize any backend! Wayland status: "backend disabled" X11 status: XOpenDisplayFailed', /home/eber/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/mod.rs:619:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
These say:
❯ cargo run
Compiling wayland-sys v0.29.4
Compiling smithay-client-toolkit v0.15.4
error: failed to run custom build command for `wayland-sys v0.29.4`
Caused by:
process didn't exit successfully: /home/eber/rust/my_bevy_game/target/debug/build/wayland-sys-d7529aee7d899372/build-script-build
(exit status: 101)
--- stdout
cargo:rerun-if-env-changed=WAYLAND_CLIENT_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=WAYLAND_CLIENT_STATIC
cargo:rerun-if-env-changed=WAYLAND_CLIENT_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
thread 'main' panicked at 'called Result::unwrap()
on an Err
value: "pkg-config" "--libs" "--cflags" "wayland-client"
did not exit successfully: exit status: 1
error: could not find system library 'wayland-client' required by the 'wayland-sys' crate
--- stderr
Package wayland-client was not found in the pkg-config search path.
Perhaps you should add the directory containing wayland-client.pc' to the PKG_CONFIG_PATH environment variable No package 'wayland-client' found ', /home/eber/.cargo/registry/src/github.com-1ecc6299db9ec823/wayland-sys-0.29.4/build.rs:10:47 note: run with
RUST_BACKTRACE=1environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: failed to run custom build command for
smithay-client-toolkit v0.15.4`
What's news? Will WSL be support now?
I still get this error, even after I use WGPU_BACKEND=gles
or upadate Mesa.
> WGPU_BACKEND=gles cargo run --example lighting
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
Running `target/debug/examples/lighting`
2023-04-07T11:29:11.129650Z INFO bevy_winit::system: Creating new window "Bevy App" (0v0)
2023-04-07T11:29:11.129892Z WARN winit::platform_impl::platform::x11::util::randr: XRandR reported that the display's 0mm in size, which is certifiably insane
2023-04-07T11:29:11.130013Z INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1
2023-04-07T11:29:11.400053Z INFO bevy_render::renderer: AdapterInfo { name: "D3D12 (NVIDIA GeForce RTX 3070)", vendor: 0, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
2023-04-07T11:29:11.667485Z WARN bevy_audio::audio_output: No audio device found.
2023-04-07T11:29:11.687360Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 22.04 Ubuntu", kernel: "5.15.90.1-microsoft-standard-WSL2", cpu: "AMD Ryzen 5 5600 6-Core Processor", core_count: "6", memory: "15.6 GiB" }
2023-04-07T11:29:11.724345Z ERROR wgpu_core::device: surface configuration failed: incompatible window kind
thread 'main' panicked at 'Error in Surface::configure: invalid surface', /home/nerd/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/wgpu-0.15.1/src/backend/direct.rs:316:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'A system has panicked so the executor cannot continue.: RecvError', crates/bevy_ecs/src/schedule/executor/multi_threaded.rs:194:60
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/nerd/Code/bevy/crates/bevy_tasks/src/task_pool.rs:376:49
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:135:45
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/nerd/Code/bevy/crates/bevy_tasks/src/task_pool.rs:376:49
fish: Job 1, 'WGPU_BACKEND=gles cargo run --e…' terminated by signal SIGSEGV (Address boundary error)
What's news? Will WSL be support now?
I still get this error, even after I use
WGPU_BACKEND=gles
or upadate Mesa.> WGPU_BACKEND=gles cargo run --example lighting Finished dev [unoptimized + debuginfo] target(s) in 0.13s Running `target/debug/examples/lighting` 2023-04-07T11:29:11.129650Z INFO bevy_winit::system: Creating new window "Bevy App" (0v0) 2023-04-07T11:29:11.129892Z WARN winit::platform_impl::platform::x11::util::randr: XRandR reported that the display's 0mm in size, which is certifiably insane 2023-04-07T11:29:11.130013Z INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1 2023-04-07T11:29:11.400053Z INFO bevy_render::renderer: AdapterInfo { name: "D3D12 (NVIDIA GeForce RTX 3070)", vendor: 0, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl } ALSA lib confmisc.c:855:(parse_card) cannot find card '0' ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default 2023-04-07T11:29:11.667485Z WARN bevy_audio::audio_output: No audio device found. 2023-04-07T11:29:11.687360Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 22.04 Ubuntu", kernel: "5.15.90.1-microsoft-standard-WSL2", cpu: "AMD Ryzen 5 5600 6-Core Processor", core_count: "6", memory: "15.6 GiB" } 2023-04-07T11:29:11.724345Z ERROR wgpu_core::device: surface configuration failed: incompatible window kind thread 'main' panicked at 'Error in Surface::configure: invalid surface', /home/nerd/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/wgpu-0.15.1/src/backend/direct.rs:316:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'main' panicked at 'A system has panicked so the executor cannot continue.: RecvError', crates/bevy_ecs/src/schedule/executor/multi_threaded.rs:194:60 thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/nerd/Code/bevy/crates/bevy_tasks/src/task_pool.rs:376:49 thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:135:45 thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/nerd/Code/bevy/crates/bevy_tasks/src/task_pool.rs:376:49 fish: Job 1, 'WGPU_BACKEND=gles cargo run --e…' terminated by signal SIGSEGV (Address boundary error)
Hi! I found the answer after some intense searching, we need to add the feature to the cargo file. So change from :
[dependencies]
bevy = "*.**.*"
to :
[dependencies]
bevy = { version = "*.**.*", features = ["wayland"] }
If it still doesn't work, we can force WInit to use wayland :
WINIT_UNIX_BACKEND=wayland cargo run
Bevy version
0.5
Operating system & version
Windows 11 and WSL with Ubuntu 20.04
What you did
cargo new bevy_test
,cd bevy_test
bevy="0.5"
to Cargo.tomlcargo run
What you expected to happen
Print "Hello, world!" and exit the program.
What actually happened
"Hello, world!" Segmentation fault
Additional information
Everything works until DefaultPlugins are added. Sadly, I haven't tested this with Windows 10 so I don't know if it was working before.