From d4ef083dbb6256dc6f32bc71e33547cf03b4c265 Mon Sep 17 00:00:00 2001 From: Joshua Groves Date: Tue, 11 Jun 2019 20:52:09 -0400 Subject: [PATCH] Add native surface creation --- src/lib.rs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f48ceb9ac7..562d113991 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -502,10 +502,29 @@ impl Instance { } } - #[cfg(feature = "metal")] - pub fn create_surface_with_metal_layer(&self, window: *mut std::ffi::c_void) -> Surface { + pub fn create_surface_from_xlib( + &self, + display: *mut *const std::ffi::c_void, + window: u64, + ) -> Surface { Surface { - id: wgn::wgpu_instance_create_surface_from_macos_layer(self.id, window), + id: wgn::wgpu_instance_create_surface_from_xlib(self.id, display, window), + } + } + + pub fn create_surface_from_macos_layer(&self, layer: *mut std::ffi::c_void) -> Surface { + Surface { + id: wgn::wgpu_instance_create_surface_from_macos_layer(self.id, layer), + } + } + + pub fn create_surface_from_windows_hwnd( + &self, + hinstance: *mut std::ffi::c_void, + hwnd: *mut std::ffi::c_void, + ) -> Surface { + Surface { + id: wgn::wgpu_instance_create_surface_from_windows_hwnd(self.id, hinstance, hwnd), } } }