objc2_metal/generated/
MTLRenderCommandEncoder.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlprimitivetype?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct MTLPrimitiveType(pub NSUInteger);
15impl MTLPrimitiveType {
16    #[doc(alias = "MTLPrimitiveTypePoint")]
17    pub const Point: Self = Self(0);
18    #[doc(alias = "MTLPrimitiveTypeLine")]
19    pub const Line: Self = Self(1);
20    #[doc(alias = "MTLPrimitiveTypeLineStrip")]
21    pub const LineStrip: Self = Self(2);
22    #[doc(alias = "MTLPrimitiveTypeTriangle")]
23    pub const Triangle: Self = Self(3);
24    #[doc(alias = "MTLPrimitiveTypeTriangleStrip")]
25    pub const TriangleStrip: Self = Self(4);
26}
27
28unsafe impl Encode for MTLPrimitiveType {
29    const ENCODING: Encoding = NSUInteger::ENCODING;
30}
31
32unsafe impl RefEncode for MTLPrimitiveType {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlvisibilityresultmode?language=objc)
37// NS_ENUM
38#[repr(transparent)]
39#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
40pub struct MTLVisibilityResultMode(pub NSUInteger);
41impl MTLVisibilityResultMode {
42    #[doc(alias = "MTLVisibilityResultModeDisabled")]
43    pub const Disabled: Self = Self(0);
44    #[doc(alias = "MTLVisibilityResultModeBoolean")]
45    pub const Boolean: Self = Self(1);
46    #[doc(alias = "MTLVisibilityResultModeCounting")]
47    pub const Counting: Self = Self(2);
48}
49
50unsafe impl Encode for MTLVisibilityResultMode {
51    const ENCODING: Encoding = NSUInteger::ENCODING;
52}
53
54unsafe impl RefEncode for MTLVisibilityResultMode {
55    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlscissorrect?language=objc)
59#[repr(C)]
60#[derive(Clone, Copy, Debug, PartialEq)]
61pub struct MTLScissorRect {
62    pub x: NSUInteger,
63    pub y: NSUInteger,
64    pub width: NSUInteger,
65    pub height: NSUInteger,
66}
67
68unsafe impl Encode for MTLScissorRect {
69    const ENCODING: Encoding = Encoding::Struct(
70        "?",
71        &[
72            <NSUInteger>::ENCODING,
73            <NSUInteger>::ENCODING,
74            <NSUInteger>::ENCODING,
75            <NSUInteger>::ENCODING,
76        ],
77    );
78}
79
80unsafe impl RefEncode for MTLScissorRect {
81    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
82}
83
84/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlviewport?language=objc)
85#[repr(C)]
86#[derive(Clone, Copy, Debug, PartialEq)]
87pub struct MTLViewport {
88    pub originX: c_double,
89    pub originY: c_double,
90    pub width: c_double,
91    pub height: c_double,
92    pub znear: c_double,
93    pub zfar: c_double,
94}
95
96unsafe impl Encode for MTLViewport {
97    const ENCODING: Encoding = Encoding::Struct(
98        "?",
99        &[
100            <c_double>::ENCODING,
101            <c_double>::ENCODING,
102            <c_double>::ENCODING,
103            <c_double>::ENCODING,
104            <c_double>::ENCODING,
105            <c_double>::ENCODING,
106        ],
107    );
108}
109
110unsafe impl RefEncode for MTLViewport {
111    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
112}
113
114/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcullmode?language=objc)
115// NS_ENUM
116#[repr(transparent)]
117#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
118pub struct MTLCullMode(pub NSUInteger);
119impl MTLCullMode {
120    #[doc(alias = "MTLCullModeNone")]
121    pub const None: Self = Self(0);
122    #[doc(alias = "MTLCullModeFront")]
123    pub const Front: Self = Self(1);
124    #[doc(alias = "MTLCullModeBack")]
125    pub const Back: Self = Self(2);
126}
127
128unsafe impl Encode for MTLCullMode {
129    const ENCODING: Encoding = NSUInteger::ENCODING;
130}
131
132unsafe impl RefEncode for MTLCullMode {
133    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
134}
135
136/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlwinding?language=objc)
137// NS_ENUM
138#[repr(transparent)]
139#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
140pub struct MTLWinding(pub NSUInteger);
141impl MTLWinding {
142    #[doc(alias = "MTLWindingClockwise")]
143    pub const Clockwise: Self = Self(0);
144    #[doc(alias = "MTLWindingCounterClockwise")]
145    pub const CounterClockwise: Self = Self(1);
146}
147
148unsafe impl Encode for MTLWinding {
149    const ENCODING: Encoding = NSUInteger::ENCODING;
150}
151
152unsafe impl RefEncode for MTLWinding {
153    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
154}
155
156/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtldepthclipmode?language=objc)
157// NS_ENUM
158#[repr(transparent)]
159#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
160pub struct MTLDepthClipMode(pub NSUInteger);
161impl MTLDepthClipMode {
162    #[doc(alias = "MTLDepthClipModeClip")]
163    pub const Clip: Self = Self(0);
164    #[doc(alias = "MTLDepthClipModeClamp")]
165    pub const Clamp: Self = Self(1);
166}
167
168unsafe impl Encode for MTLDepthClipMode {
169    const ENCODING: Encoding = NSUInteger::ENCODING;
170}
171
172unsafe impl RefEncode for MTLDepthClipMode {
173    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
174}
175
176/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltrianglefillmode?language=objc)
177// NS_ENUM
178#[repr(transparent)]
179#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
180pub struct MTLTriangleFillMode(pub NSUInteger);
181impl MTLTriangleFillMode {
182    #[doc(alias = "MTLTriangleFillModeFill")]
183    pub const Fill: Self = Self(0);
184    #[doc(alias = "MTLTriangleFillModeLines")]
185    pub const Lines: Self = Self(1);
186}
187
188unsafe impl Encode for MTLTriangleFillMode {
189    const ENCODING: Encoding = NSUInteger::ENCODING;
190}
191
192unsafe impl RefEncode for MTLTriangleFillMode {
193    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
194}
195
196/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtldrawprimitivesindirectarguments?language=objc)
197#[repr(C)]
198#[derive(Clone, Copy, Debug, PartialEq)]
199pub struct MTLDrawPrimitivesIndirectArguments {
200    pub vertexCount: u32,
201    pub instanceCount: u32,
202    pub vertexStart: u32,
203    pub baseInstance: u32,
204}
205
206unsafe impl Encode for MTLDrawPrimitivesIndirectArguments {
207    const ENCODING: Encoding = Encoding::Struct(
208        "?",
209        &[
210            <u32>::ENCODING,
211            <u32>::ENCODING,
212            <u32>::ENCODING,
213            <u32>::ENCODING,
214        ],
215    );
216}
217
218unsafe impl RefEncode for MTLDrawPrimitivesIndirectArguments {
219    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
220}
221
222/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtldrawindexedprimitivesindirectarguments?language=objc)
223#[repr(C)]
224#[derive(Clone, Copy, Debug, PartialEq)]
225pub struct MTLDrawIndexedPrimitivesIndirectArguments {
226    pub indexCount: u32,
227    pub instanceCount: u32,
228    pub indexStart: u32,
229    pub baseVertex: i32,
230    pub baseInstance: u32,
231}
232
233unsafe impl Encode for MTLDrawIndexedPrimitivesIndirectArguments {
234    const ENCODING: Encoding = Encoding::Struct(
235        "?",
236        &[
237            <u32>::ENCODING,
238            <u32>::ENCODING,
239            <u32>::ENCODING,
240            <i32>::ENCODING,
241            <u32>::ENCODING,
242        ],
243    );
244}
245
246unsafe impl RefEncode for MTLDrawIndexedPrimitivesIndirectArguments {
247    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
248}
249
250/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlvertexamplificationviewmapping?language=objc)
251#[repr(C)]
252#[derive(Clone, Copy, Debug, PartialEq)]
253pub struct MTLVertexAmplificationViewMapping {
254    pub viewportArrayIndexOffset: u32,
255    pub renderTargetArrayIndexOffset: u32,
256}
257
258unsafe impl Encode for MTLVertexAmplificationViewMapping {
259    const ENCODING: Encoding = Encoding::Struct("?", &[<u32>::ENCODING, <u32>::ENCODING]);
260}
261
262unsafe impl RefEncode for MTLVertexAmplificationViewMapping {
263    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
264}
265
266/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtldrawpatchindirectarguments?language=objc)
267#[repr(C)]
268#[derive(Clone, Copy, Debug, PartialEq)]
269pub struct MTLDrawPatchIndirectArguments {
270    pub patchCount: u32,
271    pub instanceCount: u32,
272    pub patchStart: u32,
273    pub baseInstance: u32,
274}
275
276unsafe impl Encode for MTLDrawPatchIndirectArguments {
277    const ENCODING: Encoding = Encoding::Struct(
278        "?",
279        &[
280            <u32>::ENCODING,
281            <u32>::ENCODING,
282            <u32>::ENCODING,
283            <u32>::ENCODING,
284        ],
285    );
286}
287
288unsafe impl RefEncode for MTLDrawPatchIndirectArguments {
289    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
290}
291
292/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlquadtessellationfactorshalf?language=objc)
293#[repr(C)]
294#[derive(Clone, Copy, Debug, PartialEq)]
295pub struct MTLQuadTessellationFactorsHalf {
296    pub edgeTessellationFactor: [u16; 4],
297    pub insideTessellationFactor: [u16; 2],
298}
299
300unsafe impl Encode for MTLQuadTessellationFactorsHalf {
301    const ENCODING: Encoding = Encoding::Struct("?", &[<[u16; 4]>::ENCODING, <[u16; 2]>::ENCODING]);
302}
303
304unsafe impl RefEncode for MTLQuadTessellationFactorsHalf {
305    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
306}
307
308/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltriangletessellationfactorshalf?language=objc)
309#[repr(C)]
310#[derive(Clone, Copy, Debug, PartialEq)]
311pub struct MTLTriangleTessellationFactorsHalf {
312    pub edgeTessellationFactor: [u16; 3],
313    pub insideTessellationFactor: u16,
314}
315
316unsafe impl Encode for MTLTriangleTessellationFactorsHalf {
317    const ENCODING: Encoding = Encoding::Struct("?", &[<[u16; 3]>::ENCODING, <u16>::ENCODING]);
318}
319
320unsafe impl RefEncode for MTLTriangleTessellationFactorsHalf {
321    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
322}
323
324/// Generic render stage enum
325///
326/// Can also be used for points at which a fence may be waited on or signaled.
327///
328/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlrenderstages?language=objc)
329// NS_OPTIONS
330#[repr(transparent)]
331#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
332pub struct MTLRenderStages(pub NSUInteger);
333bitflags::bitflags! {
334    impl MTLRenderStages: NSUInteger {
335        #[doc(alias = "MTLRenderStageVertex")]
336        const Vertex = 1<<0;
337        #[doc(alias = "MTLRenderStageFragment")]
338        const Fragment = 1<<1;
339        #[doc(alias = "MTLRenderStageTile")]
340        const Tile = 1<<2;
341        #[doc(alias = "MTLRenderStageObject")]
342        const Object = 1<<3;
343        #[doc(alias = "MTLRenderStageMesh")]
344        const Mesh = 1<<4;
345    }
346}
347
348unsafe impl Encode for MTLRenderStages {
349    const ENCODING: Encoding = NSUInteger::ENCODING;
350}
351
352unsafe impl RefEncode for MTLRenderStages {
353    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
354}
355
356extern_protocol!(
357    /// MTLRenderCommandEncoder is a container for graphics rendering state and the code to translate the state into a command format that the device can execute.
358    ///
359    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlrendercommandencoder?language=objc)
360    #[cfg(feature = "MTLCommandEncoder")]
361    pub unsafe trait MTLRenderCommandEncoder: MTLCommandEncoder {
362        #[cfg(all(feature = "MTLAllocation", feature = "MTLRenderPipeline"))]
363        /// Sets the current render pipeline state object.
364        #[unsafe(method(setRenderPipelineState:))]
365        #[unsafe(method_family = none)]
366        fn setRenderPipelineState(
367            &self,
368            pipeline_state: &ProtocolObject<dyn MTLRenderPipelineState>,
369        );
370
371        /// Set the data (by copy) for a given vertex buffer binding point.  This will remove any existing MTLBuffer from the binding point.
372        ///
373        /// # Safety
374        ///
375        /// - `bytes` must be a valid pointer.
376        /// - `index` might not be bounds-checked.
377        #[unsafe(method(setVertexBytes:length:atIndex:))]
378        #[unsafe(method_family = none)]
379        unsafe fn setVertexBytes_length_atIndex(
380            &self,
381            bytes: NonNull<c_void>,
382            length: NSUInteger,
383            index: NSUInteger,
384        );
385
386        #[cfg(all(
387            feature = "MTLAllocation",
388            feature = "MTLBuffer",
389            feature = "MTLResource"
390        ))]
391        /// Set a global buffer for all vertex shaders at the given bind point index.
392        ///
393        /// # Safety
394        ///
395        /// - `buffer` may need to be synchronized.
396        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
397        /// - `buffer` contents should be of the correct type.
398        /// - `offset` might not be bounds-checked.
399        /// - `index` might not be bounds-checked.
400        #[unsafe(method(setVertexBuffer:offset:atIndex:))]
401        #[unsafe(method_family = none)]
402        unsafe fn setVertexBuffer_offset_atIndex(
403            &self,
404            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
405            offset: NSUInteger,
406            index: NSUInteger,
407        );
408
409        /// Set the offset within the current global buffer for all vertex shaders at the given bind point index.
410        ///
411        /// # Safety
412        ///
413        /// - `offset` might not be bounds-checked.
414        /// - `index` might not be bounds-checked.
415        #[unsafe(method(setVertexBufferOffset:atIndex:))]
416        #[unsafe(method_family = none)]
417        unsafe fn setVertexBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);
418
419        #[cfg(all(
420            feature = "MTLAllocation",
421            feature = "MTLBuffer",
422            feature = "MTLResource"
423        ))]
424        /// Set an array of global buffers for all vertex shaders with the given bind point range.
425        ///
426        /// # Safety
427        ///
428        /// - `buffers` must be a valid pointer.
429        /// - `offsets` might not be bounds-checked.
430        /// - `offsets` must be a valid pointer.
431        /// - `range` might not be bounds-checked.
432        #[unsafe(method(setVertexBuffers:offsets:withRange:))]
433        #[unsafe(method_family = none)]
434        unsafe fn setVertexBuffers_offsets_withRange(
435            &self,
436            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
437            offsets: NonNull<NSUInteger>,
438            range: NSRange,
439        );
440
441        #[cfg(all(
442            feature = "MTLAllocation",
443            feature = "MTLBuffer",
444            feature = "MTLResource"
445        ))]
446        /// sets vertex buffer at specified index with provided offset and stride. Only
447        /// call this when the buffer-index is part of the vertexDescriptor and has set
448        /// its stride to `MTLBufferLayoutStrideDynamic`
449        ///
450        /// # Safety
451        ///
452        /// - `buffer` may need to be synchronized.
453        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
454        /// - `buffer` contents should be of the correct type.
455        /// - `offset` might not be bounds-checked.
456        /// - `stride` might not be bounds-checked.
457        /// - `index` might not be bounds-checked.
458        #[unsafe(method(setVertexBuffer:offset:attributeStride:atIndex:))]
459        #[unsafe(method_family = none)]
460        unsafe fn setVertexBuffer_offset_attributeStride_atIndex(
461            &self,
462            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
463            offset: NSUInteger,
464            stride: NSUInteger,
465            index: NSUInteger,
466        );
467
468        #[cfg(all(
469            feature = "MTLAllocation",
470            feature = "MTLBuffer",
471            feature = "MTLResource"
472        ))]
473        /// sets an array of vertex buffers with provided offsets and strides with the
474        /// given bind point range.
475        /// only call this when at least one buffer is part of the
476        /// vertexDescriptor, other buffers must set their value relative to the
477        /// `attributeStrides` array to `MTLAttributeStrideStatic`
478        ///
479        /// # Safety
480        ///
481        /// - `buffers` must be a valid pointer.
482        /// - `offsets` might not be bounds-checked.
483        /// - `offsets` must be a valid pointer.
484        /// - `strides` might not be bounds-checked.
485        /// - `strides` must be a valid pointer.
486        /// - `range` might not be bounds-checked.
487        #[unsafe(method(setVertexBuffers:offsets:attributeStrides:withRange:))]
488        #[unsafe(method_family = none)]
489        unsafe fn setVertexBuffers_offsets_attributeStrides_withRange(
490            &self,
491            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
492            offsets: NonNull<NSUInteger>,
493            strides: NonNull<NSUInteger>,
494            range: NSRange,
495        );
496
497        /// only call this when the buffer-index is part of the vertexDescriptor and
498        /// has set its stride to `MTLBufferLayoutStrideDynamic`
499        ///
500        /// # Safety
501        ///
502        /// - `offset` might not be bounds-checked.
503        /// - `stride` might not be bounds-checked.
504        /// - `index` might not be bounds-checked.
505        #[unsafe(method(setVertexBufferOffset:attributeStride:atIndex:))]
506        #[unsafe(method_family = none)]
507        unsafe fn setVertexBufferOffset_attributeStride_atIndex(
508            &self,
509            offset: NSUInteger,
510            stride: NSUInteger,
511            index: NSUInteger,
512        );
513
514        /// only call this when the buffer-index is part of the vertexDescriptor and
515        /// has set its stride to `MTLBufferLayoutStrideDynamic`
516        ///
517        /// # Safety
518        ///
519        /// - `bytes` must be a valid pointer.
520        /// - `stride` might not be bounds-checked.
521        /// - `index` might not be bounds-checked.
522        #[unsafe(method(setVertexBytes:length:attributeStride:atIndex:))]
523        #[unsafe(method_family = none)]
524        unsafe fn setVertexBytes_length_attributeStride_atIndex(
525            &self,
526            bytes: NonNull<c_void>,
527            length: NSUInteger,
528            stride: NSUInteger,
529            index: NSUInteger,
530        );
531
532        #[cfg(all(
533            feature = "MTLAllocation",
534            feature = "MTLResource",
535            feature = "MTLTexture"
536        ))]
537        /// Set a global texture for all vertex shaders at the given bind point index.
538        ///
539        /// # Safety
540        ///
541        /// - `texture` may need to be synchronized.
542        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
543        /// - `index` might not be bounds-checked.
544        #[unsafe(method(setVertexTexture:atIndex:))]
545        #[unsafe(method_family = none)]
546        unsafe fn setVertexTexture_atIndex(
547            &self,
548            texture: Option<&ProtocolObject<dyn MTLTexture>>,
549            index: NSUInteger,
550        );
551
552        #[cfg(all(
553            feature = "MTLAllocation",
554            feature = "MTLResource",
555            feature = "MTLTexture"
556        ))]
557        /// Set an array of global textures for all vertex shaders with the given bind point range.
558        ///
559        /// # Safety
560        ///
561        /// - `textures` must be a valid pointer.
562        /// - `range` might not be bounds-checked.
563        #[unsafe(method(setVertexTextures:withRange:))]
564        #[unsafe(method_family = none)]
565        unsafe fn setVertexTextures_withRange(
566            &self,
567            textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
568            range: NSRange,
569        );
570
571        #[cfg(feature = "MTLSampler")]
572        /// Set a global sampler for all vertex shaders at the given bind point index.
573        ///
574        /// # Safety
575        ///
576        /// `index` might not be bounds-checked.
577        #[unsafe(method(setVertexSamplerState:atIndex:))]
578        #[unsafe(method_family = none)]
579        unsafe fn setVertexSamplerState_atIndex(
580            &self,
581            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
582            index: NSUInteger,
583        );
584
585        #[cfg(feature = "MTLSampler")]
586        /// Set an array of global samplers for all vertex shaders with the given bind point range.
587        ///
588        /// # Safety
589        ///
590        /// - `samplers` must be a valid pointer.
591        /// - `range` might not be bounds-checked.
592        #[unsafe(method(setVertexSamplerStates:withRange:))]
593        #[unsafe(method_family = none)]
594        unsafe fn setVertexSamplerStates_withRange(
595            &self,
596            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
597            range: NSRange,
598        );
599
600        #[cfg(feature = "MTLSampler")]
601        /// Set a global sampler for all vertex shaders at the given bind point index.
602        ///
603        /// # Safety
604        ///
605        /// `index` might not be bounds-checked.
606        #[unsafe(method(setVertexSamplerState:lodMinClamp:lodMaxClamp:atIndex:))]
607        #[unsafe(method_family = none)]
608        unsafe fn setVertexSamplerState_lodMinClamp_lodMaxClamp_atIndex(
609            &self,
610            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
611            lod_min_clamp: c_float,
612            lod_max_clamp: c_float,
613            index: NSUInteger,
614        );
615
616        #[cfg(feature = "MTLSampler")]
617        /// Set an array of global samplers for all vertex shaders with the given bind point range.
618        ///
619        /// # Safety
620        ///
621        /// - `samplers` must be a valid pointer.
622        /// - `lod_min_clamps` must be a valid pointer.
623        /// - `lod_max_clamps` must be a valid pointer.
624        /// - `range` might not be bounds-checked.
625        #[unsafe(method(setVertexSamplerStates:lodMinClamps:lodMaxClamps:withRange:))]
626        #[unsafe(method_family = none)]
627        unsafe fn setVertexSamplerStates_lodMinClamps_lodMaxClamps_withRange(
628            &self,
629            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
630            lod_min_clamps: NonNull<c_float>,
631            lod_max_clamps: NonNull<c_float>,
632            range: NSRange,
633        );
634
635        #[cfg(all(
636            feature = "MTLAllocation",
637            feature = "MTLResource",
638            feature = "MTLVisibleFunctionTable"
639        ))]
640        /// Set a global visible function table for all vertex shaders at the given buffer bind point index.
641        ///
642        /// # Safety
643        ///
644        /// - `function_table` may need to be synchronized.
645        /// - `function_table` may be unretained, you must ensure it is kept alive while in use.
646        /// - `bufferIndex` might not be bounds-checked.
647        #[unsafe(method(setVertexVisibleFunctionTable:atBufferIndex:))]
648        #[unsafe(method_family = none)]
649        unsafe fn setVertexVisibleFunctionTable_atBufferIndex(
650            &self,
651            function_table: Option<&ProtocolObject<dyn MTLVisibleFunctionTable>>,
652            buffer_index: NSUInteger,
653        );
654
655        #[cfg(all(
656            feature = "MTLAllocation",
657            feature = "MTLResource",
658            feature = "MTLVisibleFunctionTable"
659        ))]
660        /// Set an array of global visible function tables for all vertex shaders with the given buffer bind point range.
661        ///
662        /// # Safety
663        ///
664        /// - `function_tables` must be a valid pointer.
665        /// - `range` might not be bounds-checked.
666        #[unsafe(method(setVertexVisibleFunctionTables:withBufferRange:))]
667        #[unsafe(method_family = none)]
668        unsafe fn setVertexVisibleFunctionTables_withBufferRange(
669            &self,
670            function_tables: NonNull<*const ProtocolObject<dyn MTLVisibleFunctionTable>>,
671            range: NSRange,
672        );
673
674        #[cfg(all(
675            feature = "MTLAllocation",
676            feature = "MTLIntersectionFunctionTable",
677            feature = "MTLResource"
678        ))]
679        /// Set a global intersection function table for all vertex shaders at the given buffer bind point index.
680        ///
681        /// # Safety
682        ///
683        /// - `intersection_function_table` may need to be synchronized.
684        /// - `intersection_function_table` may be unretained, you must ensure it is kept alive while in use.
685        /// - `bufferIndex` might not be bounds-checked.
686        #[unsafe(method(setVertexIntersectionFunctionTable:atBufferIndex:))]
687        #[unsafe(method_family = none)]
688        unsafe fn setVertexIntersectionFunctionTable_atBufferIndex(
689            &self,
690            intersection_function_table: Option<&ProtocolObject<dyn MTLIntersectionFunctionTable>>,
691            buffer_index: NSUInteger,
692        );
693
694        #[cfg(all(
695            feature = "MTLAllocation",
696            feature = "MTLIntersectionFunctionTable",
697            feature = "MTLResource"
698        ))]
699        /// Set an array of global intersection function tables for all vertex shaders with the given buffer bind point range.
700        ///
701        /// # Safety
702        ///
703        /// - `intersection_function_tables` must be a valid pointer.
704        /// - `range` might not be bounds-checked.
705        #[unsafe(method(setVertexIntersectionFunctionTables:withBufferRange:))]
706        #[unsafe(method_family = none)]
707        unsafe fn setVertexIntersectionFunctionTables_withBufferRange(
708            &self,
709            intersection_function_tables: NonNull<
710                *const ProtocolObject<dyn MTLIntersectionFunctionTable>,
711            >,
712            range: NSRange,
713        );
714
715        #[cfg(all(
716            feature = "MTLAccelerationStructure",
717            feature = "MTLAllocation",
718            feature = "MTLResource"
719        ))]
720        /// Set a global acceleration structure for all vertex shaders at the given buffer bind point index.
721        ///
722        /// # Safety
723        ///
724        /// - `acceleration_structure` may need to be synchronized.
725        /// - `acceleration_structure` may be unretained, you must ensure it is kept alive while in use.
726        /// - `bufferIndex` might not be bounds-checked.
727        #[unsafe(method(setVertexAccelerationStructure:atBufferIndex:))]
728        #[unsafe(method_family = none)]
729        unsafe fn setVertexAccelerationStructure_atBufferIndex(
730            &self,
731            acceleration_structure: Option<&ProtocolObject<dyn MTLAccelerationStructure>>,
732            buffer_index: NSUInteger,
733        );
734
735        /// Set the viewport, which is used to transform vertexes from normalized device coordinates to window coordinates.  Fragments that lie outside of the viewport are clipped, and optionally clamped for fragments outside of znear/zfar.
736        #[unsafe(method(setViewport:))]
737        #[unsafe(method_family = none)]
738        fn setViewport(&self, viewport: MTLViewport);
739
740        /// Specifies an array of viewports, which are used to transform vertices from normalized device coordinates to window coordinates based on [[ viewport_array_index ]] value specified in the vertex shader.
741        ///
742        /// # Safety
743        ///
744        /// - `viewports` must be a valid pointer.
745        /// - `count` might not be bounds-checked.
746        #[unsafe(method(setViewports:count:))]
747        #[unsafe(method_family = none)]
748        unsafe fn setViewports_count(&self, viewports: NonNull<MTLViewport>, count: NSUInteger);
749
750        /// The winding order of front-facing primitives.
751        #[unsafe(method(setFrontFacingWinding:))]
752        #[unsafe(method_family = none)]
753        fn setFrontFacingWinding(&self, front_facing_winding: MTLWinding);
754
755        /// Specifies the vertex amplification count and associated view mappings for each amplification ID.
756        ///
757        /// Parameter `count`: the amplification count. The maximum value is currently 2.
758        ///
759        /// Parameter `viewMappings`: an array of mapping elements.
760        ///
761        /// Each mapping element describes how to route the corresponding amplification ID to a specific viewport and render target array index by using offsets from the base array index provided by the [[render_target_array_index]] and/or [[viewport_array_index]] output attributes in the vertex shader. This allows a modicum of programmability for each amplified vertex to be routed to a different [[render_target_array_index]] and [[viewport_array_index]] even though these attribytes cannot be amplified themselves.
762        ///
763        /// # Safety
764        ///
765        /// - `count` might not be bounds-checked.
766        /// - `view_mappings` must be a valid pointer or null.
767        #[unsafe(method(setVertexAmplificationCount:viewMappings:))]
768        #[unsafe(method_family = none)]
769        unsafe fn setVertexAmplificationCount_viewMappings(
770            &self,
771            count: NSUInteger,
772            view_mappings: *const MTLVertexAmplificationViewMapping,
773        );
774
775        /// Controls if primitives are culled when front facing, back facing, or not culled at all.
776        #[unsafe(method(setCullMode:))]
777        #[unsafe(method_family = none)]
778        fn setCullMode(&self, cull_mode: MTLCullMode);
779
780        /// Controls what is done with fragments outside of the near or far planes.
781        #[unsafe(method(setDepthClipMode:))]
782        #[unsafe(method_family = none)]
783        fn setDepthClipMode(&self, depth_clip_mode: MTLDepthClipMode);
784
785        /// Depth Bias.
786        #[unsafe(method(setDepthBias:slopeScale:clamp:))]
787        #[unsafe(method_family = none)]
788        fn setDepthBias_slopeScale_clamp(
789            &self,
790            depth_bias: c_float,
791            slope_scale: c_float,
792            clamp: c_float,
793        );
794
795        /// Configures the minimum and maximum bounds for depth bounds testing.
796        ///
797        /// The render command encoder disables depth bounds testing by default.
798        /// The render command encoder also disables depth bounds testing when all of the following properties equal a specific value:
799        /// - The `minBound` property is equal to `0.0f`.
800        /// - The `maxBound` property is equal to `1.0f`.
801        /// Both `minBound` and `maxBound` need to be within `[0.0f, 1.0f]`, and `minBound` needs to be less than or equal to `maxBound`.
802        /// - Parameters:
803        /// - minBound: A minimum bound for depth testing, which discards fragments with a stored depth that is less than `minBound`.
804        /// - maxBound: A maximum bound for depth testing, which discards fragments with a stored depth that is greater than `maxBound`.
805        #[unsafe(method(setDepthTestMinBound:maxBound:))]
806        #[unsafe(method_family = none)]
807        fn setDepthTestMinBound_maxBound(&self, min_bound: c_float, max_bound: c_float);
808
809        /// Specifies a rectangle for a fragment scissor test.  All fragments outside of this rectangle are discarded.
810        #[unsafe(method(setScissorRect:))]
811        #[unsafe(method_family = none)]
812        fn setScissorRect(&self, rect: MTLScissorRect);
813
814        /// Specifies an array of rectangles for a fragment scissor test. The specific rectangle used is based on the [[ viewport_array_index ]] value output by the vertex shader. Fragments that lie outside the scissor rectangle are discarded.
815        ///
816        /// # Safety
817        ///
818        /// - `scissor_rects` must be a valid pointer.
819        /// - `count` might not be bounds-checked.
820        #[unsafe(method(setScissorRects:count:))]
821        #[unsafe(method_family = none)]
822        unsafe fn setScissorRects_count(
823            &self,
824            scissor_rects: NonNull<MTLScissorRect>,
825            count: NSUInteger,
826        );
827
828        /// Set how to rasterize triangle and triangle strip primitives.
829        #[unsafe(method(setTriangleFillMode:))]
830        #[unsafe(method_family = none)]
831        fn setTriangleFillMode(&self, fill_mode: MTLTriangleFillMode);
832
833        /// Set the data (by copy) for a given fragment buffer binding point.  This will remove any existing MTLBuffer from the binding point.
834        ///
835        /// # Safety
836        ///
837        /// - `bytes` must be a valid pointer.
838        /// - `index` might not be bounds-checked.
839        #[unsafe(method(setFragmentBytes:length:atIndex:))]
840        #[unsafe(method_family = none)]
841        unsafe fn setFragmentBytes_length_atIndex(
842            &self,
843            bytes: NonNull<c_void>,
844            length: NSUInteger,
845            index: NSUInteger,
846        );
847
848        #[cfg(all(
849            feature = "MTLAllocation",
850            feature = "MTLBuffer",
851            feature = "MTLResource"
852        ))]
853        /// Set a global buffer for all fragment shaders at the given bind point index.
854        ///
855        /// # Safety
856        ///
857        /// - `buffer` may need to be synchronized.
858        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
859        /// - `buffer` contents should be of the correct type.
860        /// - `offset` might not be bounds-checked.
861        /// - `index` might not be bounds-checked.
862        #[unsafe(method(setFragmentBuffer:offset:atIndex:))]
863        #[unsafe(method_family = none)]
864        unsafe fn setFragmentBuffer_offset_atIndex(
865            &self,
866            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
867            offset: NSUInteger,
868            index: NSUInteger,
869        );
870
871        /// Set the offset within the current global buffer for all fragment shaders at the given bind point index.
872        ///
873        /// # Safety
874        ///
875        /// - `offset` might not be bounds-checked.
876        /// - `index` might not be bounds-checked.
877        #[unsafe(method(setFragmentBufferOffset:atIndex:))]
878        #[unsafe(method_family = none)]
879        unsafe fn setFragmentBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);
880
881        #[cfg(all(
882            feature = "MTLAllocation",
883            feature = "MTLBuffer",
884            feature = "MTLResource"
885        ))]
886        /// Set an array of global buffers for all fragment shaders with the given bind point range.
887        ///
888        /// # Safety
889        ///
890        /// - `buffers` must be a valid pointer.
891        /// - `offsets` might not be bounds-checked.
892        /// - `offsets` must be a valid pointer.
893        /// - `range` might not be bounds-checked.
894        #[unsafe(method(setFragmentBuffers:offsets:withRange:))]
895        #[unsafe(method_family = none)]
896        unsafe fn setFragmentBuffers_offsets_withRange(
897            &self,
898            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
899            offsets: NonNull<NSUInteger>,
900            range: NSRange,
901        );
902
903        #[cfg(all(
904            feature = "MTLAllocation",
905            feature = "MTLResource",
906            feature = "MTLTexture"
907        ))]
908        /// Set a global texture for all fragment shaders at the given bind point index.
909        ///
910        /// # Safety
911        ///
912        /// - `texture` may need to be synchronized.
913        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
914        /// - `index` might not be bounds-checked.
915        #[unsafe(method(setFragmentTexture:atIndex:))]
916        #[unsafe(method_family = none)]
917        unsafe fn setFragmentTexture_atIndex(
918            &self,
919            texture: Option<&ProtocolObject<dyn MTLTexture>>,
920            index: NSUInteger,
921        );
922
923        #[cfg(all(
924            feature = "MTLAllocation",
925            feature = "MTLResource",
926            feature = "MTLTexture"
927        ))]
928        /// Set an array of global textures for all fragment shaders with the given bind point range.
929        ///
930        /// # Safety
931        ///
932        /// - `textures` must be a valid pointer.
933        /// - `range` might not be bounds-checked.
934        #[unsafe(method(setFragmentTextures:withRange:))]
935        #[unsafe(method_family = none)]
936        unsafe fn setFragmentTextures_withRange(
937            &self,
938            textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
939            range: NSRange,
940        );
941
942        #[cfg(feature = "MTLSampler")]
943        /// Set a global sampler for all fragment shaders at the given bind point index.
944        ///
945        /// # Safety
946        ///
947        /// `index` might not be bounds-checked.
948        #[unsafe(method(setFragmentSamplerState:atIndex:))]
949        #[unsafe(method_family = none)]
950        unsafe fn setFragmentSamplerState_atIndex(
951            &self,
952            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
953            index: NSUInteger,
954        );
955
956        #[cfg(feature = "MTLSampler")]
957        /// Set an array of global samplers for all fragment shaders with the given bind point range.
958        ///
959        /// # Safety
960        ///
961        /// - `samplers` must be a valid pointer.
962        /// - `range` might not be bounds-checked.
963        #[unsafe(method(setFragmentSamplerStates:withRange:))]
964        #[unsafe(method_family = none)]
965        unsafe fn setFragmentSamplerStates_withRange(
966            &self,
967            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
968            range: NSRange,
969        );
970
971        #[cfg(feature = "MTLSampler")]
972        /// Set a global sampler for all fragment shaders at the given bind point index.
973        ///
974        /// # Safety
975        ///
976        /// `index` might not be bounds-checked.
977        #[unsafe(method(setFragmentSamplerState:lodMinClamp:lodMaxClamp:atIndex:))]
978        #[unsafe(method_family = none)]
979        unsafe fn setFragmentSamplerState_lodMinClamp_lodMaxClamp_atIndex(
980            &self,
981            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
982            lod_min_clamp: c_float,
983            lod_max_clamp: c_float,
984            index: NSUInteger,
985        );
986
987        #[cfg(feature = "MTLSampler")]
988        /// Set an array of global samplers for all fragment shaders with the given bind point range.
989        ///
990        /// # Safety
991        ///
992        /// - `samplers` must be a valid pointer.
993        /// - `lod_min_clamps` must be a valid pointer.
994        /// - `lod_max_clamps` must be a valid pointer.
995        /// - `range` might not be bounds-checked.
996        #[unsafe(method(setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange:))]
997        #[unsafe(method_family = none)]
998        unsafe fn setFragmentSamplerStates_lodMinClamps_lodMaxClamps_withRange(
999            &self,
1000            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
1001            lod_min_clamps: NonNull<c_float>,
1002            lod_max_clamps: NonNull<c_float>,
1003            range: NSRange,
1004        );
1005
1006        #[cfg(all(
1007            feature = "MTLAllocation",
1008            feature = "MTLResource",
1009            feature = "MTLVisibleFunctionTable"
1010        ))]
1011        /// Set a global visible function table for all fragment shaders at the given buffer bind point index.
1012        ///
1013        /// # Safety
1014        ///
1015        /// - `function_table` may need to be synchronized.
1016        /// - `function_table` may be unretained, you must ensure it is kept alive while in use.
1017        /// - `bufferIndex` might not be bounds-checked.
1018        #[unsafe(method(setFragmentVisibleFunctionTable:atBufferIndex:))]
1019        #[unsafe(method_family = none)]
1020        unsafe fn setFragmentVisibleFunctionTable_atBufferIndex(
1021            &self,
1022            function_table: Option<&ProtocolObject<dyn MTLVisibleFunctionTable>>,
1023            buffer_index: NSUInteger,
1024        );
1025
1026        #[cfg(all(
1027            feature = "MTLAllocation",
1028            feature = "MTLResource",
1029            feature = "MTLVisibleFunctionTable"
1030        ))]
1031        /// Set an array of global visible function tables for all fragment shaders with the given buffer bind point range.
1032        ///
1033        /// # Safety
1034        ///
1035        /// - `function_tables` must be a valid pointer.
1036        /// - `range` might not be bounds-checked.
1037        #[unsafe(method(setFragmentVisibleFunctionTables:withBufferRange:))]
1038        #[unsafe(method_family = none)]
1039        unsafe fn setFragmentVisibleFunctionTables_withBufferRange(
1040            &self,
1041            function_tables: NonNull<*const ProtocolObject<dyn MTLVisibleFunctionTable>>,
1042            range: NSRange,
1043        );
1044
1045        #[cfg(all(
1046            feature = "MTLAllocation",
1047            feature = "MTLIntersectionFunctionTable",
1048            feature = "MTLResource"
1049        ))]
1050        /// Set a global intersection function table for all fragment shaders at the given buffer bind point index.
1051        ///
1052        /// # Safety
1053        ///
1054        /// - `intersection_function_table` may need to be synchronized.
1055        /// - `intersection_function_table` may be unretained, you must ensure it is kept alive while in use.
1056        /// - `bufferIndex` might not be bounds-checked.
1057        #[unsafe(method(setFragmentIntersectionFunctionTable:atBufferIndex:))]
1058        #[unsafe(method_family = none)]
1059        unsafe fn setFragmentIntersectionFunctionTable_atBufferIndex(
1060            &self,
1061            intersection_function_table: Option<&ProtocolObject<dyn MTLIntersectionFunctionTable>>,
1062            buffer_index: NSUInteger,
1063        );
1064
1065        #[cfg(all(
1066            feature = "MTLAllocation",
1067            feature = "MTLIntersectionFunctionTable",
1068            feature = "MTLResource"
1069        ))]
1070        /// Set an array of global intersection function tables for all fragment shaders with the given buffer bind point range.
1071        ///
1072        /// # Safety
1073        ///
1074        /// - `intersection_function_tables` must be a valid pointer.
1075        /// - `range` might not be bounds-checked.
1076        #[unsafe(method(setFragmentIntersectionFunctionTables:withBufferRange:))]
1077        #[unsafe(method_family = none)]
1078        unsafe fn setFragmentIntersectionFunctionTables_withBufferRange(
1079            &self,
1080            intersection_function_tables: NonNull<
1081                *const ProtocolObject<dyn MTLIntersectionFunctionTable>,
1082            >,
1083            range: NSRange,
1084        );
1085
1086        #[cfg(all(
1087            feature = "MTLAccelerationStructure",
1088            feature = "MTLAllocation",
1089            feature = "MTLResource"
1090        ))]
1091        /// Set a global acceleration structure for all fragment shaders at the given buffer bind point index.
1092        ///
1093        /// # Safety
1094        ///
1095        /// - `acceleration_structure` may need to be synchronized.
1096        /// - `acceleration_structure` may be unretained, you must ensure it is kept alive while in use.
1097        /// - `bufferIndex` might not be bounds-checked.
1098        #[unsafe(method(setFragmentAccelerationStructure:atBufferIndex:))]
1099        #[unsafe(method_family = none)]
1100        unsafe fn setFragmentAccelerationStructure_atBufferIndex(
1101            &self,
1102            acceleration_structure: Option<&ProtocolObject<dyn MTLAccelerationStructure>>,
1103            buffer_index: NSUInteger,
1104        );
1105
1106        /// Set the constant blend color used across all blending on all render targets
1107        #[unsafe(method(setBlendColorRed:green:blue:alpha:))]
1108        #[unsafe(method_family = none)]
1109        fn setBlendColorRed_green_blue_alpha(
1110            &self,
1111            red: c_float,
1112            green: c_float,
1113            blue: c_float,
1114            alpha: c_float,
1115        );
1116
1117        #[cfg(feature = "MTLDepthStencil")]
1118        /// Set the DepthStencil state object.
1119        #[unsafe(method(setDepthStencilState:))]
1120        #[unsafe(method_family = none)]
1121        fn setDepthStencilState(
1122            &self,
1123            depth_stencil_state: Option<&ProtocolObject<dyn MTLDepthStencilState>>,
1124        );
1125
1126        /// Set the stencil reference value for both the back and front stencil buffers.
1127        #[unsafe(method(setStencilReferenceValue:))]
1128        #[unsafe(method_family = none)]
1129        fn setStencilReferenceValue(&self, reference_value: u32);
1130
1131        /// Set the stencil reference value for the back and front stencil buffers independently.
1132        #[unsafe(method(setStencilFrontReferenceValue:backReferenceValue:))]
1133        #[unsafe(method_family = none)]
1134        fn setStencilFrontReferenceValue_backReferenceValue(
1135            &self,
1136            front_reference_value: u32,
1137            back_reference_value: u32,
1138        );
1139
1140        /// Monitor if samples pass the depth and stencil tests.
1141        ///
1142        /// Parameter `mode`: Controls if the counter is disabled or moniters passing samples.
1143        ///
1144        /// Parameter `offset`: The offset relative to the occlusion query buffer provided when the command encoder was created.  offset must be a multiple of 8.
1145        #[unsafe(method(setVisibilityResultMode:offset:))]
1146        #[unsafe(method_family = none)]
1147        fn setVisibilityResultMode_offset(&self, mode: MTLVisibilityResultMode, offset: NSUInteger);
1148
1149        #[cfg(feature = "MTLRenderPass")]
1150        /// If the the store action for a given color attachment was set to MTLStoreActionUnknown when the render command encoder was created,
1151        /// setColorStoreAction:atIndex: must be used to finalize the store action before endEncoding is called.
1152        ///
1153        /// Parameter `storeAction`: The desired store action for the given color attachment.  This may be set to any value other than MTLStoreActionUnknown.
1154        ///
1155        /// Parameter `colorAttachmentIndex`: The index of the color attachment
1156        ///
1157        /// # Safety
1158        ///
1159        /// `colorAttachmentIndex` might not be bounds-checked.
1160        #[unsafe(method(setColorStoreAction:atIndex:))]
1161        #[unsafe(method_family = none)]
1162        unsafe fn setColorStoreAction_atIndex(
1163            &self,
1164            store_action: MTLStoreAction,
1165            color_attachment_index: NSUInteger,
1166        );
1167
1168        #[cfg(feature = "MTLRenderPass")]
1169        /// If the the store action for the depth attachment was set to MTLStoreActionUnknown when the render command encoder was created,
1170        /// setDepthStoreAction: must be used to finalize the store action before endEncoding is called.
1171        #[unsafe(method(setDepthStoreAction:))]
1172        #[unsafe(method_family = none)]
1173        fn setDepthStoreAction(&self, store_action: MTLStoreAction);
1174
1175        #[cfg(feature = "MTLRenderPass")]
1176        /// If the the store action for the stencil attachment was set to MTLStoreActionUnknown when the render command encoder was created,
1177        /// setStencilStoreAction: must be used to finalize the store action before endEncoding is called.
1178        #[unsafe(method(setStencilStoreAction:))]
1179        #[unsafe(method_family = none)]
1180        fn setStencilStoreAction(&self, store_action: MTLStoreAction);
1181
1182        #[cfg(feature = "MTLRenderPass")]
1183        /// If the the store action for a given color attachment was set to MTLStoreActionUnknown when the render command encoder was created,
1184        /// setColorStoreActionOptions:atIndex: may be used to finalize the store action options before endEncoding is called.
1185        ///
1186        /// Parameter `storeActionOptions`: The desired store action options for the given color attachment.
1187        ///
1188        /// Parameter `colorAttachmentIndex`: The index of the color attachment
1189        ///
1190        /// # Safety
1191        ///
1192        /// `colorAttachmentIndex` might not be bounds-checked.
1193        #[unsafe(method(setColorStoreActionOptions:atIndex:))]
1194        #[unsafe(method_family = none)]
1195        unsafe fn setColorStoreActionOptions_atIndex(
1196            &self,
1197            store_action_options: MTLStoreActionOptions,
1198            color_attachment_index: NSUInteger,
1199        );
1200
1201        #[cfg(feature = "MTLRenderPass")]
1202        /// If the the store action for the depth attachment was set to MTLStoreActionUnknown when the render command encoder was created,
1203        /// setDepthStoreActionOptions: may be used to finalize the store action options before endEncoding is called.
1204        #[unsafe(method(setDepthStoreActionOptions:))]
1205        #[unsafe(method_family = none)]
1206        fn setDepthStoreActionOptions(&self, store_action_options: MTLStoreActionOptions);
1207
1208        #[cfg(feature = "MTLRenderPass")]
1209        /// If the the store action for the stencil attachment was set to MTLStoreActionUnknown when the render command encoder was created,
1210        /// setStencilStoreActionOptions: may be used to finalize the store action options before endEncoding is called.
1211        #[unsafe(method(setStencilStoreActionOptions:))]
1212        #[unsafe(method_family = none)]
1213        fn setStencilStoreActionOptions(&self, store_action_options: MTLStoreActionOptions);
1214
1215        /// Set the data (by copy) for a given object shader buffer binding point.  This will remove any existing MTLBuffer from the binding point.
1216        ///
1217        /// # Safety
1218        ///
1219        /// - `bytes` must be a valid pointer.
1220        /// - `index` might not be bounds-checked.
1221        #[unsafe(method(setObjectBytes:length:atIndex:))]
1222        #[unsafe(method_family = none)]
1223        unsafe fn setObjectBytes_length_atIndex(
1224            &self,
1225            bytes: NonNull<c_void>,
1226            length: NSUInteger,
1227            index: NSUInteger,
1228        );
1229
1230        #[cfg(all(
1231            feature = "MTLAllocation",
1232            feature = "MTLBuffer",
1233            feature = "MTLResource"
1234        ))]
1235        /// Set a global buffer for all object shaders at the given bind point index.
1236        ///
1237        /// # Safety
1238        ///
1239        /// - `buffer` may need to be synchronized.
1240        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
1241        /// - `buffer` contents should be of the correct type.
1242        /// - `offset` might not be bounds-checked.
1243        /// - `index` might not be bounds-checked.
1244        #[unsafe(method(setObjectBuffer:offset:atIndex:))]
1245        #[unsafe(method_family = none)]
1246        unsafe fn setObjectBuffer_offset_atIndex(
1247            &self,
1248            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
1249            offset: NSUInteger,
1250            index: NSUInteger,
1251        );
1252
1253        /// Set the offset within the current global buffer for all object shaders at the given bind point index.
1254        ///
1255        /// # Safety
1256        ///
1257        /// - `offset` might not be bounds-checked.
1258        /// - `index` might not be bounds-checked.
1259        #[unsafe(method(setObjectBufferOffset:atIndex:))]
1260        #[unsafe(method_family = none)]
1261        unsafe fn setObjectBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);
1262
1263        #[cfg(all(
1264            feature = "MTLAllocation",
1265            feature = "MTLBuffer",
1266            feature = "MTLResource"
1267        ))]
1268        /// Set an array of global buffers for all object shaders with the given bind point range.
1269        ///
1270        /// # Safety
1271        ///
1272        /// - `buffers` must be a valid pointer.
1273        /// - `offsets` might not be bounds-checked.
1274        /// - `offsets` must be a valid pointer.
1275        /// - `range` might not be bounds-checked.
1276        #[unsafe(method(setObjectBuffers:offsets:withRange:))]
1277        #[unsafe(method_family = none)]
1278        unsafe fn setObjectBuffers_offsets_withRange(
1279            &self,
1280            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
1281            offsets: NonNull<NSUInteger>,
1282            range: NSRange,
1283        );
1284
1285        #[cfg(all(
1286            feature = "MTLAllocation",
1287            feature = "MTLResource",
1288            feature = "MTLTexture"
1289        ))]
1290        /// Set a global texture for all object shaders at the given bind point index.
1291        ///
1292        /// # Safety
1293        ///
1294        /// - `texture` may need to be synchronized.
1295        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
1296        /// - `index` might not be bounds-checked.
1297        #[unsafe(method(setObjectTexture:atIndex:))]
1298        #[unsafe(method_family = none)]
1299        unsafe fn setObjectTexture_atIndex(
1300            &self,
1301            texture: Option<&ProtocolObject<dyn MTLTexture>>,
1302            index: NSUInteger,
1303        );
1304
1305        #[cfg(all(
1306            feature = "MTLAllocation",
1307            feature = "MTLResource",
1308            feature = "MTLTexture"
1309        ))]
1310        /// Set an array of global textures for all object shaders with the given bind point range.
1311        ///
1312        /// # Safety
1313        ///
1314        /// - `textures` must be a valid pointer.
1315        /// - `range` might not be bounds-checked.
1316        #[unsafe(method(setObjectTextures:withRange:))]
1317        #[unsafe(method_family = none)]
1318        unsafe fn setObjectTextures_withRange(
1319            &self,
1320            textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
1321            range: NSRange,
1322        );
1323
1324        #[cfg(feature = "MTLSampler")]
1325        /// Set a global sampler for all object shaders at the given bind point index.
1326        ///
1327        /// # Safety
1328        ///
1329        /// `index` might not be bounds-checked.
1330        #[unsafe(method(setObjectSamplerState:atIndex:))]
1331        #[unsafe(method_family = none)]
1332        unsafe fn setObjectSamplerState_atIndex(
1333            &self,
1334            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
1335            index: NSUInteger,
1336        );
1337
1338        #[cfg(feature = "MTLSampler")]
1339        /// Set an array of global samplers for all object shaders with the given bind point range.
1340        ///
1341        /// # Safety
1342        ///
1343        /// - `samplers` must be a valid pointer.
1344        /// - `range` might not be bounds-checked.
1345        #[unsafe(method(setObjectSamplerStates:withRange:))]
1346        #[unsafe(method_family = none)]
1347        unsafe fn setObjectSamplerStates_withRange(
1348            &self,
1349            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
1350            range: NSRange,
1351        );
1352
1353        #[cfg(feature = "MTLSampler")]
1354        /// Set a global sampler for all object shaders at the given bind point index.
1355        ///
1356        /// # Safety
1357        ///
1358        /// `index` might not be bounds-checked.
1359        #[unsafe(method(setObjectSamplerState:lodMinClamp:lodMaxClamp:atIndex:))]
1360        #[unsafe(method_family = none)]
1361        unsafe fn setObjectSamplerState_lodMinClamp_lodMaxClamp_atIndex(
1362            &self,
1363            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
1364            lod_min_clamp: c_float,
1365            lod_max_clamp: c_float,
1366            index: NSUInteger,
1367        );
1368
1369        #[cfg(feature = "MTLSampler")]
1370        /// Set an array of global samplers for all object shaders with the given bind point range.
1371        ///
1372        /// # Safety
1373        ///
1374        /// - `samplers` must be a valid pointer.
1375        /// - `lod_min_clamps` must be a valid pointer.
1376        /// - `lod_max_clamps` must be a valid pointer.
1377        /// - `range` might not be bounds-checked.
1378        #[unsafe(method(setObjectSamplerStates:lodMinClamps:lodMaxClamps:withRange:))]
1379        #[unsafe(method_family = none)]
1380        unsafe fn setObjectSamplerStates_lodMinClamps_lodMaxClamps_withRange(
1381            &self,
1382            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
1383            lod_min_clamps: NonNull<c_float>,
1384            lod_max_clamps: NonNull<c_float>,
1385            range: NSRange,
1386        );
1387
1388        /// Set the threadgroup memory byte length at the binding point specified by the index for all object shaders.
1389        ///
1390        /// # Safety
1391        ///
1392        /// `index` might not be bounds-checked.
1393        #[unsafe(method(setObjectThreadgroupMemoryLength:atIndex:))]
1394        #[unsafe(method_family = none)]
1395        unsafe fn setObjectThreadgroupMemoryLength_atIndex(
1396            &self,
1397            length: NSUInteger,
1398            index: NSUInteger,
1399        );
1400
1401        /// Set the data (by copy) for a given mesh shader buffer binding point.  This will remove any existing MTLBuffer from the binding point.
1402        ///
1403        /// # Safety
1404        ///
1405        /// - `bytes` must be a valid pointer.
1406        /// - `index` might not be bounds-checked.
1407        #[unsafe(method(setMeshBytes:length:atIndex:))]
1408        #[unsafe(method_family = none)]
1409        unsafe fn setMeshBytes_length_atIndex(
1410            &self,
1411            bytes: NonNull<c_void>,
1412            length: NSUInteger,
1413            index: NSUInteger,
1414        );
1415
1416        #[cfg(all(
1417            feature = "MTLAllocation",
1418            feature = "MTLBuffer",
1419            feature = "MTLResource"
1420        ))]
1421        /// Set a global buffer for all mesh shaders at the given bind point index.
1422        ///
1423        /// # Safety
1424        ///
1425        /// - `buffer` may need to be synchronized.
1426        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
1427        /// - `buffer` contents should be of the correct type.
1428        /// - `offset` might not be bounds-checked.
1429        /// - `index` might not be bounds-checked.
1430        #[unsafe(method(setMeshBuffer:offset:atIndex:))]
1431        #[unsafe(method_family = none)]
1432        unsafe fn setMeshBuffer_offset_atIndex(
1433            &self,
1434            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
1435            offset: NSUInteger,
1436            index: NSUInteger,
1437        );
1438
1439        /// Set the offset within the current global buffer for all mesh shaders at the given bind point index.
1440        ///
1441        /// # Safety
1442        ///
1443        /// - `offset` might not be bounds-checked.
1444        /// - `index` might not be bounds-checked.
1445        #[unsafe(method(setMeshBufferOffset:atIndex:))]
1446        #[unsafe(method_family = none)]
1447        unsafe fn setMeshBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);
1448
1449        #[cfg(all(
1450            feature = "MTLAllocation",
1451            feature = "MTLBuffer",
1452            feature = "MTLResource"
1453        ))]
1454        /// Set an array of global buffers for all mesh shaders with the given bind point range.
1455        ///
1456        /// # Safety
1457        ///
1458        /// - `buffers` must be a valid pointer.
1459        /// - `offsets` might not be bounds-checked.
1460        /// - `offsets` must be a valid pointer.
1461        /// - `range` might not be bounds-checked.
1462        #[unsafe(method(setMeshBuffers:offsets:withRange:))]
1463        #[unsafe(method_family = none)]
1464        unsafe fn setMeshBuffers_offsets_withRange(
1465            &self,
1466            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
1467            offsets: NonNull<NSUInteger>,
1468            range: NSRange,
1469        );
1470
1471        #[cfg(all(
1472            feature = "MTLAllocation",
1473            feature = "MTLResource",
1474            feature = "MTLTexture"
1475        ))]
1476        /// Set a global texture for all mesh shaders at the given bind point index.
1477        ///
1478        /// # Safety
1479        ///
1480        /// - `texture` may need to be synchronized.
1481        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
1482        /// - `index` might not be bounds-checked.
1483        #[unsafe(method(setMeshTexture:atIndex:))]
1484        #[unsafe(method_family = none)]
1485        unsafe fn setMeshTexture_atIndex(
1486            &self,
1487            texture: Option<&ProtocolObject<dyn MTLTexture>>,
1488            index: NSUInteger,
1489        );
1490
1491        #[cfg(all(
1492            feature = "MTLAllocation",
1493            feature = "MTLResource",
1494            feature = "MTLTexture"
1495        ))]
1496        /// Set an array of global textures for all mesh shaders with the given bind point range.
1497        ///
1498        /// # Safety
1499        ///
1500        /// - `textures` must be a valid pointer.
1501        /// - `range` might not be bounds-checked.
1502        #[unsafe(method(setMeshTextures:withRange:))]
1503        #[unsafe(method_family = none)]
1504        unsafe fn setMeshTextures_withRange(
1505            &self,
1506            textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
1507            range: NSRange,
1508        );
1509
1510        #[cfg(feature = "MTLSampler")]
1511        /// Set a global sampler for all mesh shaders at the given bind point index.
1512        ///
1513        /// # Safety
1514        ///
1515        /// `index` might not be bounds-checked.
1516        #[unsafe(method(setMeshSamplerState:atIndex:))]
1517        #[unsafe(method_family = none)]
1518        unsafe fn setMeshSamplerState_atIndex(
1519            &self,
1520            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
1521            index: NSUInteger,
1522        );
1523
1524        #[cfg(feature = "MTLSampler")]
1525        /// Set an array of global samplers for all mesh shaders with the given bind point range.
1526        ///
1527        /// # Safety
1528        ///
1529        /// - `samplers` must be a valid pointer.
1530        /// - `range` might not be bounds-checked.
1531        #[unsafe(method(setMeshSamplerStates:withRange:))]
1532        #[unsafe(method_family = none)]
1533        unsafe fn setMeshSamplerStates_withRange(
1534            &self,
1535            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
1536            range: NSRange,
1537        );
1538
1539        #[cfg(feature = "MTLSampler")]
1540        /// Set a global sampler for all mesh shaders at the given bind point index.
1541        ///
1542        /// # Safety
1543        ///
1544        /// `index` might not be bounds-checked.
1545        #[unsafe(method(setMeshSamplerState:lodMinClamp:lodMaxClamp:atIndex:))]
1546        #[unsafe(method_family = none)]
1547        unsafe fn setMeshSamplerState_lodMinClamp_lodMaxClamp_atIndex(
1548            &self,
1549            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
1550            lod_min_clamp: c_float,
1551            lod_max_clamp: c_float,
1552            index: NSUInteger,
1553        );
1554
1555        #[cfg(feature = "MTLSampler")]
1556        /// Set an array of global samplers for all mesh shaders with the given bind point range.
1557        ///
1558        /// # Safety
1559        ///
1560        /// - `samplers` must be a valid pointer.
1561        /// - `lod_min_clamps` must be a valid pointer.
1562        /// - `lod_max_clamps` must be a valid pointer.
1563        /// - `range` might not be bounds-checked.
1564        #[unsafe(method(setMeshSamplerStates:lodMinClamps:lodMaxClamps:withRange:))]
1565        #[unsafe(method_family = none)]
1566        unsafe fn setMeshSamplerStates_lodMinClamps_lodMaxClamps_withRange(
1567            &self,
1568            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
1569            lod_min_clamps: NonNull<c_float>,
1570            lod_max_clamps: NonNull<c_float>,
1571            range: NSRange,
1572        );
1573
1574        #[cfg(feature = "MTLTypes")]
1575        /// Enqueue a grid of object (if present) or mesh shader threadgroups.
1576        ///
1577        /// The dimensions of the threadgroups and the grid are specified directly.
1578        ///
1579        /// Parameter `threadgroupsPerGrid`: The number of threadgroups in the object (if present) or mesh shader grid.
1580        ///
1581        /// Parameter `threadsPerObjectThreadgroup`: The number of threads in one object shader threadgroup. Ignored if object shader is not present.
1582        ///
1583        /// Parameter `threadsPerMeshThreadgroup`: The number of threads in one mesh shader threadgroup.
1584        #[unsafe(method(drawMeshThreadgroups:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
1585        #[unsafe(method_family = none)]
1586        fn drawMeshThreadgroups_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
1587            &self,
1588            threadgroups_per_grid: MTLSize,
1589            threads_per_object_threadgroup: MTLSize,
1590            threads_per_mesh_threadgroup: MTLSize,
1591        );
1592
1593        #[cfg(feature = "MTLTypes")]
1594        /// Enqueue a grid of object (if present) of mesh shader threadgroups.
1595        ///
1596        /// The dimensions of the threadgroups and the grid are specified directly.
1597        /// The dimensions of threadsPerGrid does not have to be a multiple of threadsPerThreadgroup for object shaders.
1598        /// For mesh shaders, threadsPerGrid is rounded down to the neareset multiple of threadsPerMeshThreadgroup (in each dimension).
1599        ///
1600        /// Parameter `threadsPerGrid`: The number of threads in the object (if present) or mesh shader grid
1601        ///
1602        /// Parameter `threadsPerObjectThreadgroup`: The number of threads in one object shader threadgroup. Ignored if object shader is not present.
1603        ///
1604        /// Parameter `threadsPerMeshThreadgroup`: The number of threads in one mesh shader threadgroup.
1605        #[unsafe(method(drawMeshThreads:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
1606        #[unsafe(method_family = none)]
1607        fn drawMeshThreads_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
1608            &self,
1609            threads_per_grid: MTLSize,
1610            threads_per_object_threadgroup: MTLSize,
1611            threads_per_mesh_threadgroup: MTLSize,
1612        );
1613
1614        #[cfg(all(
1615            feature = "MTLAllocation",
1616            feature = "MTLBuffer",
1617            feature = "MTLResource",
1618            feature = "MTLTypes"
1619        ))]
1620        /// Enqueue a grid of object (if present) or mesh shader threadgroups.
1621        ///
1622        /// The dimensions of the threadgroups are specified directly, the dimensions of the grid, in threadgroups, are read from a buffer by the GPU.
1623        ///
1624        /// Parameter `indirectBuffer`: A buffer object that the device will read the grid size from, see MTLDispatchThreadgroupsIndirectArguments.
1625        ///
1626        /// Parameter `indirectBufferOffset`: Byte offset within
1627        /// _indirectBuffer_to read arguments from.
1628        /// _indirectBufferOffset_must be a multiple of 4.
1629        ///
1630        /// Parameter `threadsPerObjectThreadgroup`: The number of threads in one object shader threadgroup. Ignored if object shader is not present.
1631        ///
1632        /// Parameter `threadsPerMeshThreadgroup`: The number of threads in one mesh shader threadgroup.
1633        ///
1634        /// # Safety
1635        ///
1636        /// - `indirect_buffer` may need to be synchronized.
1637        /// - `indirect_buffer` may be unretained, you must ensure it is kept alive while in use.
1638        /// - `indirect_buffer` contents should be of the correct type.
1639        /// - `indirectBufferOffset` might not be bounds-checked.
1640        #[unsafe(method(drawMeshThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
1641        #[unsafe(method_family = none)]
1642        unsafe fn drawMeshThreadgroupsWithIndirectBuffer_indirectBufferOffset_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
1643            &self,
1644            indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
1645            indirect_buffer_offset: NSUInteger,
1646            threads_per_object_threadgroup: MTLSize,
1647            threads_per_mesh_threadgroup: MTLSize,
1648        );
1649
1650        /// Draw primitives without an index list.
1651        ///
1652        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
1653        ///
1654        /// Parameter `vertexStart`: For each instance, the first index to draw
1655        ///
1656        /// Parameter `vertexCount`: For each instance, the number of indexes to draw
1657        ///
1658        /// Parameter `instanceCount`: The number of instances drawn.
1659        ///
1660        /// # Safety
1661        ///
1662        /// - `vertexCount` might not be bounds-checked.
1663        /// - `instanceCount` might not be bounds-checked.
1664        #[unsafe(method(drawPrimitives:vertexStart:vertexCount:instanceCount:))]
1665        #[unsafe(method_family = none)]
1666        unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount(
1667            &self,
1668            primitive_type: MTLPrimitiveType,
1669            vertex_start: NSUInteger,
1670            vertex_count: NSUInteger,
1671            instance_count: NSUInteger,
1672        );
1673
1674        /// Draw primitives without an index list.
1675        ///
1676        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
1677        ///
1678        /// Parameter `vertexStart`: For each instance, the first index to draw
1679        ///
1680        /// Parameter `vertexCount`: For each instance, the number of indexes to draw
1681        ///
1682        /// # Safety
1683        ///
1684        /// `vertexCount` might not be bounds-checked.
1685        #[unsafe(method(drawPrimitives:vertexStart:vertexCount:))]
1686        #[unsafe(method_family = none)]
1687        unsafe fn drawPrimitives_vertexStart_vertexCount(
1688            &self,
1689            primitive_type: MTLPrimitiveType,
1690            vertex_start: NSUInteger,
1691            vertex_count: NSUInteger,
1692        );
1693
1694        #[cfg(all(
1695            feature = "MTLAllocation",
1696            feature = "MTLArgument",
1697            feature = "MTLBuffer",
1698            feature = "MTLResource"
1699        ))]
1700        /// Draw primitives with an index list.
1701        ///
1702        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
1703        ///
1704        /// Parameter `indexCount`: The number of indexes to read from the index buffer for each instance.
1705        ///
1706        /// Parameter `indexType`: The type if indexes, either 16 bit integer or 32 bit integer.
1707        ///
1708        /// Parameter `indexBuffer`: A buffer object that the device will read indexes from.
1709        ///
1710        /// Parameter `indexBufferOffset`: Byte offset within
1711        /// _indexBuffer_to start reading indexes from.
1712        /// _indexBufferOffset_must be a multiple of the index size.
1713        ///
1714        /// Parameter `instanceCount`: The number of instances drawn.
1715        ///
1716        /// # Safety
1717        ///
1718        /// - `indexCount` might not be bounds-checked.
1719        /// - `index_buffer` may need to be synchronized.
1720        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
1721        /// - `index_buffer` contents should be of the correct type.
1722        /// - `indexBufferOffset` might not be bounds-checked.
1723        /// - `instanceCount` might not be bounds-checked.
1724        #[unsafe(method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:))]
1725        #[unsafe(method_family = none)]
1726        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset_instanceCount(
1727            &self,
1728            primitive_type: MTLPrimitiveType,
1729            index_count: NSUInteger,
1730            index_type: MTLIndexType,
1731            index_buffer: &ProtocolObject<dyn MTLBuffer>,
1732            index_buffer_offset: NSUInteger,
1733            instance_count: NSUInteger,
1734        );
1735
1736        #[cfg(all(
1737            feature = "MTLAllocation",
1738            feature = "MTLArgument",
1739            feature = "MTLBuffer",
1740            feature = "MTLResource"
1741        ))]
1742        /// Draw primitives with an index list.
1743        ///
1744        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
1745        ///
1746        /// Parameter `indexCount`: The number of indexes to read from the index buffer for each instance.
1747        ///
1748        /// Parameter `indexType`: The type if indexes, either 16 bit integer or 32 bit integer.
1749        ///
1750        /// Parameter `indexBuffer`: A buffer object that the device will read indexes from.
1751        ///
1752        /// Parameter `indexBufferOffset`: Byte offset within
1753        /// _indexBuffer_to start reading indexes from.
1754        /// _indexBufferOffset_must be a multiple of the index size.
1755        ///
1756        /// # Safety
1757        ///
1758        /// - `indexCount` might not be bounds-checked.
1759        /// - `index_buffer` may need to be synchronized.
1760        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
1761        /// - `index_buffer` contents should be of the correct type.
1762        /// - `indexBufferOffset` might not be bounds-checked.
1763        #[unsafe(method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:))]
1764        #[unsafe(method_family = none)]
1765        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset(
1766            &self,
1767            primitive_type: MTLPrimitiveType,
1768            index_count: NSUInteger,
1769            index_type: MTLIndexType,
1770            index_buffer: &ProtocolObject<dyn MTLBuffer>,
1771            index_buffer_offset: NSUInteger,
1772        );
1773
1774        /// Draw primitives without an index list.
1775        ///
1776        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
1777        ///
1778        /// Parameter `vertexStart`: For each instance, the first index to draw
1779        ///
1780        /// Parameter `vertexCount`: For each instance, the number of indexes to draw
1781        ///
1782        /// Parameter `instanceCount`: The number of instances drawn.
1783        ///
1784        /// Parameter `baseInstance`: Offset for instance_id.
1785        ///
1786        /// # Safety
1787        ///
1788        /// - `vertexCount` might not be bounds-checked.
1789        /// - `instanceCount` might not be bounds-checked.
1790        #[unsafe(method(drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:))]
1791        #[unsafe(method_family = none)]
1792        unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance(
1793            &self,
1794            primitive_type: MTLPrimitiveType,
1795            vertex_start: NSUInteger,
1796            vertex_count: NSUInteger,
1797            instance_count: NSUInteger,
1798            base_instance: NSUInteger,
1799        );
1800
1801        #[cfg(all(
1802            feature = "MTLAllocation",
1803            feature = "MTLArgument",
1804            feature = "MTLBuffer",
1805            feature = "MTLResource"
1806        ))]
1807        /// Draw primitives with an index list.
1808        ///
1809        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
1810        ///
1811        /// Parameter `indexCount`: The number of indexes to read from the index buffer for each instance.
1812        ///
1813        /// Parameter `indexType`: The type if indexes, either 16 bit integer or 32 bit integer.
1814        ///
1815        /// Parameter `indexBuffer`: A buffer object that the device will read indexes from.
1816        ///
1817        /// Parameter `indexBufferOffset`: Byte offset within
1818        /// _indexBuffer_to start reading indexes from.
1819        /// _indexBufferOffset_must be a multiple of the index size.
1820        ///
1821        /// Parameter `instanceCount`: The number of instances drawn.
1822        ///
1823        /// Parameter `baseVertex`: Offset for vertex_id. NOTE: this can be negative
1824        ///
1825        /// Parameter `baseInstance`: Offset for instance_id.
1826        ///
1827        /// # Safety
1828        ///
1829        /// - `indexCount` might not be bounds-checked.
1830        /// - `index_buffer` may need to be synchronized.
1831        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
1832        /// - `index_buffer` contents should be of the correct type.
1833        /// - `indexBufferOffset` might not be bounds-checked.
1834        /// - `instanceCount` might not be bounds-checked.
1835        #[unsafe(method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:))]
1836        #[unsafe(method_family = none)]
1837        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset_instanceCount_baseVertex_baseInstance(
1838            &self,
1839            primitive_type: MTLPrimitiveType,
1840            index_count: NSUInteger,
1841            index_type: MTLIndexType,
1842            index_buffer: &ProtocolObject<dyn MTLBuffer>,
1843            index_buffer_offset: NSUInteger,
1844            instance_count: NSUInteger,
1845            base_vertex: NSInteger,
1846            base_instance: NSUInteger,
1847        );
1848
1849        #[cfg(all(
1850            feature = "MTLAllocation",
1851            feature = "MTLBuffer",
1852            feature = "MTLResource"
1853        ))]
1854        /// Draw primitives without an index list using an indirect buffer see MTLDrawPrimitivesIndirectArguments.
1855        ///
1856        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
1857        ///
1858        /// Parameter `indirectBuffer`: A buffer object that the device will read drawPrimitives arguments from, see MTLDrawPrimitivesIndirectArguments.
1859        ///
1860        /// Parameter `indirectBufferOffset`: Byte offset within
1861        /// _indirectBuffer_to start reading indexes from.
1862        /// _indirectBufferOffset_must be a multiple of 4.
1863        ///
1864        /// # Safety
1865        ///
1866        /// - `indirect_buffer` may need to be synchronized.
1867        /// - `indirect_buffer` may be unretained, you must ensure it is kept alive while in use.
1868        /// - `indirect_buffer` contents should be of the correct type.
1869        /// - `indirectBufferOffset` might not be bounds-checked.
1870        #[unsafe(method(drawPrimitives:indirectBuffer:indirectBufferOffset:))]
1871        #[unsafe(method_family = none)]
1872        unsafe fn drawPrimitives_indirectBuffer_indirectBufferOffset(
1873            &self,
1874            primitive_type: MTLPrimitiveType,
1875            indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
1876            indirect_buffer_offset: NSUInteger,
1877        );
1878
1879        #[cfg(all(
1880            feature = "MTLAllocation",
1881            feature = "MTLArgument",
1882            feature = "MTLBuffer",
1883            feature = "MTLResource"
1884        ))]
1885        /// Draw primitives with an index list using an indirect buffer see MTLDrawIndexedPrimitivesIndirectArguments.
1886        ///
1887        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
1888        ///
1889        /// Parameter `indexType`: The type if indexes, either 16 bit integer or 32 bit integer.
1890        ///
1891        /// Parameter `indexBuffer`: A buffer object that the device will read indexes from.
1892        ///
1893        /// Parameter `indexBufferOffset`: Byte offset within
1894        /// _indexBuffer_to start reading indexes from.
1895        /// _indexBufferOffset_must be a multiple of the index size.
1896        ///
1897        /// Parameter `indirectBuffer`: A buffer object that the device will read drawIndexedPrimitives arguments from, see MTLDrawIndexedPrimitivesIndirectArguments.
1898        ///
1899        /// Parameter `indirectBufferOffset`: Byte offset within
1900        /// _indirectBuffer_to start reading indexes from.
1901        /// _indirectBufferOffset_must be a multiple of 4.
1902        ///
1903        /// # Safety
1904        ///
1905        /// - `index_buffer` may need to be synchronized.
1906        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
1907        /// - `index_buffer` contents should be of the correct type.
1908        /// - `indexBufferOffset` might not be bounds-checked.
1909        /// - `indirect_buffer` may need to be synchronized.
1910        /// - `indirect_buffer` may be unretained, you must ensure it is kept alive while in use.
1911        /// - `indirect_buffer` contents should be of the correct type.
1912        /// - `indirectBufferOffset` might not be bounds-checked.
1913        #[unsafe(method(drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:))]
1914        #[unsafe(method_family = none)]
1915        unsafe fn drawIndexedPrimitives_indexType_indexBuffer_indexBufferOffset_indirectBuffer_indirectBufferOffset(
1916            &self,
1917            primitive_type: MTLPrimitiveType,
1918            index_type: MTLIndexType,
1919            index_buffer: &ProtocolObject<dyn MTLBuffer>,
1920            index_buffer_offset: NSUInteger,
1921            indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
1922            indirect_buffer_offset: NSUInteger,
1923        );
1924
1925        /// Ensure that following fragment shaders can read textures written by previous draw calls (in particular the framebuffer)
1926        #[deprecated]
1927        #[unsafe(method(textureBarrier))]
1928        #[unsafe(method_family = none)]
1929        fn textureBarrier(&self);
1930
1931        #[cfg(feature = "MTLFence")]
1932        /// Update the fence to capture all GPU work so far enqueued by this encoder for the given stages.
1933        ///
1934        /// Unlike
1935        /// <st
1936        /// >updateFence:
1937        /// </st
1938        /// >, this method will update the fence when the given stage(s) complete, allowing for commands to overlap in execution.
1939        /// On iOS, render command encoder fence updates are always delayed until the end of the encoder.
1940        #[unsafe(method(updateFence:afterStages:))]
1941        #[unsafe(method_family = none)]
1942        fn updateFence_afterStages(
1943            &self,
1944            fence: &ProtocolObject<dyn MTLFence>,
1945            stages: MTLRenderStages,
1946        );
1947
1948        #[cfg(feature = "MTLFence")]
1949        /// Prevent further GPU work until the fence is reached for the given stages.
1950        ///
1951        /// Unlike
1952        /// <st
1953        /// >waitForFence:
1954        /// </st
1955        /// >, this method will only block commands assoicated with the given stage(s), allowing for commands to overlap in execution.
1956        /// On iOS, render command encoder fence waits always occur the beginning of the encoder.
1957        #[unsafe(method(waitForFence:beforeStages:))]
1958        #[unsafe(method_family = none)]
1959        fn waitForFence_beforeStages(
1960            &self,
1961            fence: &ProtocolObject<dyn MTLFence>,
1962            stages: MTLRenderStages,
1963        );
1964
1965        #[cfg(all(
1966            feature = "MTLAllocation",
1967            feature = "MTLBuffer",
1968            feature = "MTLResource"
1969        ))]
1970        /// # Safety
1971        ///
1972        /// - `buffer` may need to be synchronized.
1973        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
1974        /// - `buffer` contents should be of the correct type.
1975        /// - `offset` might not be bounds-checked.
1976        /// - `instanceStride` might not be bounds-checked.
1977        #[unsafe(method(setTessellationFactorBuffer:offset:instanceStride:))]
1978        #[unsafe(method_family = none)]
1979        unsafe fn setTessellationFactorBuffer_offset_instanceStride(
1980            &self,
1981            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
1982            offset: NSUInteger,
1983            instance_stride: NSUInteger,
1984        );
1985
1986        #[unsafe(method(setTessellationFactorScale:))]
1987        #[unsafe(method_family = none)]
1988        fn setTessellationFactorScale(&self, scale: c_float);
1989
1990        #[cfg(all(
1991            feature = "MTLAllocation",
1992            feature = "MTLBuffer",
1993            feature = "MTLResource"
1994        ))]
1995        /// # Safety
1996        ///
1997        /// - `patchCount` might not be bounds-checked.
1998        /// - `patch_index_buffer` may need to be synchronized.
1999        /// - `patch_index_buffer` may be unretained, you must ensure it is kept alive while in use.
2000        /// - `patch_index_buffer` contents should be of the correct type.
2001        /// - `patchIndexBufferOffset` might not be bounds-checked.
2002        /// - `instanceCount` might not be bounds-checked.
2003        #[unsafe(method(drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:))]
2004        #[unsafe(method_family = none)]
2005        unsafe fn drawPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_instanceCount_baseInstance(
2006            &self,
2007            number_of_patch_control_points: NSUInteger,
2008            patch_start: NSUInteger,
2009            patch_count: NSUInteger,
2010            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
2011            patch_index_buffer_offset: NSUInteger,
2012            instance_count: NSUInteger,
2013            base_instance: NSUInteger,
2014        );
2015
2016        #[cfg(all(
2017            feature = "MTLAllocation",
2018            feature = "MTLBuffer",
2019            feature = "MTLResource"
2020        ))]
2021        /// # Safety
2022        ///
2023        /// - `patch_index_buffer` may need to be synchronized.
2024        /// - `patch_index_buffer` may be unretained, you must ensure it is kept alive while in use.
2025        /// - `patch_index_buffer` contents should be of the correct type.
2026        /// - `patchIndexBufferOffset` might not be bounds-checked.
2027        /// - `indirect_buffer` may need to be synchronized.
2028        /// - `indirect_buffer` may be unretained, you must ensure it is kept alive while in use.
2029        /// - `indirect_buffer` contents should be of the correct type.
2030        /// - `indirectBufferOffset` might not be bounds-checked.
2031        #[unsafe(method(drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:))]
2032        #[unsafe(method_family = none)]
2033        unsafe fn drawPatches_patchIndexBuffer_patchIndexBufferOffset_indirectBuffer_indirectBufferOffset(
2034            &self,
2035            number_of_patch_control_points: NSUInteger,
2036            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
2037            patch_index_buffer_offset: NSUInteger,
2038            indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
2039            indirect_buffer_offset: NSUInteger,
2040        );
2041
2042        #[cfg(all(
2043            feature = "MTLAllocation",
2044            feature = "MTLBuffer",
2045            feature = "MTLResource"
2046        ))]
2047        /// # Safety
2048        ///
2049        /// - `patchCount` might not be bounds-checked.
2050        /// - `patch_index_buffer` may need to be synchronized.
2051        /// - `patch_index_buffer` may be unretained, you must ensure it is kept alive while in use.
2052        /// - `patch_index_buffer` contents should be of the correct type.
2053        /// - `patchIndexBufferOffset` might not be bounds-checked.
2054        /// - `control_point_index_buffer` may need to be synchronized.
2055        /// - `control_point_index_buffer` may be unretained, you must ensure it is kept alive while in use.
2056        /// - `control_point_index_buffer` contents should be of the correct type.
2057        /// - `controlPointIndexBufferOffset` might not be bounds-checked.
2058        /// - `instanceCount` might not be bounds-checked.
2059        #[unsafe(method(drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:))]
2060        #[unsafe(method_family = none)]
2061        unsafe fn drawIndexedPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_controlPointIndexBuffer_controlPointIndexBufferOffset_instanceCount_baseInstance(
2062            &self,
2063            number_of_patch_control_points: NSUInteger,
2064            patch_start: NSUInteger,
2065            patch_count: NSUInteger,
2066            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
2067            patch_index_buffer_offset: NSUInteger,
2068            control_point_index_buffer: &ProtocolObject<dyn MTLBuffer>,
2069            control_point_index_buffer_offset: NSUInteger,
2070            instance_count: NSUInteger,
2071            base_instance: NSUInteger,
2072        );
2073
2074        #[cfg(all(
2075            feature = "MTLAllocation",
2076            feature = "MTLBuffer",
2077            feature = "MTLResource"
2078        ))]
2079        /// # Safety
2080        ///
2081        /// - `patch_index_buffer` may need to be synchronized.
2082        /// - `patch_index_buffer` may be unretained, you must ensure it is kept alive while in use.
2083        /// - `patch_index_buffer` contents should be of the correct type.
2084        /// - `patchIndexBufferOffset` might not be bounds-checked.
2085        /// - `control_point_index_buffer` may need to be synchronized.
2086        /// - `control_point_index_buffer` may be unretained, you must ensure it is kept alive while in use.
2087        /// - `control_point_index_buffer` contents should be of the correct type.
2088        /// - `controlPointIndexBufferOffset` might not be bounds-checked.
2089        /// - `indirect_buffer` may need to be synchronized.
2090        /// - `indirect_buffer` may be unretained, you must ensure it is kept alive while in use.
2091        /// - `indirect_buffer` contents should be of the correct type.
2092        /// - `indirectBufferOffset` might not be bounds-checked.
2093        #[unsafe(method(drawIndexedPatches:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:indirectBuffer:indirectBufferOffset:))]
2094        #[unsafe(method_family = none)]
2095        unsafe fn drawIndexedPatches_patchIndexBuffer_patchIndexBufferOffset_controlPointIndexBuffer_controlPointIndexBufferOffset_indirectBuffer_indirectBufferOffset(
2096            &self,
2097            number_of_patch_control_points: NSUInteger,
2098            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
2099            patch_index_buffer_offset: NSUInteger,
2100            control_point_index_buffer: &ProtocolObject<dyn MTLBuffer>,
2101            control_point_index_buffer_offset: NSUInteger,
2102            indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
2103            indirect_buffer_offset: NSUInteger,
2104        );
2105
2106        /// The width of the tile for this render pass.
2107        #[unsafe(method(tileWidth))]
2108        #[unsafe(method_family = none)]
2109        fn tileWidth(&self) -> NSUInteger;
2110
2111        /// The height of the tile for this render pass.
2112        #[unsafe(method(tileHeight))]
2113        #[unsafe(method_family = none)]
2114        fn tileHeight(&self) -> NSUInteger;
2115
2116        /// Set the data (by copy) for a given tile buffer binding point.  This will remove any existing MTLBuffer from the binding point.
2117        ///
2118        /// # Safety
2119        ///
2120        /// - `bytes` must be a valid pointer.
2121        /// - `index` might not be bounds-checked.
2122        #[unsafe(method(setTileBytes:length:atIndex:))]
2123        #[unsafe(method_family = none)]
2124        unsafe fn setTileBytes_length_atIndex(
2125            &self,
2126            bytes: NonNull<c_void>,
2127            length: NSUInteger,
2128            index: NSUInteger,
2129        );
2130
2131        #[cfg(all(
2132            feature = "MTLAllocation",
2133            feature = "MTLBuffer",
2134            feature = "MTLResource"
2135        ))]
2136        /// Set a global buffer for all tile shaders at the given bind point index.
2137        ///
2138        /// # Safety
2139        ///
2140        /// - `buffer` may need to be synchronized.
2141        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
2142        /// - `buffer` contents should be of the correct type.
2143        /// - `offset` might not be bounds-checked.
2144        /// - `index` might not be bounds-checked.
2145        #[unsafe(method(setTileBuffer:offset:atIndex:))]
2146        #[unsafe(method_family = none)]
2147        unsafe fn setTileBuffer_offset_atIndex(
2148            &self,
2149            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
2150            offset: NSUInteger,
2151            index: NSUInteger,
2152        );
2153
2154        /// Set the offset within the current global buffer for all tile shaders at the given bind point index.
2155        ///
2156        /// # Safety
2157        ///
2158        /// - `offset` might not be bounds-checked.
2159        /// - `index` might not be bounds-checked.
2160        #[unsafe(method(setTileBufferOffset:atIndex:))]
2161        #[unsafe(method_family = none)]
2162        unsafe fn setTileBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);
2163
2164        #[cfg(all(
2165            feature = "MTLAllocation",
2166            feature = "MTLBuffer",
2167            feature = "MTLResource"
2168        ))]
2169        /// Set an array of global buffers for all tile shaders with the given bind point range.
2170        ///
2171        /// # Safety
2172        ///
2173        /// - `buffers` must be a valid pointer.
2174        /// - `offsets` might not be bounds-checked.
2175        /// - `offsets` must be a valid pointer.
2176        /// - `range` might not be bounds-checked.
2177        #[unsafe(method(setTileBuffers:offsets:withRange:))]
2178        #[unsafe(method_family = none)]
2179        unsafe fn setTileBuffers_offsets_withRange(
2180            &self,
2181            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
2182            offsets: NonNull<NSUInteger>,
2183            range: NSRange,
2184        );
2185
2186        #[cfg(all(
2187            feature = "MTLAllocation",
2188            feature = "MTLResource",
2189            feature = "MTLTexture"
2190        ))]
2191        /// Set a global texture for all tile shaders at the given bind point index.
2192        ///
2193        /// # Safety
2194        ///
2195        /// - `texture` may need to be synchronized.
2196        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
2197        /// - `index` might not be bounds-checked.
2198        #[unsafe(method(setTileTexture:atIndex:))]
2199        #[unsafe(method_family = none)]
2200        unsafe fn setTileTexture_atIndex(
2201            &self,
2202            texture: Option<&ProtocolObject<dyn MTLTexture>>,
2203            index: NSUInteger,
2204        );
2205
2206        #[cfg(all(
2207            feature = "MTLAllocation",
2208            feature = "MTLResource",
2209            feature = "MTLTexture"
2210        ))]
2211        /// Set an array of global textures for all tile shaders with the given bind point range.
2212        ///
2213        /// # Safety
2214        ///
2215        /// - `textures` must be a valid pointer.
2216        /// - `range` might not be bounds-checked.
2217        #[unsafe(method(setTileTextures:withRange:))]
2218        #[unsafe(method_family = none)]
2219        unsafe fn setTileTextures_withRange(
2220            &self,
2221            textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
2222            range: NSRange,
2223        );
2224
2225        #[cfg(feature = "MTLSampler")]
2226        /// Set a global sampler for all tile shaders at the given bind point index.
2227        ///
2228        /// # Safety
2229        ///
2230        /// `index` might not be bounds-checked.
2231        #[unsafe(method(setTileSamplerState:atIndex:))]
2232        #[unsafe(method_family = none)]
2233        unsafe fn setTileSamplerState_atIndex(
2234            &self,
2235            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
2236            index: NSUInteger,
2237        );
2238
2239        #[cfg(feature = "MTLSampler")]
2240        /// Set an array of global samplers for all fragment shaders with the given bind point range.
2241        ///
2242        /// # Safety
2243        ///
2244        /// - `samplers` must be a valid pointer.
2245        /// - `range` might not be bounds-checked.
2246        #[unsafe(method(setTileSamplerStates:withRange:))]
2247        #[unsafe(method_family = none)]
2248        unsafe fn setTileSamplerStates_withRange(
2249            &self,
2250            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
2251            range: NSRange,
2252        );
2253
2254        #[cfg(feature = "MTLSampler")]
2255        /// Set a global sampler for all tile shaders at the given bind point index.
2256        ///
2257        /// # Safety
2258        ///
2259        /// `index` might not be bounds-checked.
2260        #[unsafe(method(setTileSamplerState:lodMinClamp:lodMaxClamp:atIndex:))]
2261        #[unsafe(method_family = none)]
2262        unsafe fn setTileSamplerState_lodMinClamp_lodMaxClamp_atIndex(
2263            &self,
2264            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
2265            lod_min_clamp: c_float,
2266            lod_max_clamp: c_float,
2267            index: NSUInteger,
2268        );
2269
2270        #[cfg(feature = "MTLSampler")]
2271        /// Set an array of global samplers for all tile shaders with the given bind point range.
2272        ///
2273        /// # Safety
2274        ///
2275        /// - `samplers` must be a valid pointer.
2276        /// - `lod_min_clamps` must be a valid pointer.
2277        /// - `lod_max_clamps` must be a valid pointer.
2278        /// - `range` might not be bounds-checked.
2279        #[unsafe(method(setTileSamplerStates:lodMinClamps:lodMaxClamps:withRange:))]
2280        #[unsafe(method_family = none)]
2281        unsafe fn setTileSamplerStates_lodMinClamps_lodMaxClamps_withRange(
2282            &self,
2283            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
2284            lod_min_clamps: NonNull<c_float>,
2285            lod_max_clamps: NonNull<c_float>,
2286            range: NSRange,
2287        );
2288
2289        #[cfg(all(
2290            feature = "MTLAllocation",
2291            feature = "MTLResource",
2292            feature = "MTLVisibleFunctionTable"
2293        ))]
2294        /// Set a global visible function table for all tile shaders at the given buffer bind point index.
2295        ///
2296        /// # Safety
2297        ///
2298        /// - `function_table` may need to be synchronized.
2299        /// - `function_table` may be unretained, you must ensure it is kept alive while in use.
2300        /// - `bufferIndex` might not be bounds-checked.
2301        #[unsafe(method(setTileVisibleFunctionTable:atBufferIndex:))]
2302        #[unsafe(method_family = none)]
2303        unsafe fn setTileVisibleFunctionTable_atBufferIndex(
2304            &self,
2305            function_table: Option<&ProtocolObject<dyn MTLVisibleFunctionTable>>,
2306            buffer_index: NSUInteger,
2307        );
2308
2309        #[cfg(all(
2310            feature = "MTLAllocation",
2311            feature = "MTLResource",
2312            feature = "MTLVisibleFunctionTable"
2313        ))]
2314        /// Set an array of global visible function tables for all tile shaders with the given buffer bind point range.
2315        ///
2316        /// # Safety
2317        ///
2318        /// - `function_tables` must be a valid pointer.
2319        /// - `range` might not be bounds-checked.
2320        #[unsafe(method(setTileVisibleFunctionTables:withBufferRange:))]
2321        #[unsafe(method_family = none)]
2322        unsafe fn setTileVisibleFunctionTables_withBufferRange(
2323            &self,
2324            function_tables: NonNull<*const ProtocolObject<dyn MTLVisibleFunctionTable>>,
2325            range: NSRange,
2326        );
2327
2328        #[cfg(all(
2329            feature = "MTLAllocation",
2330            feature = "MTLIntersectionFunctionTable",
2331            feature = "MTLResource"
2332        ))]
2333        /// Set a global intersection function table for all tile shaders at the given buffer bind point index.
2334        ///
2335        /// # Safety
2336        ///
2337        /// - `intersection_function_table` may need to be synchronized.
2338        /// - `intersection_function_table` may be unretained, you must ensure it is kept alive while in use.
2339        /// - `bufferIndex` might not be bounds-checked.
2340        #[unsafe(method(setTileIntersectionFunctionTable:atBufferIndex:))]
2341        #[unsafe(method_family = none)]
2342        unsafe fn setTileIntersectionFunctionTable_atBufferIndex(
2343            &self,
2344            intersection_function_table: Option<&ProtocolObject<dyn MTLIntersectionFunctionTable>>,
2345            buffer_index: NSUInteger,
2346        );
2347
2348        #[cfg(all(
2349            feature = "MTLAllocation",
2350            feature = "MTLIntersectionFunctionTable",
2351            feature = "MTLResource"
2352        ))]
2353        /// Set an array of global intersection function tables for all tile shaders with the given buffer bind point range.
2354        ///
2355        /// # Safety
2356        ///
2357        /// - `intersection_function_tables` must be a valid pointer.
2358        /// - `range` might not be bounds-checked.
2359        #[unsafe(method(setTileIntersectionFunctionTables:withBufferRange:))]
2360        #[unsafe(method_family = none)]
2361        unsafe fn setTileIntersectionFunctionTables_withBufferRange(
2362            &self,
2363            intersection_function_tables: NonNull<
2364                *const ProtocolObject<dyn MTLIntersectionFunctionTable>,
2365            >,
2366            range: NSRange,
2367        );
2368
2369        #[cfg(all(
2370            feature = "MTLAccelerationStructure",
2371            feature = "MTLAllocation",
2372            feature = "MTLResource"
2373        ))]
2374        /// Set a global acceleration structure for all tile shaders at the given buffer bind point index.
2375        ///
2376        /// # Safety
2377        ///
2378        /// - `acceleration_structure` may need to be synchronized.
2379        /// - `acceleration_structure` may be unretained, you must ensure it is kept alive while in use.
2380        /// - `bufferIndex` might not be bounds-checked.
2381        #[unsafe(method(setTileAccelerationStructure:atBufferIndex:))]
2382        #[unsafe(method_family = none)]
2383        unsafe fn setTileAccelerationStructure_atBufferIndex(
2384            &self,
2385            acceleration_structure: Option<&ProtocolObject<dyn MTLAccelerationStructure>>,
2386            buffer_index: NSUInteger,
2387        );
2388
2389        #[cfg(feature = "MTLTypes")]
2390        /// dispatch threads to perform a mid-render compute operation.
2391        #[unsafe(method(dispatchThreadsPerTile:))]
2392        #[unsafe(method_family = none)]
2393        fn dispatchThreadsPerTile(&self, threads_per_tile: MTLSize);
2394
2395        /// Set the size of the threadgroup memory argument at the given bind point index and offset.
2396        ///
2397        /// # Safety
2398        ///
2399        /// - `offset` might not be bounds-checked.
2400        /// - `index` might not be bounds-checked.
2401        #[unsafe(method(setThreadgroupMemoryLength:offset:atIndex:))]
2402        #[unsafe(method_family = none)]
2403        unsafe fn setThreadgroupMemoryLength_offset_atIndex(
2404            &self,
2405            length: NSUInteger,
2406            offset: NSUInteger,
2407            index: NSUInteger,
2408        );
2409
2410        #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
2411        /// Declare that a resource may be accessed by the render pass through an argument buffer
2412        ///
2413        /// This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resource through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
2414        ///
2415        /// Note that calling useResource does not retain the resource. It is the responsiblity of the user to retain the resource until
2416        /// the command buffer has been executed.
2417        #[deprecated]
2418        #[unsafe(method(useResource:usage:))]
2419        #[unsafe(method_family = none)]
2420        fn useResource_usage(
2421            &self,
2422            resource: &ProtocolObject<dyn MTLResource>,
2423            usage: MTLResourceUsage,
2424        );
2425
2426        #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
2427        /// Declare that an array of resources may be accessed through an argument buffer by the render pass
2428        ///
2429        /// This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
2430        ///
2431        /// Note that calling useResources does not retain the resources. It is the responsiblity of the user to retain the resources until
2432        /// the command buffer has been executed.
2433        ///
2434        /// # Safety
2435        ///
2436        /// - `resources` must be a valid pointer.
2437        /// - `count` might not be bounds-checked.
2438        #[deprecated]
2439        #[unsafe(method(useResources:count:usage:))]
2440        #[unsafe(method_family = none)]
2441        unsafe fn useResources_count_usage(
2442            &self,
2443            resources: NonNull<NonNull<ProtocolObject<dyn MTLResource>>>,
2444            count: NSUInteger,
2445            usage: MTLResourceUsage,
2446        );
2447
2448        #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
2449        /// Declare that a resource may be accessed by the render pass through an argument buffer
2450        ///
2451        /// For hazard tracked resources, this method protects against data hazards. This method must be called before encoding any draw commands which may access the resource through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
2452        ///
2453        /// Note that calling useResource does not retain the resource. It is the responsiblity of the user to retain the resource until
2454        /// the command buffer has been executed.
2455        #[unsafe(method(useResource:usage:stages:))]
2456        #[unsafe(method_family = none)]
2457        fn useResource_usage_stages(
2458            &self,
2459            resource: &ProtocolObject<dyn MTLResource>,
2460            usage: MTLResourceUsage,
2461            stages: MTLRenderStages,
2462        );
2463
2464        #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
2465        /// Declare that an array of resources may be accessed through an argument buffer by the render pass
2466        ///
2467        /// For hazard tracked resources, this method protects against data hazards.  This method must be called before encoding any draw commands which may access the resources through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
2468        ///
2469        /// Note that calling useResources does not retain the resources. It is the responsiblity of the user to retain the resources until
2470        /// the command buffer has been executed.
2471        ///
2472        /// # Safety
2473        ///
2474        /// - `resources` must be a valid pointer.
2475        /// - `count` might not be bounds-checked.
2476        #[unsafe(method(useResources:count:usage:stages:))]
2477        #[unsafe(method_family = none)]
2478        unsafe fn useResources_count_usage_stages(
2479            &self,
2480            resources: NonNull<NonNull<ProtocolObject<dyn MTLResource>>>,
2481            count: NSUInteger,
2482            usage: MTLResourceUsage,
2483            stages: MTLRenderStages,
2484        );
2485
2486        #[cfg(all(feature = "MTLAllocation", feature = "MTLHeap"))]
2487        /// Declare that the resources allocated from a heap may be accessed by the render pass through an argument buffer
2488        ///
2489        /// This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heap through an argument buffer. This method may cause all of the color attachments allocated from the heap to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
2490        #[deprecated]
2491        #[unsafe(method(useHeap:))]
2492        #[unsafe(method_family = none)]
2493        fn useHeap(&self, heap: &ProtocolObject<dyn MTLHeap>);
2494
2495        #[cfg(all(feature = "MTLAllocation", feature = "MTLHeap"))]
2496        /// Declare that the resources allocated from an array of heaps may be accessed by the render pass through an argument buffer
2497        ///
2498        /// This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heaps through an argument buffer. This method may cause all of the color attachments allocated from the heaps to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
2499        ///
2500        /// # Safety
2501        ///
2502        /// - `heaps` must be a valid pointer.
2503        /// - `count` might not be bounds-checked.
2504        #[deprecated]
2505        #[unsafe(method(useHeaps:count:))]
2506        #[unsafe(method_family = none)]
2507        unsafe fn useHeaps_count(
2508            &self,
2509            heaps: NonNull<NonNull<ProtocolObject<dyn MTLHeap>>>,
2510            count: NSUInteger,
2511        );
2512
2513        #[cfg(all(feature = "MTLAllocation", feature = "MTLHeap"))]
2514        /// Declare that the resources allocated from a heap may be accessed by the render pass through an argument buffer
2515        ///
2516        /// If the heap is tracked, this method protects against hazard tracking; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heap through an argument buffer. This method may cause all of the color attachments allocated from the heap to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
2517        #[unsafe(method(useHeap:stages:))]
2518        #[unsafe(method_family = none)]
2519        fn useHeap_stages(&self, heap: &ProtocolObject<dyn MTLHeap>, stages: MTLRenderStages);
2520
2521        #[cfg(all(feature = "MTLAllocation", feature = "MTLHeap"))]
2522        /// Declare that the resources allocated from an array of heaps may be accessed by the render pass through an argument buffer
2523        ///
2524        /// This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heaps through an argument buffer. This method may cause all of the color attachments allocated from the heaps to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
2525        ///
2526        /// # Safety
2527        ///
2528        /// - `heaps` must be a valid pointer.
2529        /// - `count` might not be bounds-checked.
2530        #[unsafe(method(useHeaps:count:stages:))]
2531        #[unsafe(method_family = none)]
2532        unsafe fn useHeaps_count_stages(
2533            &self,
2534            heaps: NonNull<NonNull<ProtocolObject<dyn MTLHeap>>>,
2535            count: NSUInteger,
2536            stages: MTLRenderStages,
2537        );
2538
2539        #[cfg(all(
2540            feature = "MTLAllocation",
2541            feature = "MTLIndirectCommandBuffer",
2542            feature = "MTLResource"
2543        ))]
2544        /// Execute commands in the buffer within the range specified.
2545        ///
2546        /// The same indirect command buffer may be executed any number of times within the same encoder.
2547        ///
2548        /// # Safety
2549        ///
2550        /// - `indirect_command_buffer` may need to be synchronized.
2551        /// - `indirect_command_buffer` may be unretained, you must ensure it is kept alive while in use.
2552        /// - `executionRange` might not be bounds-checked.
2553        #[unsafe(method(executeCommandsInBuffer:withRange:))]
2554        #[unsafe(method_family = none)]
2555        unsafe fn executeCommandsInBuffer_withRange(
2556            &self,
2557            indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
2558            execution_range: NSRange,
2559        );
2560
2561        #[cfg(all(
2562            feature = "MTLAllocation",
2563            feature = "MTLBuffer",
2564            feature = "MTLIndirectCommandBuffer",
2565            feature = "MTLResource"
2566        ))]
2567        /// Execute commands in the buffer within the range specified by the indirect range buffer.
2568        ///
2569        /// Parameter `indirectRangeBuffer`: An indirect buffer from which the device reads the execution range parameter, as laid out in the MTLIndirectCommandBufferExecutionRange structure.
2570        ///
2571        /// Parameter `indirectBufferOffset`: The byte offset within indirectBuffer where the execution range parameter is located. Must be a multiple of 4 bytes.
2572        ///
2573        /// The same indirect command buffer may be executed any number of times within the same encoder.
2574        ///
2575        /// # Safety
2576        ///
2577        /// - `indirect_commandbuffer` may need to be synchronized.
2578        /// - `indirect_commandbuffer` may be unretained, you must ensure it is kept alive while in use.
2579        /// - `indirect_range_buffer` may need to be synchronized.
2580        /// - `indirect_range_buffer` may be unretained, you must ensure it is kept alive while in use.
2581        /// - `indirect_range_buffer` contents should be of the correct type.
2582        /// - `indirectBufferOffset` might not be bounds-checked.
2583        #[unsafe(method(executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:))]
2584        #[unsafe(method_family = none)]
2585        unsafe fn executeCommandsInBuffer_indirectBuffer_indirectBufferOffset(
2586            &self,
2587            indirect_commandbuffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
2588            indirect_range_buffer: &ProtocolObject<dyn MTLBuffer>,
2589            indirect_buffer_offset: NSUInteger,
2590        );
2591
2592        /// Make stores to memory encoded before the barrier coherent with loads from memory encoded after the barrier.
2593        ///
2594        /// The barrier makes stores coherent that 1) are to a resource with a type in the given scope, and 2) happen at (or before) the stage given by afterStages. Only affects loads that happen at (or after) the stage given by beforeStages.
2595        #[unsafe(method(memoryBarrierWithScope:afterStages:beforeStages:))]
2596        #[unsafe(method_family = none)]
2597        fn memoryBarrierWithScope_afterStages_beforeStages(
2598            &self,
2599            scope: MTLBarrierScope,
2600            after: MTLRenderStages,
2601            before: MTLRenderStages,
2602        );
2603
2604        #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
2605        /// Make stores to memory encoded before the barrier coherent with loads from memory encoded after the barrier.
2606        ///
2607        /// The barrier makes stores coherent that 1) are to resources in given array, and 2) happen at (or before) the stage given by afterStages. Only affects loads that happen at (or after) the stage give by beforeStages.
2608        ///
2609        /// # Safety
2610        ///
2611        /// - `resources` must be a valid pointer.
2612        /// - `count` might not be bounds-checked.
2613        #[unsafe(method(memoryBarrierWithResources:count:afterStages:beforeStages:))]
2614        #[unsafe(method_family = none)]
2615        unsafe fn memoryBarrierWithResources_count_afterStages_beforeStages(
2616            &self,
2617            resources: NonNull<NonNull<ProtocolObject<dyn MTLResource>>>,
2618            count: NSUInteger,
2619            after: MTLRenderStages,
2620            before: MTLRenderStages,
2621        );
2622
2623        #[cfg(feature = "MTLCounters")]
2624        /// Sample hardware counters at this point in the render encoder and
2625        /// store the counter sample into the sample buffer at the specified index.
2626        ///
2627        /// Parameter `sampleBuffer`: The sample buffer to sample into
2628        ///
2629        /// Parameter `sampleIndex`: The index into the counter buffer to write the sample.
2630        ///
2631        /// Parameter `barrier`: Insert a barrier before taking the sample.  Passing
2632        /// YES will ensure that all work encoded before this operation in the encoder is
2633        /// complete but does not isolate the work with respect to other encoders.  Passing
2634        /// NO will allow the sample to be taken concurrently with other operations in this
2635        /// encoder.
2636        /// In general, passing YES will lead to more repeatable counter results but
2637        /// may negatively impact performance.  Passing NO will generally be higher performance
2638        /// but counter results may not be repeatable.
2639        ///
2640        /// # Safety
2641        ///
2642        /// `sampleIndex` might not be bounds-checked.
2643        #[unsafe(method(sampleCountersInBuffer:atSampleIndex:withBarrier:))]
2644        #[unsafe(method_family = none)]
2645        unsafe fn sampleCountersInBuffer_atSampleIndex_withBarrier(
2646            &self,
2647            sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>,
2648            sample_index: NSUInteger,
2649            barrier: bool,
2650        );
2651
2652        #[cfg(feature = "MTLRenderPipeline")]
2653        /// Sets the mapping from logical shader color output to physical render pass color attachments.
2654        ///
2655        /// Use this method to define how the physical color attachments you specify via ``MTLRenderPassDescriptor/colorAttachments``
2656        /// map to the logical color output the fragment shader writes to.
2657        ///
2658        /// To use this feature, make sure to set ``MTLRenderPassDescriptor/supportColorAttachmentMapping`` to
2659        /// <doc
2660        /// ://com.apple.documentation/documentation/swift/true>.
2661        ///
2662        /// - Parameter mapping: Mapping from logical shader outputs to physical outputs.
2663        #[unsafe(method(setColorAttachmentMap:))]
2664        #[unsafe(method_family = none)]
2665        fn setColorAttachmentMap(&self, mapping: Option<&MTLLogicalToPhysicalColorAttachmentMap>);
2666    }
2667);