objc2_metal/generated/
MTLIndirectCommandEncoder.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_protocol!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlindirectrendercommand?language=objc)
11    pub unsafe trait MTLIndirectRenderCommand: NSObjectProtocol {
12        #[cfg(all(feature = "MTLAllocation", feature = "MTLRenderPipeline"))]
13        #[unsafe(method(setRenderPipelineState:))]
14        #[unsafe(method_family = none)]
15        fn setRenderPipelineState(
16            &self,
17            pipeline_state: &ProtocolObject<dyn MTLRenderPipelineState>,
18        );
19
20        #[cfg(all(
21            feature = "MTLAllocation",
22            feature = "MTLBuffer",
23            feature = "MTLResource"
24        ))]
25        /// # Safety
26        ///
27        /// - `buffer` may need to be synchronized.
28        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
29        /// - `buffer` contents should be of the correct type.
30        /// - `offset` might not be bounds-checked.
31        /// - `index` might not be bounds-checked.
32        #[unsafe(method(setVertexBuffer:offset:atIndex:))]
33        #[unsafe(method_family = none)]
34        unsafe fn setVertexBuffer_offset_atIndex(
35            &self,
36            buffer: &ProtocolObject<dyn MTLBuffer>,
37            offset: NSUInteger,
38            index: NSUInteger,
39        );
40
41        #[cfg(all(
42            feature = "MTLAllocation",
43            feature = "MTLBuffer",
44            feature = "MTLResource"
45        ))]
46        /// # Safety
47        ///
48        /// - `buffer` may need to be synchronized.
49        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
50        /// - `buffer` contents should be of the correct type.
51        /// - `offset` might not be bounds-checked.
52        /// - `index` might not be bounds-checked.
53        #[unsafe(method(setFragmentBuffer:offset:atIndex:))]
54        #[unsafe(method_family = none)]
55        unsafe fn setFragmentBuffer_offset_atIndex(
56            &self,
57            buffer: &ProtocolObject<dyn MTLBuffer>,
58            offset: NSUInteger,
59            index: NSUInteger,
60        );
61
62        #[cfg(all(
63            feature = "MTLAllocation",
64            feature = "MTLBuffer",
65            feature = "MTLResource"
66        ))]
67        /// sets vertex buffer at specified index with provided offset and stride.
68        /// only call this when the buffer-index is part of the vertexDescriptor and
69        /// has set its stride to `MTLBufferLayoutStrideDynamic`
70        ///
71        /// # Safety
72        ///
73        /// - `buffer` may need to be synchronized.
74        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
75        /// - `buffer` contents should be of the correct type.
76        /// - `offset` might not be bounds-checked.
77        /// - `stride` might not be bounds-checked.
78        /// - `index` might not be bounds-checked.
79        #[unsafe(method(setVertexBuffer:offset:attributeStride:atIndex:))]
80        #[unsafe(method_family = none)]
81        unsafe fn setVertexBuffer_offset_attributeStride_atIndex(
82            &self,
83            buffer: &ProtocolObject<dyn MTLBuffer>,
84            offset: NSUInteger,
85            stride: NSUInteger,
86            index: NSUInteger,
87        );
88
89        #[cfg(all(
90            feature = "MTLAllocation",
91            feature = "MTLBuffer",
92            feature = "MTLResource"
93        ))]
94        /// # Safety
95        ///
96        /// - `patchCount` might not be bounds-checked.
97        /// - `patch_index_buffer` may need to be synchronized.
98        /// - `patch_index_buffer` may be unretained, you must ensure it is kept alive while in use.
99        /// - `patch_index_buffer` contents should be of the correct type.
100        /// - `patchIndexBufferOffset` might not be bounds-checked.
101        /// - `instanceCount` might not be bounds-checked.
102        /// - `buffer` may need to be synchronized.
103        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
104        /// - `buffer` contents should be of the correct type.
105        /// - `offset` might not be bounds-checked.
106        /// - `instanceStride` might not be bounds-checked.
107        #[unsafe(method(drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:))]
108        #[unsafe(method_family = none)]
109        unsafe fn drawPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride(
110            &self,
111            number_of_patch_control_points: NSUInteger,
112            patch_start: NSUInteger,
113            patch_count: NSUInteger,
114            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
115            patch_index_buffer_offset: NSUInteger,
116            instance_count: NSUInteger,
117            base_instance: NSUInteger,
118            buffer: &ProtocolObject<dyn MTLBuffer>,
119            offset: NSUInteger,
120            instance_stride: NSUInteger,
121        );
122
123        #[cfg(all(
124            feature = "MTLAllocation",
125            feature = "MTLBuffer",
126            feature = "MTLResource"
127        ))]
128        /// # Safety
129        ///
130        /// - `patchCount` might not be bounds-checked.
131        /// - `patch_index_buffer` may need to be synchronized.
132        /// - `patch_index_buffer` may be unretained, you must ensure it is kept alive while in use.
133        /// - `patch_index_buffer` contents should be of the correct type.
134        /// - `patchIndexBufferOffset` might not be bounds-checked.
135        /// - `control_point_index_buffer` may need to be synchronized.
136        /// - `control_point_index_buffer` may be unretained, you must ensure it is kept alive while in use.
137        /// - `control_point_index_buffer` contents should be of the correct type.
138        /// - `controlPointIndexBufferOffset` might not be bounds-checked.
139        /// - `instanceCount` might not be bounds-checked.
140        /// - `buffer` may need to be synchronized.
141        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
142        /// - `buffer` contents should be of the correct type.
143        /// - `offset` might not be bounds-checked.
144        /// - `instanceStride` might not be bounds-checked.
145        #[unsafe(method(drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:))]
146        #[unsafe(method_family = none)]
147        unsafe fn drawIndexedPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_controlPointIndexBuffer_controlPointIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride(
148            &self,
149            number_of_patch_control_points: NSUInteger,
150            patch_start: NSUInteger,
151            patch_count: NSUInteger,
152            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
153            patch_index_buffer_offset: NSUInteger,
154            control_point_index_buffer: &ProtocolObject<dyn MTLBuffer>,
155            control_point_index_buffer_offset: NSUInteger,
156            instance_count: NSUInteger,
157            base_instance: NSUInteger,
158            buffer: &ProtocolObject<dyn MTLBuffer>,
159            offset: NSUInteger,
160            instance_stride: NSUInteger,
161        );
162
163        #[cfg(feature = "MTLRenderCommandEncoder")]
164        /// # Safety
165        ///
166        /// - `vertexCount` might not be bounds-checked.
167        /// - `instanceCount` might not be bounds-checked.
168        #[unsafe(method(drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:))]
169        #[unsafe(method_family = none)]
170        unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance(
171            &self,
172            primitive_type: MTLPrimitiveType,
173            vertex_start: NSUInteger,
174            vertex_count: NSUInteger,
175            instance_count: NSUInteger,
176            base_instance: NSUInteger,
177        );
178
179        #[cfg(all(
180            feature = "MTLAllocation",
181            feature = "MTLArgument",
182            feature = "MTLBuffer",
183            feature = "MTLRenderCommandEncoder",
184            feature = "MTLResource"
185        ))]
186        /// # Safety
187        ///
188        /// - `indexCount` might not be bounds-checked.
189        /// - `index_buffer` may need to be synchronized.
190        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
191        /// - `index_buffer` contents should be of the correct type.
192        /// - `indexBufferOffset` might not be bounds-checked.
193        /// - `instanceCount` might not be bounds-checked.
194        #[unsafe(method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:))]
195        #[unsafe(method_family = none)]
196        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset_instanceCount_baseVertex_baseInstance(
197            &self,
198            primitive_type: MTLPrimitiveType,
199            index_count: NSUInteger,
200            index_type: MTLIndexType,
201            index_buffer: &ProtocolObject<dyn MTLBuffer>,
202            index_buffer_offset: NSUInteger,
203            instance_count: NSUInteger,
204            base_vertex: NSInteger,
205            base_instance: NSUInteger,
206        );
207
208        /// # Safety
209        ///
210        /// `index` might not be bounds-checked.
211        #[unsafe(method(setObjectThreadgroupMemoryLength:atIndex:))]
212        #[unsafe(method_family = none)]
213        unsafe fn setObjectThreadgroupMemoryLength_atIndex(
214            &self,
215            length: NSUInteger,
216            index: NSUInteger,
217        );
218
219        #[cfg(all(
220            feature = "MTLAllocation",
221            feature = "MTLBuffer",
222            feature = "MTLResource"
223        ))]
224        /// # Safety
225        ///
226        /// - `buffer` may need to be synchronized.
227        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
228        /// - `buffer` contents should be of the correct type.
229        /// - `offset` might not be bounds-checked.
230        /// - `index` might not be bounds-checked.
231        #[unsafe(method(setObjectBuffer:offset:atIndex:))]
232        #[unsafe(method_family = none)]
233        unsafe fn setObjectBuffer_offset_atIndex(
234            &self,
235            buffer: &ProtocolObject<dyn MTLBuffer>,
236            offset: NSUInteger,
237            index: NSUInteger,
238        );
239
240        #[cfg(all(
241            feature = "MTLAllocation",
242            feature = "MTLBuffer",
243            feature = "MTLResource"
244        ))]
245        /// # Safety
246        ///
247        /// - `buffer` may need to be synchronized.
248        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
249        /// - `buffer` contents should be of the correct type.
250        /// - `offset` might not be bounds-checked.
251        /// - `index` might not be bounds-checked.
252        #[unsafe(method(setMeshBuffer:offset:atIndex:))]
253        #[unsafe(method_family = none)]
254        unsafe fn setMeshBuffer_offset_atIndex(
255            &self,
256            buffer: &ProtocolObject<dyn MTLBuffer>,
257            offset: NSUInteger,
258            index: NSUInteger,
259        );
260
261        #[cfg(feature = "MTLTypes")]
262        #[unsafe(method(drawMeshThreadgroups:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
263        #[unsafe(method_family = none)]
264        fn drawMeshThreadgroups_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
265            &self,
266            threadgroups_per_grid: MTLSize,
267            threads_per_object_threadgroup: MTLSize,
268            threads_per_mesh_threadgroup: MTLSize,
269        );
270
271        #[cfg(feature = "MTLTypes")]
272        #[unsafe(method(drawMeshThreads:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
273        #[unsafe(method_family = none)]
274        fn drawMeshThreads_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
275            &self,
276            threads_per_grid: MTLSize,
277            threads_per_object_threadgroup: MTLSize,
278            threads_per_mesh_threadgroup: MTLSize,
279        );
280
281        #[unsafe(method(setBarrier))]
282        #[unsafe(method_family = none)]
283        fn setBarrier(&self);
284
285        #[unsafe(method(clearBarrier))]
286        #[unsafe(method_family = none)]
287        fn clearBarrier(&self);
288
289        #[cfg(feature = "MTLDepthStencil")]
290        #[unsafe(method(setDepthStencilState:))]
291        #[unsafe(method_family = none)]
292        fn setDepthStencilState(
293            &self,
294            depth_stencil_state: Option<&ProtocolObject<dyn MTLDepthStencilState>>,
295        );
296
297        #[unsafe(method(setDepthBias:slopeScale:clamp:))]
298        #[unsafe(method_family = none)]
299        fn setDepthBias_slopeScale_clamp(
300            &self,
301            depth_bias: c_float,
302            slope_scale: c_float,
303            clamp: c_float,
304        );
305
306        #[cfg(feature = "MTLRenderCommandEncoder")]
307        #[unsafe(method(setDepthClipMode:))]
308        #[unsafe(method_family = none)]
309        fn setDepthClipMode(&self, depth_clip_mode: MTLDepthClipMode);
310
311        #[cfg(feature = "MTLRenderCommandEncoder")]
312        #[unsafe(method(setCullMode:))]
313        #[unsafe(method_family = none)]
314        fn setCullMode(&self, cull_mode: MTLCullMode);
315
316        #[cfg(feature = "MTLRenderCommandEncoder")]
317        #[unsafe(method(setFrontFacingWinding:))]
318        #[unsafe(method_family = none)]
319        fn setFrontFacingWinding(&self, front_facing_windning: MTLWinding);
320
321        #[cfg(feature = "MTLRenderCommandEncoder")]
322        #[unsafe(method(setTriangleFillMode:))]
323        #[unsafe(method_family = none)]
324        fn setTriangleFillMode(&self, fill_mode: MTLTriangleFillMode);
325
326        #[unsafe(method(reset))]
327        #[unsafe(method_family = none)]
328        fn reset(&self);
329    }
330);
331
332extern_protocol!(
333    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlindirectcomputecommand?language=objc)
334    pub unsafe trait MTLIndirectComputeCommand: NSObjectProtocol {
335        #[cfg(all(feature = "MTLAllocation", feature = "MTLComputePipeline"))]
336        #[unsafe(method(setComputePipelineState:))]
337        #[unsafe(method_family = none)]
338        fn setComputePipelineState(
339            &self,
340            pipeline_state: &ProtocolObject<dyn MTLComputePipelineState>,
341        );
342
343        #[cfg(all(
344            feature = "MTLAllocation",
345            feature = "MTLBuffer",
346            feature = "MTLResource"
347        ))]
348        /// # Safety
349        ///
350        /// - `buffer` may need to be synchronized.
351        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
352        /// - `buffer` contents should be of the correct type.
353        /// - `offset` might not be bounds-checked.
354        /// - `index` might not be bounds-checked.
355        #[unsafe(method(setKernelBuffer:offset:atIndex:))]
356        #[unsafe(method_family = none)]
357        unsafe fn setKernelBuffer_offset_atIndex(
358            &self,
359            buffer: &ProtocolObject<dyn MTLBuffer>,
360            offset: NSUInteger,
361            index: NSUInteger,
362        );
363
364        #[cfg(all(
365            feature = "MTLAllocation",
366            feature = "MTLBuffer",
367            feature = "MTLResource"
368        ))]
369        /// sets kernel buffer at specified index with provided offset and stride.
370        /// only call this when the buffer-index is part of the stageInputDescriptor
371        /// and has set its stride to `MTLBufferLayoutStrideDynamic`
372        ///
373        /// # Safety
374        ///
375        /// - `buffer` may need to be synchronized.
376        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
377        /// - `buffer` contents should be of the correct type.
378        /// - `offset` might not be bounds-checked.
379        /// - `stride` might not be bounds-checked.
380        /// - `index` might not be bounds-checked.
381        #[unsafe(method(setKernelBuffer:offset:attributeStride:atIndex:))]
382        #[unsafe(method_family = none)]
383        unsafe fn setKernelBuffer_offset_attributeStride_atIndex(
384            &self,
385            buffer: &ProtocolObject<dyn MTLBuffer>,
386            offset: NSUInteger,
387            stride: NSUInteger,
388            index: NSUInteger,
389        );
390
391        #[cfg(feature = "MTLTypes")]
392        #[unsafe(method(concurrentDispatchThreadgroups:threadsPerThreadgroup:))]
393        #[unsafe(method_family = none)]
394        fn concurrentDispatchThreadgroups_threadsPerThreadgroup(
395            &self,
396            threadgroups_per_grid: MTLSize,
397            threads_per_threadgroup: MTLSize,
398        );
399
400        #[cfg(feature = "MTLTypes")]
401        #[unsafe(method(concurrentDispatchThreads:threadsPerThreadgroup:))]
402        #[unsafe(method_family = none)]
403        fn concurrentDispatchThreads_threadsPerThreadgroup(
404            &self,
405            threads_per_grid: MTLSize,
406            threads_per_threadgroup: MTLSize,
407        );
408
409        #[unsafe(method(setBarrier))]
410        #[unsafe(method_family = none)]
411        fn setBarrier(&self);
412
413        #[unsafe(method(clearBarrier))]
414        #[unsafe(method_family = none)]
415        fn clearBarrier(&self);
416
417        #[unsafe(method(setImageblockWidth:height:))]
418        #[unsafe(method_family = none)]
419        fn setImageblockWidth_height(&self, width: NSUInteger, height: NSUInteger);
420
421        #[unsafe(method(reset))]
422        #[unsafe(method_family = none)]
423        fn reset(&self);
424
425        /// # Safety
426        ///
427        /// `index` might not be bounds-checked.
428        #[unsafe(method(setThreadgroupMemoryLength:atIndex:))]
429        #[unsafe(method_family = none)]
430        unsafe fn setThreadgroupMemoryLength_atIndex(&self, length: NSUInteger, index: NSUInteger);
431
432        #[cfg(feature = "MTLTypes")]
433        #[unsafe(method(setStageInRegion:))]
434        #[unsafe(method_family = none)]
435        fn setStageInRegion(&self, region: MTLRegion);
436    }
437);