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

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

Open
Pmyl opened this issue Feb 11, 2024 · 5 comments
Open

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

Pmyl opened this issue Feb 11, 2024 · 5 comments
Labels
documentation Improvements or additions to documentation duplicate This issue or pull request already exists examples A bug or improvement for an example help wanted Extra attention is needed question Usability question

Comments

@Pmyl
Copy link

Pmyl commented Feb 11, 2024

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
Copy link
Owner

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 parasyte added documentation Improvements or additions to documentation duplicate This issue or pull request already exists help wanted Extra attention is needed question Usability question examples A bug or improvement for an example labels Feb 12, 2024
@Pmyl
Copy link
Author

Pmyl commented Feb 14, 2024

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

@parasyte
Copy link
Owner

parasyte commented Mar 4, 2024

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
Copy link
Author

Pmyl commented Mar 7, 2024

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

@mTvare6
Copy link

mTvare6 commented Oct 13, 2024

@Pmyl this should fix it.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation duplicate This issue or pull request already exists examples A bug or improvement for an example help wanted Extra attention is needed question Usability question
Projects
None yet
Development

No branches or pull requests

3 participants