Allow creating a surface by passing a metal layer.

This is useful if you're using `SDL2`
```rust
    let canvas = window.into_canvas().build().unwrap();
    let metal_layer = unsafe { sdl2::sys::SDL_RenderGetMetalLayer(canvas.raw()) }; 
    let surface = instance.create_surface_with_metal_layer(metal_layer);
```
This commit is contained in:
Seivan Heidari 2019-02-21 21:30:41 +01:00 committed by GitHub
parent fef27e46d3
commit d63d367ec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -242,6 +242,13 @@ impl Instance {
id: wgn::wgpu_instance_create_surface_from_winit(self.id, window),
}
}
#[cfg(feature = "metal")]
pub fn create_surface_with_metal_layer(&self, window: *mut std::ffi::c_void) -> Surface {
Surface {
id: wgn::wgpu_instance_create_surface_from_macos_layer(self.id, window),
}
}
}
impl Adapter {