gfx-rs / wgpu-rs

Rust bindings to wgpu native library
https://wgpu.rs
Mozilla Public License 2.0
1.68k stars 186 forks source link

Please add support for the new `raw-window-handle` crate #64

Closed Lokathor closed 5 years ago

Lokathor commented 5 years ago

Recently the gamedev-wg has been trying to make it easier for windowing libs and graphical libs to agree on a protocol for communication. This has resulted in the raw-window-handle crate, where the window offers up its OS window handle thingy to the graphical lib upon request and then the graphical lib is able to do its startup.

It seems like wgpu is mostly going through wgn and that's going through the gfx-backend stuff at the moment, that issue here would be a natural first step towards using raw-window-handle with this crate.

Tracking issue where this crate was discussed and crated if you have any questions: https://github.com/rust-gamedev/wg/issues/26

seivan commented 5 years ago

Maybe I'm missing something, but isn't most of them unimplemented for now? https://github.com/rust-windowing/raw-window-handle/blob/master/src/ios.rs

Edit: Oh I see, it's like a Facade for actual window makers, like Winit or SDL2. They fill in the missing pointers, and pass the enum to wgpu. Cool!

Lokathor commented 5 years ago

Yes.

the idea is (to use the gfx-hal terms since i don't know the wpgu terms), you'd have the end user be able to write

let surface = instance::create_surface(&window);

and all the stuff would be nearly as it is now, but wgpu wouldn't depend on winit::Window, it'd depend on impl raw_window_handle::HasRawWindowHandle.

kvark commented 5 years ago

Fixed in #70