diff --git a/Cargo.toml b/Cargo.toml index ca1e9d6..bbe3eec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ block = "0.1.6" foreign-types = "0.5" dispatch = { version = "0.2", optional = true } paste = "1" +io-surface = { git = "https://github.com/servo/core-foundation-rs" } [dependencies.objc] version = "0.2.4" diff --git a/src/device.rs b/src/device.rs index 12e43ae..fa62d65 100644 --- a/src/device.rs +++ b/src/device.rs @@ -1542,6 +1542,14 @@ impl Device { } impl DeviceRef { + pub fn architecture_name(&self) -> &str { + unsafe { + let arch: *const NSObject = msg_send![self, architecture]; + let name = msg_send![arch, name]; + crate::nsstring_as_str(name) + } + } + pub fn name(&self) -> &str { unsafe { let name = msg_send![self, name]; @@ -1985,6 +1993,19 @@ impl DeviceRef { unsafe { msg_send![self, newTextureWithDescriptor: descriptor] } } + pub fn new_texture_with_descriptor_and_iosurface( + &self, + descriptor: &TextureDescriptorRef, + iosurface: io_surface::IOSurfaceRef, + plane: NSUInteger, + ) -> Texture { + unsafe { + msg_send![self, newTextureWithDescriptor:descriptor + iosurface:iosurface + plane:plane] + } + } + pub fn new_sampler(&self, descriptor: &SamplerDescriptorRef) -> SamplerState { unsafe { msg_send![self, newSamplerStateWithDescriptor: descriptor] } }