Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

winit crash #326

Open
ProkopRandacek opened this issue May 28, 2023 · 9 comments
Open

winit crash #326

ProkopRandacek opened this issue May 28, 2023 · 9 comments

Comments

@ProkopRandacek
Copy link

Hi :D

I am getting a crash when I try to build the example from readme:

~/source/vello 101 % RUST_BACKTRACE=1 cargo run -p with_winit 
    Finished dev [unoptimized + debuginfo] target(s) in 0.24s
     Running `target/debug/with_winit_bin`
[2023-05-28T13:36:15Z ERROR sctk_adwaita::config] XDG Settings Portal did not return response in time: timeout: 100ms, key: color-scheme
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/prokop/source/vello/src/util.rs:58:56
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::Option<T>::unwrap
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/option.rs:942:21
   4: vello::util::RenderContext::create_surface::{{closure}}
             at ./src/util.rs:58:22
   5: pollster::block_on
             at /home/prokop/.cargo/registry/src/github.com-1ecc6299db9ec823/pollster-0.3.0/src/lib.rs:128:15
   6: with_winit::run::{{closure}}
             at ./examples/with_winit/src/lib.rs:424:31
   7: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run_return
             at /home/prokop/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.28.6/src/platform_impl/linux/wayland/event_loop/mod.rs:242:9
   8: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run
             at /home/prokop/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.28.6/src/platform_impl/linux/wayland/event_loop/mod.rs:223:25
   9: winit::platform_impl::platform::EventLoop<T>::run
             at /home/prokop/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.28.6/src/platform_impl/linux/mod.rs:792:56
  10: winit::event_loop::EventLoop<T>::run
             at /home/prokop/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.28.6/src/event_loop.rs:305:9
  11: with_winit::run
             at ./examples/with_winit/src/lib.rs:125:5
  12: with_winit::main
             at ./examples/with_winit/src/lib.rs:484:13
  13: with_winit_bin::main
             at ./examples/with_winit/src/main.rs:4:5
  14: core::ops::function::FnOnce::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: queue 0x7f4a7d1f6170 destroyed while proxies still attached:
  xdg_wm_base@20 still attached
  wl_output@14 still attached
  wl_seat@13 still attached
  xdg_activation_v1@12 still attached
  wp_viewporter@11 still attached
  zwp_text_input_manager_v3@10 still attached
  zwp_pointer_constraints_v1@9 still attached
  zwp_relative_pointer_manager_v1@8 still attached
  zxdg_decoration_manager_v1@7 still attached
  wl_subcompositor@6 still attached
  wl_compositor@5 still attached
  wl_shm@4 still attached
  wl_registry@2 still attached
~/source/vello 101 % 

Am I doing something wrong or is this a bug? Thanks for any help! I'm on alpine linux with wayland btw.

@DJMcNab
Copy link
Collaborator

DJMcNab commented May 30, 2023

Can you run the wgpu examples - that is, clone https://github.com/gfx-rs/wgpu and execute cargo run --example boids

The error you're getting is indicating that there are no GPU devices on your system which support the surface being created.

@ProkopRandacek
Copy link
Author

I can run the boids example without issues from HEAD, 0.16.0 and 0.16.1

@m-hugo
Copy link
Contributor

m-hugo commented Jun 1, 2023

i coincidentally ran into it too, wgpu examples worked because they fallback to GL if vulkan isnt present, vello didn't
reinstalling vulkan solved the problem

@ProkopRandacek
Copy link
Author

I can confirm that my laptop doesnt support vulkan.

@m-hugo
Copy link
Contributor

m-hugo commented Jun 1, 2023

GL is not a primary WGPU backend, replace ::PRIMARY with ::GL and see if it works

backends: wgpu::Backends::PRIMARY,

@m-hugo
Copy link
Contributor

m-hugo commented Jun 1, 2023

It throws a wgpu validation error on my end, not sure how much work it would be to make vello work on GL but anyways it would be nice to have better error reporting, like if backends {} else {"You need to have a Vulkan/metal/dx12 driver to run this app"}

@ProkopRandacek
Copy link
Author

Chaning to ::GL did move the issue somewhere else:

~/source/vello 101 % git d
diff --git a/src/util.rs b/src/util.rs
index 87e2d35..9a28f41 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -40,7 +40,7 @@ pub struct DeviceHandle {
 impl RenderContext {
     pub fn new() -> Result<Self> {
         let instance = Instance::new(wgpu::InstanceDescriptor {
-            backends: wgpu::Backends::PRIMARY,
+            backends: wgpu::Backends::GL,
             dx12_shader_compiler: wgpu::Dx12Compiler::Fxc,
         });
         Ok(Self {
~/source/vello 0 % cargo run -p with_winit
    Finished dev [unoptimized + debuginfo] target(s) in 0.42s
     Running `target/debug/with_winit_bin`
[2023-06-01T16:53:52Z ERROR sctk_adwaita::config] XDG Settings Portal did not return response in time: timeout: 100ms, key: color-scheme
Creating renderer 0
[2023-06-01T16:53:52Z ERROR wgpu_hal::gles::egl] GLES: [ShaderCompiler/Error] ID 2 : 0:688(2): error: `return' with wrong type float[4], in function `fill_path' returning float
[2023-06-01T16:53:52Z ERROR wgpu_hal::gles::egl] GLES: [ShaderCompiler/Error] ID 3 : 0:775(2): error: `return' with wrong type float[4], in function `stroke_path' returning float
[2023-06-01T16:53:52Z ERROR wgpu_hal::gles::egl] GLES: [ShaderCompiler/Error] ID 4 : 0:850(2): error: value of type float cannot be assigned to variable of type float[4]
[2023-06-01T16:53:52Z ERROR wgpu_hal::gles::egl] GLES: [ShaderCompiler/Error] ID 5 : 0:859(2): error: value of type float cannot be assigned to variable of type float[4]
[2023-06-01T16:53:52Z ERROR wgpu::backend::direct] Handling wgpu errors as fatal by default
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_compute_pipeline
      note: label = `fine`
    Internal error: 0:688(2): error: `return' with wrong type float[4], in function `fill_path' returning float
0:775(2): error: `return' with wrong type float[4], in function `stroke_path' returning float
0:850(2): error: value of type float cannot be assigned to variable of type float[4]
0:859(2): error: value of type float cannot be assigned to variable of type float[4]


', /home/prokop/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.16.1/src/backend/direct.rs:3019:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: queue 0x7f0519b54170 destroyed while proxies still attached:
  xdg_wm_base@20 still attached
  wl_output@14 still attached
  wl_seat@13 still attached
  xdg_activation_v1@12 still attached
  wp_viewporter@11 still attached
  zwp_text_input_manager_v3@10 still attached
  zwp_pointer_constraints_v1@9 still attached
  zwp_relative_pointer_manager_v1@8 still attached
  zxdg_decoration_manager_v1@7 still attached
  wl_subcompositor@6 still attached
  wl_compositor@5 still attached
  wl_shm@4 still attached
  wl_registry@2 still attached
~/source/vello 101 % 

@simbleau
Copy link
Member

simbleau commented Mar 4, 2024

Is this still an issue? We recently updated winit.

@simbleau simbleau added the disposition:close The issue is growing stale and is likely to be closed if no response is provided. label Mar 4, 2024
@DJMcNab
Copy link
Collaborator

DJMcNab commented Mar 4, 2024

Is this not a platform/API support issue, nothing to do with winit specifically?

The initial issue is that our with_winit error handling for not supporting Vulkan is terrible, and the later comments are discussing attempting to get downlevel OpenGL working.

@simbleau simbleau removed the disposition:close The issue is growing stale and is likely to be closed if no response is provided. label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants