From e039b70cbb3b6297ea29dc878804a89ba296fc9e Mon Sep 17 00:00:00 2001 From: Joshua Groves Date: Tue, 11 Jun 2019 20:52:09 -0400 Subject: [PATCH] [rs] Add native surface creation --- wgpu/src/lib.rs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index f48ceb9ac7..562d113991 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/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), } } }