mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
Merge #70
70: Allow creating a surface by passing a metal layer. r=kvark a=seivan 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); ``` For now, Metal only - but could be useful in the future if there was a trait or a facade to use for setting up a surface. The intention is to support other window backends without depending on them directly as a dependency. Co-authored-by: Seivan Heidari <seivan.heidari@icloud.com>
This commit is contained in:
commit
917626c0ec
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user