From bdd72dc94dc5d1b15d75488338646f6f7fe3d3f4 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Thu, 9 Sep 2021 08:35:35 -0400 Subject: [PATCH] Expose Metal surface creation --- wgpu/src/backend/direct.rs | 8 +++++--- wgpu/src/lib.rs | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index 3ed3ca5a5..5ac71e56f 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -131,7 +131,6 @@ impl Context { self.0.generate_report() } - /*TODO: raw surface #[cfg(any(target_os = "ios", target_os = "macos"))] pub unsafe fn create_surface_from_core_animation_layer( self: &Arc, @@ -140,9 +139,12 @@ impl Context { let id = self.0.instance_create_surface_metal(layer, PhantomData); crate::Surface { context: Arc::clone(self), - id, + id: Surface { + id, + configured_device: Mutex::default(), + }, } - }*/ + } fn handle_error( &self, diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 2d829e51c..3d258cd2f 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -1467,7 +1467,6 @@ impl Instance { } } - /*TODO: raw CAL surface /// Creates a surface from `CoreAnimationLayer`. /// /// # Safety @@ -1479,7 +1478,7 @@ impl Instance { layer: *mut std::ffi::c_void, ) -> Surface { self.context.create_surface_from_core_animation_layer(layer) - }*/ + } /// Polls all devices. /// If `force_wait` is true and this is not running on the web,