objc2_metal_performance_shaders/generated/MPSNDArray/
MPSNDArrayQuantization.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct MPSNDArrayQuantizationScheme(pub NSUInteger);
15bitflags::bitflags! {
16 impl MPSNDArrayQuantizationScheme: NSUInteger {
17 #[doc(alias = "MPSNDArrayQuantizationTypeNone")]
18 const TypeNone = 0;
19 #[doc(alias = "MPSNDArrayQuantizationTypeAffine")]
20 const TypeAffine = 1;
21 #[doc(alias = "MPSNDArrayQuantizationTypeLUT")]
22 const TypeLUT = 2;
23 }
24}
25
26unsafe impl Encode for MPSNDArrayQuantizationScheme {
27 const ENCODING: Encoding = NSUInteger::ENCODING;
28}
29
30unsafe impl RefEncode for MPSNDArrayQuantizationScheme {
31 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern_class!(
35 #[unsafe(super(NSObject))]
41 #[derive(Debug, PartialEq, Eq, Hash)]
42 pub struct MPSNDArrayQuantizationDescriptor;
43);
44
45extern_conformance!(
46 unsafe impl NSCopying for MPSNDArrayQuantizationDescriptor {}
47);
48
49unsafe impl CopyingHelper for MPSNDArrayQuantizationDescriptor {
50 type Result = Self;
51}
52
53extern_conformance!(
54 unsafe impl NSObjectProtocol for MPSNDArrayQuantizationDescriptor {}
55);
56
57impl MPSNDArrayQuantizationDescriptor {
58 extern_methods!(
59 #[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
60 #[unsafe(method(quantizationDataType))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn quantizationDataType(&self) -> MPSDataType;
64
65 #[unsafe(method(quantizationScheme))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn quantizationScheme(&self) -> MPSNDArrayQuantizationScheme;
69 );
70}
71
72impl MPSNDArrayQuantizationDescriptor {
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}
84
85extern_class!(
86 #[unsafe(super(MPSNDArrayQuantizationDescriptor, NSObject))]
92 #[derive(Debug, PartialEq, Eq, Hash)]
93 pub struct MPSNDArrayAffineQuantizationDescriptor;
94);
95
96extern_conformance!(
97 unsafe impl NSCopying for MPSNDArrayAffineQuantizationDescriptor {}
98);
99
100unsafe impl CopyingHelper for MPSNDArrayAffineQuantizationDescriptor {
101 type Result = Self;
102}
103
104extern_conformance!(
105 unsafe impl NSObjectProtocol for MPSNDArrayAffineQuantizationDescriptor {}
106);
107
108impl MPSNDArrayAffineQuantizationDescriptor {
109 extern_methods!(
110 #[unsafe(method(hasZeroPoint))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn hasZeroPoint(&self) -> bool;
114
115 #[unsafe(method(setHasZeroPoint:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn setHasZeroPoint(&self, has_zero_point: bool);
119
120 #[unsafe(method(hasMinValue))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn hasMinValue(&self) -> bool;
124
125 #[unsafe(method(setHasMinValue:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn setHasMinValue(&self, has_min_value: bool);
129
130 #[unsafe(method(implicitZeroPoint))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn implicitZeroPoint(&self) -> bool;
139
140 #[unsafe(method(setImplicitZeroPoint:))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn setImplicitZeroPoint(&self, implicit_zero_point: bool);
144
145 #[unsafe(method(init))]
146 #[unsafe(method_family = init)]
147 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
148
149 #[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
150 #[unsafe(method(initWithDataType:hasZeroPoint:hasMinValue:))]
160 #[unsafe(method_family = init)]
161 pub unsafe fn initWithDataType_hasZeroPoint_hasMinValue(
162 this: Allocated<Self>,
163 quantization_data_type: MPSDataType,
164 has_zero_point: bool,
165 has_min_value: bool,
166 ) -> Retained<Self>;
167 );
168}
169
170impl MPSNDArrayAffineQuantizationDescriptor {
172 extern_methods!(
173 #[unsafe(method(new))]
174 #[unsafe(method_family = new)]
175 pub unsafe fn new() -> Retained<Self>;
176 );
177}
178
179extern_class!(
180 #[unsafe(super(MPSNDArrayQuantizationDescriptor, NSObject))]
186 #[derive(Debug, PartialEq, Eq, Hash)]
187 pub struct MPSNDArrayLUTQuantizationDescriptor;
188);
189
190extern_conformance!(
191 unsafe impl NSCopying for MPSNDArrayLUTQuantizationDescriptor {}
192);
193
194unsafe impl CopyingHelper for MPSNDArrayLUTQuantizationDescriptor {
195 type Result = Self;
196}
197
198extern_conformance!(
199 unsafe impl NSObjectProtocol for MPSNDArrayLUTQuantizationDescriptor {}
200);
201
202impl MPSNDArrayLUTQuantizationDescriptor {
203 extern_methods!(
204 #[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
205 #[unsafe(method(initWithDataType:))]
211 #[unsafe(method_family = init)]
212 pub unsafe fn initWithDataType(
213 this: Allocated<Self>,
214 quantization_data_type: MPSDataType,
215 ) -> Retained<Self>;
216
217 #[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
218 #[unsafe(method(initWithDataType:vectorAxis:))]
226 #[unsafe(method_family = init)]
227 pub unsafe fn initWithDataType_vectorAxis(
228 this: Allocated<Self>,
229 quantization_data_type: MPSDataType,
230 vector_axis: NSUInteger,
231 ) -> Retained<Self>;
232 );
233}
234
235impl MPSNDArrayLUTQuantizationDescriptor {
237 extern_methods!(
238 #[unsafe(method(init))]
239 #[unsafe(method_family = init)]
240 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
241
242 #[unsafe(method(new))]
243 #[unsafe(method_family = new)]
244 pub unsafe fn new() -> Retained<Self>;
245 );
246}