Closed aegroto closed 2 years ago
Hi! Thanks for the report.
I'm tentatively labeling this issue as an upstream-bug, since that is most likely to be the case. I haven't been able to build your project (on Windows 11) because it wants OpenSSL and I'm a little hesitant to install the 85th incarnation of heartbleed.
I commented out the OpenSSL dev-dependencies
, and now I'm fighting with the FFmpeg dep. I'll report back when I have something useful.
π¬ So I finally got a build to work. This was the magical incantation:
$ git clone https://github.com/microsoft/vcpkg
$ ./vcpkg/bootstrap-vcpkg.sh
$ ./vcpkg/vcpkg --triplet=x64-windows-static-md install ffmpeg
$ ./vcpkg/vcpkg --triplet=x64-windows-static-md install llvm
$ LIBCLANG_PATH=$PWD/vcpkg/packages/llvm_x64-windows-static-md/bin/ VCPKG_ROOT=$PWD/vcpkg cargo build --example pixels_example
And LLVM took 33 minutes to build on a 12-core CPU. π
Anyway, now I can run it and...
$ LIBCLANG_PATH=$PWD/../vcpkg/packages/llvm_x64-windows-static-md/bin/ VCPKG_ROOT=$PWD/../vcpkg cargo run --example pixels_example
Finished dev [unoptimized + debuginfo] target(s) in 0.15s
Running `target\debug\examples\pixels_example.exe`
$ echo $?
0
Oh, well, it didn't crash or panic, it just exits. Admittedly, this is the first time I'm looking at your code. It doesn't spin up the event loop, so AFAICT, this code is running as well as it can on my system. I'm running Windows 11 with an RTX 3090 (and the Vulkan backend).
I think the most relevant difference is that window handling in Windows is pretty much a synchronous process. Calling pixels.render()
immediately is probably not going to cause too many problems. But with Wayland (and probably X11?) all window handling is asynchronous. which leads to some problematic behavior that violates expectations, like https://github.com/rust-windowing/winit/issues/2080
In short, you really need to run the event loop before you try to draw anything.
Out of curiosity, have you experienced the same error when running the pixels
examples? If yes, then the issue may be outside of your control (like a driver issue). If our examples work, then the problem is in your code. And it's very likely related to not starting the event loop.
Hello, I'm not able to run example due to a compilation error on the winit dependency (0.25.0). I think the problem is not present on Windows and it's strictly linked to my setup, and I assume the behaviour of the example on your trial is correct as there is no loop and so it's supposed to close immediately.
I'm able to run pixels using an old version of beryllium, you can check some code on the "master" branch to verify, and the way I call render() is not much different.
I already had the suspect this was not a bug related to the pixels crate but something on a lower level, could you please suggest me at who I may report this issue?
I'm not convinced the issue is outside of your code. To begin, you should probably not be calling pixels.render()
immediately after creating the pixel buffer: https://github.com/aegroto/remotia/blob/f9f718a6c31c6630f4f4e1522cb44bf1647bee5c/src/client/pipeline/waterfall.rs#L101
This function needs a surface that is ready to draw on. And as I mentioned in my last comment that is not always the case. It is also unusual to want to draw at this point, since there is nothing to show; you haven't populated the pixel buffer with any image (it defaults to transparent black).
The actual task of drawing involves recording a command buffer and sending it to the GPU to do the work. Depending on the present mode, the thread could wait on the GPU to finish. But if the GPU doesn't have a valid surface, then it can't really do anything other than raise an error. The precise error you receive is this one: https://github.com/gfx-rs/wgpu/blob/c1c855bb9812d0c1703bd112d09e3eba58e45b6b/wgpu-core/src/device/mod.rs#L2759-L2760
Unfortunately, this error is pretty nebulous. It looks like a catchall for "Something went wrong, and we don't know a better way to categorize it". Here's what the spec has to say: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#devsandqueues-lost-device Regardless, it is consistent with attempting to draw to a surface that is not yet available.
Other than that, I can't comment on SDL2 or why it seems to do what you expect. I think it's the exception rather than the rule, in this case.
I can say that, since two hours ago, the master branch started crashing as well on my machine. I'll try to figure out what's causing this issue and let you know.
For completeness, this is the compilation output of minimal-winit on my system:
lorenzo@lorenzo-Alpha-15-A3DDK:/media/lorenzo/ext/repository/pixels$ cargo run --package minimal-winit
Compiling cfg-if v1.0.0
Compiling bitflags v1.3.2
Compiling once_cell v1.8.0
Compiling lazy_static v1.4.0
Compiling smallvec v1.7.0
Compiling scopeguard v1.1.0
Compiling cty v0.2.2
Compiling termcolor v1.1.2
Compiling ttf-parser v0.6.2
Compiling minimal-lexical v0.2.1
Compiling unicode-width v0.1.9
Compiling downcast-rs v1.2.0
Compiling byteorder v1.4.3
Compiling scoped-tls v1.0.0
Compiling bit-vec v0.6.3
Compiling same-file v1.0.6
Compiling hexf-parse v0.2.1
Compiling ab_glyph_rasterizer v0.1.5
Compiling cfg-if v0.1.10
Compiling bytemuck v1.7.2
Compiling profiling v1.0.4
Compiling arrayvec v0.7.2
Compiling inplace_it v0.3.3
Compiling renderdoc-sys v0.7.1
Compiling glow v0.11.0
Compiling copyless v0.1.5
Compiling percent-encoding v2.1.0
Compiling regex-syntax v0.6.25
Compiling humantime v2.1.0
Compiling pollster v0.2.4
Compiling ahash v0.7.6
Compiling libloading v0.7.2
Compiling instant v0.1.12
Compiling libloading v0.6.7
Compiling raw-window-handle v0.4.2
Compiling gpu-descriptor-types v0.1.1
Compiling gpu-alloc-types v0.2.0
Compiling wgpu-types v0.11.0
Compiling lock_api v0.4.5
Compiling codespan-reporting v0.11.1
Compiling walkdir v2.3.2
Compiling fxhash v0.2.1
Compiling bit-set v0.5.2
Compiling safe_arch v0.5.2
Compiling libc v0.2.109
Compiling log v0.4.14
Compiling memchr v2.4.1
Compiling crossbeam-utils v0.8.5
Compiling dlib v0.5.0
Compiling ash v0.33.3+1.2.191
Compiling owned_ttf_parser v0.6.0
Compiling dlib v0.4.2
Compiling gpu-alloc v0.5.2
Compiling num-traits v0.2.14
Compiling memoffset v0.6.5
Compiling wide v0.6.5
Compiling wayland-sys v0.28.6
Compiling rusttype v0.9.2
Compiling crossbeam-channel v0.5.1
Compiling crossbeam-queue v0.3.2
Compiling nom v7.1.0
Compiling aho-corasick v0.7.18
Compiling crossbeam-epoch v0.9.5
Compiling getrandom v0.2.3
Compiling parking_lot_core v0.8.5
Compiling nix v0.20.0
Compiling raw-window-handle v0.3.4
Compiling dirs-sys v0.3.6
Compiling nix v0.18.0
Compiling khronos-egl v4.1.0
Compiling memmap2 v0.1.0
Compiling mio v0.8.0
Compiling mio v0.7.14
Compiling x11-dl v2.19.1
Compiling atty v0.2.14
Compiling spirv v0.2.0+1.5.4
Compiling crossbeam-deque v0.8.1
Compiling parking_lot v0.11.2
Compiling ultraviolet v0.8.1
Compiling dirs v3.0.2
Compiling regex v1.5.4
Compiling xcursor v0.3.4
Compiling thiserror v1.0.30
Compiling hashbrown v0.11.2
Compiling crossbeam v0.8.1
Compiling xdg v2.4.0
Compiling env_logger v0.9.0
Compiling wayland-commons v0.28.6
Compiling mio-misc v1.3.2
Compiling andrew v0.3.1
Compiling calloop v0.6.5
Compiling indexmap v1.7.0
Compiling gpu-descriptor v0.2.2
Compiling wayland-client v0.28.6
Compiling naga v0.7.2
Compiling wayland-cursor v0.28.6
Compiling wayland-protocols v0.28.6
Compiling wgpu-hal v0.11.5
Compiling smithay-client-toolkit v0.12.3
Compiling wgpu-core v0.11.3
Compiling winit v0.25.0
error[E0308]: mismatched types
--> /home/lorenzo/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.25.0/src/platform_impl/linux/x11/mod.rs:188:53
|
188 | let queue = Arc::new(NotificationQueue::new(waker));
| ^^^^^ expected struct `mio::waker::Waker`, found struct `mio::Waker`
|
= note: expected struct `Arc<mio::waker::Waker>`
found struct `Arc<mio::Waker>`
= note: perhaps two different versions of crate `mio` are being used?
For more information about this error, try `rustc --explain E0308`.
error: could not compile `winit` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
Before you do anything else, make a copy of Cargo.lock
...
That build error looks like something that can be fixed by running cargo update
... Just guessing. We don't commit the lock file any more, but Cargo does keep one in the repo root directory. I've seen issues with some dependencies causing breaking changes in minor releases, and some other weird behavior. But we do build and test on Linux in our CI, so we know that Linux builds are working as of 2 days ago: https://github.com/parasyte/pixels/runs/4451823614?check_suite_focus=true
What stands out to me is that you are building two copies of mio
, and our CI build only has one. If you really want to investigate that, cargo tree
can tell you what is pulling in that stray mio
version. Your Cargo.lock
backup can, as well.
a run of 'cargo clean' and 'cargo update' solved the demo problem, thanks! I think this may be added in the README of each example, it may be necessary to run an update on different OS than Windows.
Also, changing the reference PPA from oibaf to kisak has solved the error, although something is still not working but I think it's related to my Xorg configuration, so I guess we can close this issue, thanks for all the support!
I'm running Ubuntu 20.04, with i3 and open source Mesa drivers. I'm not able to run a simple pixels application, the render() call causes a vulkan failure.
The source code of the program may be found here: https://github.com/aegroto/remotia/blob/winit-port/examples/pixels_example/main.rs
The 'master' branch of this project works, but relies on an older version of beryllium. I tried removing that layer and using bare winit, but the problem persisted. I guess it may be due to some incompatibilities with i3 or my own drivers, and I would like to fix it myself, but I have no idea on how to debug that error or on what may cause it.
Full logs: