audulus / rui

Declarative Rust UI library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get error when running the example

Tim-Paik opened this issue · comments

I get an error when running the example:

RUST_BACKTRACE=1 cargo run --example counter

then

    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/examples/counter`
Using Mesa Intel(R) UHD Graphics 630 (CFL GT2) (Gl)
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `vger encoder`
    In a set_pipeline command
      note: render pipeline = `<RenderPipeline-(0, 1, Gl)>`
    Render pipeline targets are incompatible with render pass
    Incompatible color attachment: the renderpass expected [Some(Rgba8UnormSrgb)] but was given [Some(Bgra8UnormSrgb)]

', /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/wgpu-0.13.1/src/backend/direct.rs:2391:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14
   2: wgpu::backend::direct::default_error_handler
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/wgpu-0.13.1/src/backend/direct.rs:2391:5
   3: core::ops::function::Fn::call
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:77:5
   4: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/alloc/src/boxed.rs:1954:9
   5: wgpu::backend::direct::ErrorSinkRaw::handle_error
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/wgpu-0.13.1/src/backend/direct.rs:2377:17
   6: wgpu::backend::direct::Context::handle_error
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/wgpu-0.13.1/src/backend/direct.rs:261:9
   7: <wgpu::backend::direct::Context as wgpu::Context>::command_encoder_end_render_pass
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/wgpu-0.13.1/src/backend/direct.rs:2087:13
   8: <wgpu::RenderPass as core::ops::drop::Drop>::drop
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/wgpu-0.13.1/src/lib.rs:3143:13
   9: core::ptr::drop_in_place<wgpu::RenderPass>
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ptr/mod.rs:487:1
  10: vger::Vger::encode
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/vger-0.2.4/src/lib.rs:293:9
  11: rui::context::Context::render
             at ./src/context.rs:280:9
  12: rui::event_loop::rui::{{closure}}
             at ./src/event_loop.rs:385:17
  13: winit::platform_impl::platform::sticky_exit_callback
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/winit-0.26.1/src/platform_impl/linux/mod.rs:753:5
  14: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run_return
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/winit-0.26.1/src/platform_impl/linux/wayland/event_loop/mod.rs:394:21
  15: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/winit-0.26.1/src/platform_impl/linux/wayland/event_loop/mod.rs:209:9
  16: winit::platform_impl::platform::EventLoop<T>::run
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/winit-0.26.1/src/platform_impl/linux/mod.rs:669:56
  17: winit::event_loop::EventLoop<T>::run
             at /home/timpaikx/.cargo/registry/src/mirrors.bfsu.edu.cn-4c6e9dcaa6bd74e7/winit-0.26.1/src/event_loop.rs:154:9
  18: rui::event_loop::rui
             at ./src/event_loop.rs:289:5
  19: counter::main
             at ./examples/counter.rs:4:5
  20: core::ops::function::FnOnce::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fish: Job 1, 'RUST_BACKTRACE=1 cargo run --ex…' terminated by signal SIGSEGV (Address boundary error)

OS: Archlinux
DE: GNOME 43 Wayland
git commit: 15273d1

If you need more information, I'm more than happy to provide it

If you change this line to Rgba8UnormSrgb, does it work?

let mut vger = Vger::new(&device, wgpu::TextureFormat::Bgra8UnormSrgb);

If you change this line to Rgba8UnormSrgb, does it work?

let mut vger = Vger::new(&device, wgpu::TextureFormat::Bgra8UnormSrgb);

This solved my problem!

Ok, cool. There must be a way to ask wgpu what texture format to use on the device...

@Tim-Paik does that last change also work on your end?

yes, it works fine