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

treewide: update dependencies #60

Merged
merged 1 commit into from
Apr 13, 2020
Merged

treewide: update dependencies #60

merged 1 commit into from
Apr 13, 2020

Conversation

lovesegfault
Copy link
Contributor

@lovesegfault lovesegfault commented Apr 12, 2020

This updates all of pixels's dependencies. Most importantly, it gets us winit 0.22 and wgpu 0.5.0.

This was done in a best-effort way, as I sometimes wasn't entire sure how to get things to work. There's a nasty transmute I want to get rid off, but couldn't figure out how. Figured I'd open the PR to get some ideas.

@lovesegfault
Copy link
Contributor Author

Here's the conway example running with the new deps:
image

@lovesegfault
Copy link
Contributor Author

Alright, all warnings are fixed now :)

@lovesegfault lovesegfault changed the title Update dependencies treewide: update dependencies Apr 12, 2020
src/renderers.rs Outdated Show resolved Hide resolved
@parasyte parasyte mentioned this pull request Apr 13, 2020
@parasyte
Copy link
Owner

What happened that made beryllium stop working with wgpu? And if all else fails, can we use the raw bindings (fermium) instead?

@lovesegfault
Copy link
Contributor Author

@parasyte if you checkout this branch's first commit you can reproduce the issue:

error[E0277]: the trait bound `beryllium::window::gl_window::GlWindow: raw_window_handle::HasRawWindowHandle` is not satisfied
   --> examples/minimal-sdl2/main.rs:32:39
    |
32  |         let surface = Surface::create(&window);
    |                                       ^^^^^^^ the trait `raw_window_handle::HasRawWindowHandle` is not implemented for `beryllium::window::gl_window::GlWindow`
    |
   ::: /home/bemeurer/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.5.0/src/lib.rs:596:22
    |
596 |     pub fn create<W: raw_window_handle::HasRawWindowHandle>(window: &W) -> Self {
    |                      ------------------------------------- required by this bound in `wgpu::Surface::create`

error: aborting due to previous error

If someone can figure this one out then we don't need to nuke the SDL example :)

@lovesegfault
Copy link
Contributor Author

Oh, wait, I think I figured it out!

src/lib.rs Outdated Show resolved Hide resolved
src/renderers.rs Outdated Show resolved Hide resolved
@parasyte
Copy link
Owner

@lovesegfault It looks like you want to use create_raw_window instead of create_gl_window

@lovesegfault
Copy link
Contributor Author

@parasyte Correct! Just fixed it :)

@parasyte
Copy link
Owner

It looks like MSRV in CI also needs to be updated to 1.40.0. https://travis-ci.org/github/parasyte/pixels/jobs/674268632

@lovesegfault
Copy link
Contributor Author

@parasyte You may want to consider #61 before this PR, either way I'm fixing Travis :)

@parasyte
Copy link
Owner

It's on my plate to review.

@parasyte
Copy link
Owner

parasyte commented Apr 13, 2020

This patch was needed to get minimal-sdl working. (Bonus: It works on macOS now! Fixes #47)

diff --git a/examples/minimal-sdl2/main.rs b/examples/minimal-sdl2/main.rs
index c4e9135..809f65d 100644
--- a/examples/minimal-sdl2/main.rs
+++ b/examples/minimal-sdl2/main.rs
@@ -31,23 +31,21 @@ fn main() -> Result<(), String> {
     let mut world = World::new();

     'game_loop: loop {
-        while let Some(event) = sdl.poll_events() {
-            match event.expect("SDL poll failed") {
-                // Close events
-                Event::Quit { .. } => break 'game_loop,
-                Event::Keyboard(KeyboardEvent {
-                    key: KeyInfo { keycode: key, .. },
-                    ..
-                }) if key == Keycode::ESCAPE => break 'game_loop,
-
-                // Resize the window
-                Event::Window(WindowEvent {
-                    event: WindowEventEnum::Resized { w, h },
-                    ..
-                }) => pixels.resize(w as u32, h as u32),
-
-                _ => (),
-            }
+        match sdl.poll_events().and_then(Result::ok) {
+            // Close events
+            Some(Event::Quit { .. }) => break 'game_loop,
+            Some(Event::Keyboard(KeyboardEvent {
+                key: KeyInfo { keycode: key, .. },
+                ..
+            })) if key == Keycode::ESCAPE => break 'game_loop,
+
+            // Resize the window
+            Some(Event::Window(WindowEvent {
+                event: WindowEventEnum::Resized { w, h },
+                ..
+            })) => pixels.resize(w as u32, h as u32),
+
+            _ => (),
         }

         // Update internal state

@lovesegfault
Copy link
Contributor Author

@parasyte Patch applied :)

@parasyte
Copy link
Owner

This is great! After merging, I'll followup by moving the examples to individual crates to fix the dependency bloat problem wrt. #62

@parasyte parasyte merged commit 246375f into parasyte:master Apr 13, 2020
@lovesegfault lovesegfault deleted the update-deps branch April 13, 2020 06:21
@parasyte parasyte mentioned this pull request Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants