pixels icon indicating copy to clipboard operation
pixels copied to clipboard

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

Open Pmyl opened this issue 1 year ago • 5 comments

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

Pmyl avatar Feb 11 '24 15:02 Pmyl

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.

parasyte avatar Feb 12 '24 03:02 parasyte

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:

  • using game_loop + winit + latest crates.io version of Pixels doesn't work
  • using game_loop + winit + latest repository version of Pixels works

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

Pmyl avatar Feb 14 '24 21:02 Pmyl

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?

parasyte avatar Mar 04 '24 22:03 parasyte

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

Pmyl avatar Mar 07 '24 13:03 Pmyl