parasyte / pixels

A tiny hardware-accelerated pixel frame buffer. 🦀
https://docs.rs/pixels
MIT License
1.82k stars 123 forks source link

Invaders example doesn't work when using pixels from crates.io #392

Open Pmyl opened 9 months ago

Pmyl commented 9 months ago

I've spent a very long time trying to debug a problem in my new project, and in the end I've found out that if I target the cloned version on the pixels crate everything works fine!

I can easily replicate the issue in the invaders example by changing this Cargo.toml line pixels = { path = "../.." } with this pixels = "0.13.0"

With { path = "../.." } image

With "0.13.0" image

with the terminal spitting out this error:

[2024-02-11T15:31:31Z ERROR winit::platform_impl::platform] X11 error: XError {
        description: "136",
        error_code: 136,
        request_code: 148,
        minor_code: 1,
    }

Edit: I think I've found the commit that fixed the problem, if I rollback just before the commit that updates wgpu to 0.17 then I get the same result as using version 0.13.0, after that commit everything works

System: OS: Pop!_OS 22.04 LTS rustc: 1.74.1

parasyte commented 9 months ago

This is probably a duplicate of #313. The examples are permanently tightly coupled to the git repo, and the examples themselves are not published to crates.io.

To use the examples, clone the git repo and run them from there.

Pmyl commented 9 months ago

I understand that the examples may be out of date, my concern is about the fact that the latest version of Pixels from crates.io doesn't work with "advertised" (by the examples) libraries, but the latest unreleased version of the code does.

Using the Invaders example in this issue was only to speed up the process of demonstrating the problem without having to create a repository example, the main point is:

The snippet of code that uses game_loop + winit in the Invaders example seems sensible and there is no missing method/trait/etc, everything fits, it just doesn't work

parasyte commented 8 months ago

I am not sure what to do, since I cannot reproduce your findings. The steps I took:

  1. Clone the github repo and checkout tag 0.13.0 corresponding to the released version on crates.io.
  2. Copy examples/invaders/ to my Desktop (doesn't matter where, just somewhere else outside of the Cargo workspace).
  3. Modify Cargo.toml to point at the crates.io release.
    - pixels = { path = "../.." }
    + pixels = "0.13"
  4. cargo run
  5. Observe that it works fine (*only tested on Windows)

What am I missing?

Pmyl commented 8 months ago

I'm on Linux, maybe that's the problem? I'll try again on a different machine and let you know

mTvare6 commented 1 month ago

@Pmyl this should fix it.

- winit = "*"
+ winit = {version="*", features = ["rwh_05"]}