objc2_metal_performance_shaders_graph/generated/
MPSGraphDevice.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_metal::*;
6
7use crate::*;
8
9#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct MPSGraphDeviceType(pub u32);
16impl MPSGraphDeviceType {
17 #[doc(alias = "MPSGraphDeviceTypeMetal")]
19 pub const Metal: Self = Self(0);
20}
21
22unsafe impl Encode for MPSGraphDeviceType {
23 const ENCODING: Encoding = u32::ENCODING;
24}
25
26unsafe impl RefEncode for MPSGraphDeviceType {
27 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30extern_class!(
31 #[unsafe(super(MPSGraphObject, NSObject))]
35 #[derive(Debug, PartialEq, Eq, Hash)]
36 #[cfg(feature = "MPSGraphCore")]
37 pub struct MPSGraphDevice;
38);
39
40#[cfg(feature = "MPSGraphCore")]
41extern_conformance!(
42 unsafe impl NSObjectProtocol for MPSGraphDevice {}
43);
44
45#[cfg(feature = "MPSGraphCore")]
46impl MPSGraphDevice {
47 extern_methods!(
48 #[unsafe(method(type))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn r#type(&self) -> MPSGraphDeviceType;
52
53 #[unsafe(method(metalDevice))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn metalDevice(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;
57
58 #[unsafe(method(deviceWithMTLDevice:))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn deviceWithMTLDevice(
66 metal_device: &ProtocolObject<dyn MTLDevice>,
67 ) -> Retained<Self>;
68 );
69}
70
71#[cfg(feature = "MPSGraphCore")]
73impl MPSGraphDevice {
74 extern_methods!(
75 #[unsafe(method(init))]
76 #[unsafe(method_family = init)]
77 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
78
79 #[unsafe(method(new))]
80 #[unsafe(method_family = new)]
81 pub unsafe fn new() -> Retained<Self>;
82 );
83}