1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_protocol!(
10 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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 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 #[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 #[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 #[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);