iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
24.93k stars 1.18k forks source link

Wgpu panics: surface does not support the adapter's queue family #838

Closed PeterlitsZo closed 3 years ago

PeterlitsZo commented 3 years ago

I am not sure what is wgpu. And I have also tried to sreach in web for a useful solution but nothing.

I run the progamme in WSL 2 (with the full linux kernel), but it panics with this erroe message:

error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
vulkan: No DRI3 support detected - required for presentation
Note: you can probably enable DRI3 in your Xorg config
thread 'main' panicked at 'Error in Device::create_swap_chain: surface does not support the adapter's queue family', /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.1/src/backend/direct.rs:129:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    12742 segmentation fault  cargo run

The first three lines looks just a waring but not error, and the last one about surface does not support the adapter's queue family' looks useful, but I cannot find some useful solution. So what is adapter's queue family? What can I do to support it?

PeterlitsZo commented 3 years ago

I get it! Althrough I do not know the relation between wgpu and mesa.

I use WSL Ubuntu 20.04 LTS and follow this document: https://github.com/gnsmrky/wsl-vulkan-mesa#install-mesa-and-run-vulkan-tools

Ubuntu has friendly package store than kali, and the wsl-vulkan-mesa is for Ubuntu. If someone know how to run on X server in Kali-Linux, please let me know how to do it.

ibaryshnikov commented 3 years ago

I'm having a similar issue on Linux

thread 'main' panicked at 'Error in Device::create_swap_chain: surface does not support the adapter's queue family', /home/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.1/src/backend/direct.rs:129:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Segmentation fault (core dumped)

rustc 1.51.0 uname -r: 5.10.32-1-MANJARO

The error is the same for published iced 0.3.0 and upstream. On the other hand, wgpu-rs examples work fine, showing Using GeForce RTX 2060 (Vulkan) in logs

Update: integration example works because it passes Some(&surface) to request_adapter https://github.com/hecrj/iced/blob/master/examples/integration/src/main.rs#L41

hecrj commented 3 years ago

I have opened #868 to fix the issue. Let me know if it works for you!

ibaryshnikov commented 3 years ago

Tested with cargo run --package counter, errors on master but works on wgpu-compatible-surface branch

Edit: woops, not exactly

wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `iced_wgpu encoder`
    In a set_scissor_rect command
    Invalid ScissorRect parameters

thread 'main' panicked at 'Handling wgpu errors as fatal by default', /home/x/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.1/src/backend/direct.rs:1896:5
ibaryshnikov commented 3 years ago

I have to mess up with the xorg configs in a very specific way in order to reproduce this issue. For example, if I delete /etc/X11/xorg.conf and all the files in /etc/X11/xorg.conf.d/, then it builds and runs the application. But when I do cd /etc/X11/xorg.conf.d/ then cp /usr/share/X11/xorg.conf.d/* . and cd /etc/X11/ with sudo nvidia-xconfig, then it starts to fail. So it looks that a specific configuration of xorg triggers this behavior in my case.

ibaryshnikov commented 3 years ago

Tested some more examples

master bezier_tool -> Invalid ScissorRect parameters clock -> ok color_palette -> Invalid ScissorRect parameters counter -> Error in Device::create_swap_chain custom_widget -> Error in Device::create_swap_chain download_progress -> Error in Device::create_swap_chain events -> Error in Device::create_swap_chain

wgpu-compatible-surface bezier_tool -> Invalid ScissorRect parameters clock -> ok color_palette -> Invalid ScissorRect parameters counter -> Invalid ScissorRect parameters custom_widget -> Invalid ScissorRect parameters download_progress -> Invalid ScissorRect parameters events -> Invalid ScissorRect parameters