objc2_metal/generated/
MTLDepthStencil.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 MTLCompareFunction(pub NSUInteger);
15impl MTLCompareFunction {
16 #[doc(alias = "MTLCompareFunctionNever")]
17 pub const Never: Self = Self(0);
18 #[doc(alias = "MTLCompareFunctionLess")]
19 pub const Less: Self = Self(1);
20 #[doc(alias = "MTLCompareFunctionEqual")]
21 pub const Equal: Self = Self(2);
22 #[doc(alias = "MTLCompareFunctionLessEqual")]
23 pub const LessEqual: Self = Self(3);
24 #[doc(alias = "MTLCompareFunctionGreater")]
25 pub const Greater: Self = Self(4);
26 #[doc(alias = "MTLCompareFunctionNotEqual")]
27 pub const NotEqual: Self = Self(5);
28 #[doc(alias = "MTLCompareFunctionGreaterEqual")]
29 pub const GreaterEqual: Self = Self(6);
30 #[doc(alias = "MTLCompareFunctionAlways")]
31 pub const Always: Self = Self(7);
32}
33
34unsafe impl Encode for MTLCompareFunction {
35 const ENCODING: Encoding = NSUInteger::ENCODING;
36}
37
38unsafe impl RefEncode for MTLCompareFunction {
39 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
40}
41
42#[repr(transparent)]
45#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
46pub struct MTLStencilOperation(pub NSUInteger);
47impl MTLStencilOperation {
48 #[doc(alias = "MTLStencilOperationKeep")]
49 pub const Keep: Self = Self(0);
50 #[doc(alias = "MTLStencilOperationZero")]
51 pub const Zero: Self = Self(1);
52 #[doc(alias = "MTLStencilOperationReplace")]
53 pub const Replace: Self = Self(2);
54 #[doc(alias = "MTLStencilOperationIncrementClamp")]
55 pub const IncrementClamp: Self = Self(3);
56 #[doc(alias = "MTLStencilOperationDecrementClamp")]
57 pub const DecrementClamp: Self = Self(4);
58 #[doc(alias = "MTLStencilOperationInvert")]
59 pub const Invert: Self = Self(5);
60 #[doc(alias = "MTLStencilOperationIncrementWrap")]
61 pub const IncrementWrap: Self = Self(6);
62 #[doc(alias = "MTLStencilOperationDecrementWrap")]
63 pub const DecrementWrap: Self = Self(7);
64}
65
66unsafe impl Encode for MTLStencilOperation {
67 const ENCODING: Encoding = NSUInteger::ENCODING;
68}
69
70unsafe impl RefEncode for MTLStencilOperation {
71 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
72}
73
74extern_class!(
75 #[unsafe(super(NSObject))]
77 #[derive(Debug, PartialEq, Eq, Hash)]
78 pub struct MTLStencilDescriptor;
79);
80
81extern_conformance!(
82 unsafe impl NSCopying for MTLStencilDescriptor {}
83);
84
85unsafe impl CopyingHelper for MTLStencilDescriptor {
86 type Result = Self;
87}
88
89extern_conformance!(
90 unsafe impl NSObjectProtocol for MTLStencilDescriptor {}
91);
92
93impl MTLStencilDescriptor {
94 extern_methods!(
95 #[unsafe(method(stencilCompareFunction))]
96 #[unsafe(method_family = none)]
97 pub fn stencilCompareFunction(&self) -> MTLCompareFunction;
98
99 #[unsafe(method(setStencilCompareFunction:))]
101 #[unsafe(method_family = none)]
102 pub fn setStencilCompareFunction(&self, stencil_compare_function: MTLCompareFunction);
103
104 #[unsafe(method(stencilFailureOperation))]
106 #[unsafe(method_family = none)]
107 pub fn stencilFailureOperation(&self) -> MTLStencilOperation;
108
109 #[unsafe(method(setStencilFailureOperation:))]
111 #[unsafe(method_family = none)]
112 pub fn setStencilFailureOperation(&self, stencil_failure_operation: MTLStencilOperation);
113
114 #[unsafe(method(depthFailureOperation))]
116 #[unsafe(method_family = none)]
117 pub fn depthFailureOperation(&self) -> MTLStencilOperation;
118
119 #[unsafe(method(setDepthFailureOperation:))]
121 #[unsafe(method_family = none)]
122 pub fn setDepthFailureOperation(&self, depth_failure_operation: MTLStencilOperation);
123
124 #[unsafe(method(depthStencilPassOperation))]
126 #[unsafe(method_family = none)]
127 pub fn depthStencilPassOperation(&self) -> MTLStencilOperation;
128
129 #[unsafe(method(setDepthStencilPassOperation:))]
131 #[unsafe(method_family = none)]
132 pub fn setDepthStencilPassOperation(
133 &self,
134 depth_stencil_pass_operation: MTLStencilOperation,
135 );
136
137 #[unsafe(method(readMask))]
138 #[unsafe(method_family = none)]
139 pub fn readMask(&self) -> u32;
140
141 #[unsafe(method(setReadMask:))]
143 #[unsafe(method_family = none)]
144 pub fn setReadMask(&self, read_mask: u32);
145
146 #[unsafe(method(writeMask))]
147 #[unsafe(method_family = none)]
148 pub fn writeMask(&self) -> u32;
149
150 #[unsafe(method(setWriteMask:))]
152 #[unsafe(method_family = none)]
153 pub fn setWriteMask(&self, write_mask: u32);
154 );
155}
156
157impl MTLStencilDescriptor {
159 extern_methods!(
160 #[unsafe(method(init))]
161 #[unsafe(method_family = init)]
162 pub fn init(this: Allocated<Self>) -> Retained<Self>;
163
164 #[unsafe(method(new))]
165 #[unsafe(method_family = new)]
166 pub fn new() -> Retained<Self>;
167 );
168}
169
170impl DefaultRetained for MTLStencilDescriptor {
171 #[inline]
172 fn default_retained() -> Retained<Self> {
173 Self::new()
174 }
175}
176
177extern_class!(
178 #[unsafe(super(NSObject))]
180 #[derive(Debug, PartialEq, Eq, Hash)]
181 pub struct MTLDepthStencilDescriptor;
182);
183
184extern_conformance!(
185 unsafe impl NSCopying for MTLDepthStencilDescriptor {}
186);
187
188unsafe impl CopyingHelper for MTLDepthStencilDescriptor {
189 type Result = Self;
190}
191
192extern_conformance!(
193 unsafe impl NSObjectProtocol for MTLDepthStencilDescriptor {}
194);
195
196impl MTLDepthStencilDescriptor {
197 extern_methods!(
198 #[unsafe(method(depthCompareFunction))]
199 #[unsafe(method_family = none)]
200 pub fn depthCompareFunction(&self) -> MTLCompareFunction;
201
202 #[unsafe(method(setDepthCompareFunction:))]
204 #[unsafe(method_family = none)]
205 pub fn setDepthCompareFunction(&self, depth_compare_function: MTLCompareFunction);
206
207 #[unsafe(method(isDepthWriteEnabled))]
208 #[unsafe(method_family = none)]
209 pub fn isDepthWriteEnabled(&self) -> bool;
210
211 #[unsafe(method(setDepthWriteEnabled:))]
213 #[unsafe(method_family = none)]
214 pub fn setDepthWriteEnabled(&self, depth_write_enabled: bool);
215
216 #[unsafe(method(frontFaceStencil))]
217 #[unsafe(method_family = none)]
218 pub fn frontFaceStencil(&self) -> Retained<MTLStencilDescriptor>;
219
220 #[unsafe(method(setFrontFaceStencil:))]
224 #[unsafe(method_family = none)]
225 pub fn setFrontFaceStencil(&self, front_face_stencil: Option<&MTLStencilDescriptor>);
226
227 #[unsafe(method(backFaceStencil))]
228 #[unsafe(method_family = none)]
229 pub fn backFaceStencil(&self) -> Retained<MTLStencilDescriptor>;
230
231 #[unsafe(method(setBackFaceStencil:))]
235 #[unsafe(method_family = none)]
236 pub fn setBackFaceStencil(&self, back_face_stencil: Option<&MTLStencilDescriptor>);
237
238 #[unsafe(method(label))]
240 #[unsafe(method_family = none)]
241 pub fn label(&self) -> Option<Retained<NSString>>;
242
243 #[unsafe(method(setLabel:))]
247 #[unsafe(method_family = none)]
248 pub fn setLabel(&self, label: Option<&NSString>);
249 );
250}
251
252impl MTLDepthStencilDescriptor {
254 extern_methods!(
255 #[unsafe(method(init))]
256 #[unsafe(method_family = init)]
257 pub fn init(this: Allocated<Self>) -> Retained<Self>;
258
259 #[unsafe(method(new))]
260 #[unsafe(method_family = new)]
261 pub fn new() -> Retained<Self>;
262 );
263}
264
265impl DefaultRetained for MTLDepthStencilDescriptor {
266 #[inline]
267 fn default_retained() -> Retained<Self> {
268 Self::new()
269 }
270}
271
272extern_protocol!(
273 pub unsafe trait MTLDepthStencilState: NSObjectProtocol + Send + Sync {
275 #[unsafe(method(label))]
277 #[unsafe(method_family = none)]
278 fn label(&self) -> Option<Retained<NSString>>;
279
280 #[cfg(feature = "MTLDevice")]
281 #[unsafe(method(device))]
283 #[unsafe(method_family = none)]
284 fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
285
286 #[cfg(feature = "MTLTypes")]
287 #[unsafe(method(gpuResourceID))]
289 #[unsafe(method_family = none)]
290 fn gpuResourceID(&self) -> MTLResourceID;
291 }
292);