aclysma / skulpin

Skia + Vulkan = Skulpin
Apache License 2.0
395 stars 41 forks source link

Winit 0.28 and skia-safe 0.60.0 #113

Open everdrone opened 1 year ago

everdrone commented 1 year ago

I've been looking forward to using this library as it's extremely useful

Just wanted to know if it's possible to upgrade its dependencies:

Thanks

aclysma commented 1 year ago

I’m not actively using or developing this crate anymore, so it’s unlikely I’m going to find time to do this myself, but it may be as simple as a version bump if you want to try it yourself.

everdrone commented 1 year ago

I tried bumping the versions of both and building with: cargo build --workspace --features=winit-28,winit-app I'm just getting started with Rust but it seems there's a dependency mismatch coming from the included version of rafx implementing a different raw_window_handle

error[E0277]: the trait bound `Window: raw_window_handle::HasRawWindowHandle` is not satisfied
    --> skulpin-app-winit\src\app.rs:234:54
     |
234  |         let renderer_result = renderer_builder.build(&window, window_extents);
     |                                                      ^^^^^^^ the trait `raw_window_handle::HasRawWindowHandle` is not implemented for `Window`
     |
help: trait impl with same name found
    --> C:\Users\Giorgio\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.28.3\src\window.rs:1327:1
     |
1327 | unsafe impl HasRawWindowHandle for Window {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `raw_window_handle` are being used?
     = help: the trait `raw_window_handle::HasRawWindowHandle` is implemented for `&'a T`
     = note: required for `Window` to implement `HasRawWindowHandle`
     = note: required for the cast from `Window` to the object type `dyn HasRawWindowHandle`

Can I ask you for some guidance on how to proceed?

EDIT: commit link

aclysma commented 1 year ago

You're very much on the right track, I'm sorry the project didn't build and run right away.

Personally if you're just wanting to play around, I think the path of least resistance would be to use winit 0.25.

Otherwise, you need to update dependencies like rafx to use raw-window-handle 0.5. This probably won't be difficult, but it may be more than you care to do right now. If such a change were committed to rafx, it might break other things that are downstream from it that I work on/use such as imgui integration. I'm not necessarily rushing into doing that because frankly, I have other things to do than chase winit/raw-window-handle versions. (I have half a mind to transition over to SDL2 because it would probably break less often, and it's shipped in many real products, so IMO it's a more mature solution.)

It might also be possible to use both raw-window-handle 0.5 and 0.3, and copy the values from a 0.5 version of the struct to a 0.3 version of the struct. This would hopefully limit the chain of dependencies that need to be modified to use raw-window-handle 0.5.