objc2_metal/generated/
MTL4RenderCommandEncoder.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/// Custom render pass options you specify at encoder creation time.
11///
12/// Use these options to implement parallel encoding of render passes across multiple CPU threads by providing these
13/// values to the `options` parameter of ``MTL4CommandBuffer/renderCommandEncoderWithDescriptor:options:`` and
14/// observing these requirements:
15///
16/// 1. Commit all command encoders together in an array you provide to ``MTL4CommandQueue/commit:count:`` or ``MTL4CommandQueue/commit:count:options:``
17/// 2. The first command buffer in the array contains a render pass that you start with option ``MTL4RenderEncoderOptionSuspending``
18/// 3. The last command buffer in the array contains the same render pass that you start with option ``MTL4RenderEncoderOptionResuming``
19/// 4. All intermediate command buffers between the first and last in the array contain the same render pass that you
20/// start with both ``MTL4RenderEncoderOptionResuming`` and ``MTL4RenderEncoderOptionSuspending`` options.
21/// 5. The sequence of render passes, in submission order, doesn't intermix with compute, blit, acceleration structure
22/// or machine learning encoding.
23/// 6. A command buffer shouldn't contain a render pass that you start with option ``MTL4RenderEncoderOptionSuspending`` if
24/// it already contains a render pass that you start with option ``MTL4RenderEncoderOptionResuming``.
25///
26/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderencoderoptions?language=objc)
27// NS_OPTIONS
28#[repr(transparent)]
29#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
30pub struct MTL4RenderEncoderOptions(pub NSUInteger);
31bitflags::bitflags! {
32    impl MTL4RenderEncoderOptions: NSUInteger {
33/// Declares that this render pass doesn't suspend nor resume.
34        #[doc(alias = "MTL4RenderEncoderOptionNone")]
35        const None = 0;
36/// Configures the render pass as *suspending*.
37///
38/// Pass this option to ``MTL4CommandBuffer/renderCommandEncoderWithDescriptor:options:`` to specify that Metal can
39/// stitch the work a render command encoder encodes with a subsequent "resuming" render command encoder.
40        #[doc(alias = "MTL4RenderEncoderOptionSuspending")]
41        const Suspending = 1<<0;
42/// Configures the render pass to as *resuming*.
43///
44/// Pass this option to ``MTL4CommandBuffer/renderCommandEncoderWithDescriptor:options:`` to specify that Metal can
45/// stitch the work a render command encoder encodes with a prior "suspending" render command encoder.
46        #[doc(alias = "MTL4RenderEncoderOptionResuming")]
47        const Resuming = 1<<1;
48    }
49}
50
51unsafe impl Encode for MTL4RenderEncoderOptions {
52    const ENCODING: Encoding = NSUInteger::ENCODING;
53}
54
55unsafe impl RefEncode for MTL4RenderEncoderOptions {
56    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
57}
58
59extern_protocol!(
60    /// Encodes a render pass into a command buffer, including all its draw calls and configuration.
61    ///
62    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4rendercommandencoder?language=objc)
63    #[cfg(feature = "MTL4CommandEncoder")]
64    pub unsafe trait MTL4RenderCommandEncoder: MTL4CommandEncoder {
65        /// Sets the width of a tile for this render pass.
66        #[unsafe(method(tileWidth))]
67        #[unsafe(method_family = none)]
68        fn tileWidth(&self) -> NSUInteger;
69
70        /// Sets the height of a tile for this render pass.
71        #[unsafe(method(tileHeight))]
72        #[unsafe(method_family = none)]
73        fn tileHeight(&self) -> NSUInteger;
74
75        #[cfg(feature = "MTLRenderPipeline")]
76        /// Sets the mapping from logical shader color output to physical render pass color attachments.
77        ///
78        /// Use this method to define how the physical color attachments you specify via ``MTL4RenderPassDescriptor/colorAttachments``
79        /// map to the logical color output the fragment shader writes to.
80        ///
81        /// To use this feature, make sure to set ``MTL4RenderPassDescriptor/supportColorAttachmentMapping`` to
82        /// <doc
83        /// ://com.apple.documentation/documentation/swift/true>.
84        ///
85        /// - Parameter mapping: Mapping from logical shader outputs to physical outputs.
86        #[unsafe(method(setColorAttachmentMap:))]
87        #[unsafe(method_family = none)]
88        fn setColorAttachmentMap(&self, mapping: Option<&MTLLogicalToPhysicalColorAttachmentMap>);
89
90        #[cfg(all(feature = "MTLAllocation", feature = "MTLRenderPipeline"))]
91        /// Configures this encoder with a render pipeline state that applies to your subsequent draw commands.
92        ///
93        /// - Parameter pipelineState: a non-`nil` ``MTLRenderPipelineState`` instance.
94        #[unsafe(method(setRenderPipelineState:))]
95        #[unsafe(method_family = none)]
96        fn setRenderPipelineState(
97            &self,
98            pipeline_state: &ProtocolObject<dyn MTLRenderPipelineState>,
99        );
100
101        #[cfg(feature = "MTLRenderCommandEncoder")]
102        /// Sets the viewport which that transforms vertices from normalized device coordinates to window coordinates.
103        ///
104        /// Metal clips fragments that lie outside this viewport, and optionally clamps fragments outside of z-near/z-far range
105        /// depending on the value you assign to ``setDepthClipMode:``.
106        ///
107        /// - Parameter viewport: ``MTLViewport`` to set.
108        #[unsafe(method(setViewport:))]
109        #[unsafe(method_family = none)]
110        fn setViewport(&self, viewport: MTLViewport);
111
112        #[cfg(feature = "MTLRenderCommandEncoder")]
113        /// Sets an array of viewports to transform vertices from normalized device coordinates to window coordinates.
114        ///
115        /// Metal clips fragments that lie outside of the viewport, and optionally clamps fragments outside of z-near/z-far range,
116        /// depending on the value you assign to ``setDepthClipMode:``.
117        ///
118        /// Metal selects the viewport to use from the `[[ viewport_array_index ]]` attribute you specify in the pipeline
119        /// state's vertex shader function in the Metal Shading Language.
120        ///
121        /// - Parameters:
122        /// - viewports: Array of ``MTLViewport`` instances.
123        /// - count: Number of ``MTLViewport`` instances in the array.
124        ///
125        /// # Safety
126        ///
127        /// - `viewports` must be a valid pointer.
128        /// - `count` might not be bounds-checked.
129        #[unsafe(method(setViewports:count:))]
130        #[unsafe(method_family = none)]
131        unsafe fn setViewports_count(&self, viewports: NonNull<MTLViewport>, count: NSUInteger);
132
133        #[cfg(feature = "MTLRenderCommandEncoder")]
134        /// Sets the vertex amplification count and its view mapping for each amplification ID.
135        ///
136        /// Each view mapping element describes how to route the corresponding amplification ID to a specific viewport and
137        /// render target array index by using offsets from the base array index provided by the `[[ render_target_array_index ]]`
138        /// and/or `[[ viewport_array_index ]]` output attributes in the vertex shader. This allows Metal to route each amplified
139        /// vertex to a different `[[ render_target_array_index ]]` and `[[ viewport_array_index ]]`, even though you can't
140        /// directly amplify these attributes.
141        ///
142        /// - Parameters:
143        /// - count: The number of outputs to create. The maximum value is `2`.
144        /// - viewMappings: Array of ``MTLVertexAmplificationViewMapping`` instances. Each instance provides
145        /// per-output offsets to a specific render target and viewport.
146        ///
147        /// # Safety
148        ///
149        /// - `count` might not be bounds-checked.
150        /// - `view_mappings` must be a valid pointer or null.
151        #[unsafe(method(setVertexAmplificationCount:viewMappings:))]
152        #[unsafe(method_family = none)]
153        unsafe fn setVertexAmplificationCount_viewMappings(
154            &self,
155            count: NSUInteger,
156            view_mappings: *const MTLVertexAmplificationViewMapping,
157        );
158
159        #[cfg(feature = "MTLRenderCommandEncoder")]
160        /// Controls whether Metal culls front facing primitives, back facing primitives, or culls no primitives at all.
161        ///
162        /// - Parameter cullMode: ``MTLCullMode`` to set.
163        #[unsafe(method(setCullMode:))]
164        #[unsafe(method_family = none)]
165        fn setCullMode(&self, cull_mode: MTLCullMode);
166
167        #[cfg(feature = "MTLRenderCommandEncoder")]
168        /// Controls the behavior for fragments outside of the near or far planes.
169        ///
170        /// - Parameter depthClipMode: ``MTLDepthClipMode`` to set.
171        #[unsafe(method(setDepthClipMode:))]
172        #[unsafe(method_family = none)]
173        fn setDepthClipMode(&self, depth_clip_mode: MTLDepthClipMode);
174
175        /// Configures the adjustments a render pass applies to depth values from fragment shader functions
176        /// by a scaling factor and bias.
177        ///
178        /// - Parameters:
179        /// - depthBias: A constant bias the render pipeline applies to all fragments.
180        /// - slopeScale: A bias coefficient that scales with the depth of the primitive relative to the camera.
181        /// - clamp: A value that limits the bias value the render pipeline can apply to a fragment.
182        /// Pass a positive or negative value to limit the largest magnitude of a positive
183        /// or negative bias, respectively. Set this value to `0` to disable bias clamping.
184        #[unsafe(method(setDepthBias:slopeScale:clamp:))]
185        #[unsafe(method_family = none)]
186        fn setDepthBias_slopeScale_clamp(
187            &self,
188            depth_bias: c_float,
189            slope_scale: c_float,
190            clamp: c_float,
191        );
192
193        /// Configures the minimum and maximum bounds for depth bounds testing.
194        ///
195        /// The render command encoder disables depth bounds testing by default.
196        /// The render command encoder also disables depth bounds testing when all of the following properties equal a specific value:
197        /// - The `minBound` property is equal to `0.0f`.
198        /// - The `maxBound` property is equal to `1.0f`.
199        /// Both `minBound` and `maxBound` need to be within `[0.0f, 1.0f]`, and `minBound` needs to be less than or equal to `maxBound`.
200        /// - Parameters:
201        /// - minBound: A minimum bound for depth testing, which discards fragments with a stored depth that is less than `minBound`.
202        /// - maxBound: A maximum bound for depth testing, which discards fragments with a stored depth that is greater than `maxBound`.
203        #[unsafe(method(setDepthTestMinBound:maxBound:))]
204        #[unsafe(method_family = none)]
205        fn setDepthTestMinBound_maxBound(&self, min_bound: c_float, max_bound: c_float);
206
207        #[cfg(feature = "MTLRenderCommandEncoder")]
208        /// Sets a scissor rectangle to discard fragments outside a specific area.
209        ///
210        /// Metal performs a scissor test and discards all fragments outside of the scissor rect.
211        ///
212        /// - Parameter rect: ``MTLScissorRect`` rectangle to specify. This rectangle needs to lie completely
213        /// within the current render attachment.
214        #[unsafe(method(setScissorRect:))]
215        #[unsafe(method_family = none)]
216        fn setScissorRect(&self, rect: MTLScissorRect);
217
218        #[cfg(feature = "MTLRenderCommandEncoder")]
219        /// Sets an array of scissor rectangles for a fragment scissor test.
220        ///
221        /// Metal uses the specific scissor rectangle corresponding to the index you specify via the `[[ viewport_array_index ]]`
222        /// output attribute of the vertex shader function in the Metal Shading Language, discarding all fragments outside of
223        /// the scissor rect.
224        ///
225        /// - Parameters:
226        /// - scissorRects: Array of ``MTLScissorRect`` structures.
227        /// - count: Number of ``MTLScissorRect`` structures in the array.
228        ///
229        /// # Safety
230        ///
231        /// - `scissor_rects` must be a valid pointer.
232        /// - `count` might not be bounds-checked.
233        #[unsafe(method(setScissorRects:count:))]
234        #[unsafe(method_family = none)]
235        unsafe fn setScissorRects_count(
236            &self,
237            scissor_rects: NonNull<MTLScissorRect>,
238            count: NSUInteger,
239        );
240
241        #[cfg(feature = "MTLRenderCommandEncoder")]
242        /// Configures how subsequent draw commands rasterize triangle and triangle strip primitives.
243        ///
244        /// - Parameter fillMode:``MTLTriangleFillMode`` the render pass applies to draw commands that
245        /// rasterize triangles or triangle strips.
246        #[unsafe(method(setTriangleFillMode:))]
247        #[unsafe(method_family = none)]
248        fn setTriangleFillMode(&self, fill_mode: MTLTriangleFillMode);
249
250        /// Configures each pixel component value, including alpha, for the render pipeline’s constant blend color.
251        ///
252        /// - Parameters:
253        /// - red: A value for the red component for the blend color constant.
254        /// - green: A value for the green component for the blend color constant.
255        /// - blue: A value for the blue component for the blend color constant.
256        /// - alpha: A value for the alpha component for the blend color constant.
257        #[unsafe(method(setBlendColorRed:green:blue:alpha:))]
258        #[unsafe(method_family = none)]
259        fn setBlendColorRed_green_blue_alpha(
260            &self,
261            red: c_float,
262            green: c_float,
263            blue: c_float,
264            alpha: c_float,
265        );
266
267        #[cfg(feature = "MTLDepthStencil")]
268        /// Configures this encoder with a depth stencil state that applies to your subsequent draw commands.
269        ///
270        /// - Parameter depthStencilState: the ``MTLDepthStencilState`` instance to set.
271        #[unsafe(method(setDepthStencilState:))]
272        #[unsafe(method_family = none)]
273        fn setDepthStencilState(
274            &self,
275            depth_stencil_state: Option<&ProtocolObject<dyn MTLDepthStencilState>>,
276        );
277
278        /// Configures this encoder with a reference value for stencil testing.
279        ///
280        /// The render pipeline applies this reference value to both front-facing and back-facing primitives.
281        ///
282        /// - Parameter referenceValue: A stencil test comparison value.
283        #[unsafe(method(setStencilReferenceValue:))]
284        #[unsafe(method_family = none)]
285        fn setStencilReferenceValue(&self, reference_value: u32);
286
287        /// Configures the encoder with different stencil test reference values for front-facing and back-facing primitives.
288        ///
289        /// The render pipeline applies `frontReferenceValue` to front-facing primitives and `backReferenceValue` to
290        /// back-facing primitives.
291        ///
292        /// - Parameters:
293        /// - frontReferenceValue: A stencil test comparison value the render pipeline applies
294        /// to front-facing primitives.
295        /// - backReferenceValue: A stencil test comparison value the render pipeline applies
296        /// to back-facing primitives.
297        #[unsafe(method(setStencilFrontReferenceValue:backReferenceValue:))]
298        #[unsafe(method_family = none)]
299        fn setStencilFrontReferenceValue_backReferenceValue(
300            &self,
301            front_reference_value: u32,
302            back_reference_value: u32,
303        );
304
305        #[cfg(feature = "MTLRenderCommandEncoder")]
306        /// Configures a visibility test for Metal to run, and the destination for any results it generates.
307        ///
308        /// You use the `mode` parameter to enable or disable the visibility test, and determine if it produces a boolean
309        /// response for passing fragments, or if it counts the number of fragments.
310        ///
311        /// - Parameters:
312        /// - mode: A ``MTLVisibilityResultMode`` that configures which visibility test results
313        /// the render pass saves to a buffer, or disables visibility testing.
314        /// - offset: A location, in bytes, relative to the start of
315        /// ``MTL4RenderPassDescriptor/visibilityResultBuffer`` The GPU stores
316        /// the result of a visibility test at `offset`, which needs to be a multiple of `8`.
317        ///
318        /// # Safety
319        ///
320        /// `offset` might not be bounds-checked.
321        #[unsafe(method(setVisibilityResultMode:offset:))]
322        #[unsafe(method_family = none)]
323        unsafe fn setVisibilityResultMode_offset(
324            &self,
325            mode: MTLVisibilityResultMode,
326            offset: NSUInteger,
327        );
328
329        #[cfg(feature = "MTLRenderPass")]
330        /// Configures the store action for a color attachment.
331        ///
332        /// - Parameters:
333        /// - storeAction: A store action for the color attachment that
334        /// can’t be ``MTLStoreAction/MTLStoreActionUnknown``.
335        /// - colorAttachmentIndex: The index of a color attachment.
336        ///
337        /// # Safety
338        ///
339        /// `colorAttachmentIndex` might not be bounds-checked.
340        #[unsafe(method(setColorStoreAction:atIndex:))]
341        #[unsafe(method_family = none)]
342        unsafe fn setColorStoreAction_atIndex(
343            &self,
344            store_action: MTLStoreAction,
345            color_attachment_index: NSUInteger,
346        );
347
348        #[cfg(feature = "MTLRenderPass")]
349        /// Configures the store action for the depth attachment.
350        ///
351        /// - Parameter storeAction: A store action for the depth attachment that
352        /// can’t be ``MTLStoreAction/MTLStoreActionUnknown``.
353        #[unsafe(method(setDepthStoreAction:))]
354        #[unsafe(method_family = none)]
355        fn setDepthStoreAction(&self, store_action: MTLStoreAction);
356
357        #[cfg(feature = "MTLRenderPass")]
358        /// Configures the store action for the stencil attachment.
359        ///
360        /// - Parameter storeAction: A store action for the stencil attachment that
361        /// can’t be ``MTLStoreAction/MTLStoreActionUnknown``.
362        #[unsafe(method(setStencilStoreAction:))]
363        #[unsafe(method_family = none)]
364        fn setStencilStoreAction(&self, store_action: MTLStoreAction);
365
366        #[cfg(feature = "MTLRenderCommandEncoder")]
367        /// Encodes a draw command that renders an instance of a geometric primitive.
368        ///
369        /// This command assigns each vertex a unique `vertex_id` value that increases from `vertexStart` through
370        /// `(vertexStart + vertexCount - 1)`.
371        ///
372        /// Your vertex shader function can use this value to uniquely identify each vertex.
373        ///
374        /// - Parameters:
375        /// - primitiveType: A ``MTLPrimitiveType`` representing how the command interprets vertex argument data.
376        /// - vertexStart: The lowest value the command passes to your vertex shader function’s parameter with the
377        /// `[[vertex_id]]` attribute.
378        /// - vertexCount: An integer that represents the number of vertices of `primitiveType` the command draws.
379        ///
380        /// # Safety
381        ///
382        /// `vertexCount` might not be bounds-checked.
383        #[unsafe(method(drawPrimitives:vertexStart:vertexCount:))]
384        #[unsafe(method_family = none)]
385        unsafe fn drawPrimitives_vertexStart_vertexCount(
386            &self,
387            primitive_type: MTLPrimitiveType,
388            vertex_start: NSUInteger,
389            vertex_count: NSUInteger,
390        );
391
392        #[cfg(feature = "MTLRenderCommandEncoder")]
393        /// Encodes a draw command that renders multiple instances of a geometric primitive.
394        ///
395        /// The command assigns each vertex a unique `vertex_id` value within its drawing instance
396        /// that increases from `vertexStart` through `(vertexStart + vertexCount - 1)`.
397        ///
398        /// Additionally, the command assigns each drawing instance a unique `instance_id` value that increases
399        /// from `0` through `(instanceCount - 1)`.
400        ///
401        /// Your vertex shader can use the `vertex_id` value to uniquely identify each vertex in each drawing instance, and the
402        /// `instance_id` value to identify which instance that vertex belongs to.
403        ///
404        /// - Parameters:
405        /// - primitiveType: A ``MTLPrimitiveType`` represents how the command interprets vertex argument data.
406        /// - vertexStart: The lowest value the command passes to your vertex shader function’s parameter with
407        /// the `vertex_id` attribute.
408        /// - vertexCount: An integer that represents the number of vertices of `primitiveType` the command draws.
409        /// - instanceCount: An integer that represents the number of times the command draws `primitiveType` primitives
410        /// with `vertexCount` vertices.
411        ///
412        /// # Safety
413        ///
414        /// - `vertexCount` might not be bounds-checked.
415        /// - `instanceCount` might not be bounds-checked.
416        #[unsafe(method(drawPrimitives:vertexStart:vertexCount:instanceCount:))]
417        #[unsafe(method_family = none)]
418        unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount(
419            &self,
420            primitive_type: MTLPrimitiveType,
421            vertex_start: NSUInteger,
422            vertex_count: NSUInteger,
423            instance_count: NSUInteger,
424        );
425
426        #[cfg(feature = "MTLRenderCommandEncoder")]
427        /// Encodes a draw command that renders multiple instances of a geometric primitive,
428        /// starting with a custom instance identification number.
429        ///
430        /// The command assigns each vertex a unique `vertex_id` value within its drawing instance
431        /// that increases from `vertexStart` through `(vertexStart + vertexCount - 1)`.
432        ///
433        /// Additionally, the command assigns each drawing instance a unique `instance_id` value that increases
434        /// from `baseInstance` through `(baseInstance + instanceCount - 1)`.
435        ///
436        /// Your vertex shader can use the `vertex_id` value to uniquely identify each vertex in each drawing instance, and the
437        /// `instance_id` value to identify which instance that vertex belongs to.
438        ///
439        /// - Parameters:
440        /// - primitiveType: A ``MTLPrimitiveType``  representing how the command interprets vertex argument data.
441        /// - vertexStart: The lowest value the command passes to your vertex shader function’s parameter with
442        /// the `vertex_id` attribute.
443        /// - vertexCount: An integer that represents the number of vertices of `primitiveType` the command draws.
444        /// - instanceCount: An integer that represents the number of times the command draws `primitiveType`
445        /// with `vertexCount` vertices.
446        /// - baseInstance: The lowest value the command passes to your vertex shader function’s parameter with
447        /// the `instance_id` attribute.
448        ///
449        /// # Safety
450        ///
451        /// - `vertexCount` might not be bounds-checked.
452        /// - `instanceCount` might not be bounds-checked.
453        #[unsafe(method(drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:))]
454        #[unsafe(method_family = none)]
455        unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance(
456            &self,
457            primitive_type: MTLPrimitiveType,
458            vertex_start: NSUInteger,
459            vertex_count: NSUInteger,
460            instance_count: NSUInteger,
461            base_instance: NSUInteger,
462        );
463
464        #[cfg(all(
465            feature = "MTLArgument",
466            feature = "MTLGPUAddress",
467            feature = "MTLRenderCommandEncoder"
468        ))]
469        /// Encodes a draw command that renders an instance of a geometric primitive with indexed vertices.
470        ///
471        /// Use this method to perform indexed drawing, where an index buffer determines how Metal assembles primitives.
472        ///
473        /// Metal imposes some restrictions on the index buffer's address, which needs to be 2- or 4-byte aligned, and its length
474        /// in bytes, which needs to be a multiple of 2 or 4, depending on whether the format of the index is
475        /// ``MTLIndexType/MTLIndexTypeUInt16`` or ``MTLIndexType/MTLIndexTypeUInt32``.
476        ///
477        /// Use an instance of ``MTLResidencySet`` to mark residency of the index buffer the `indexBuffer` parameter references.
478        ///
479        /// - Parameters:
480        /// - primitiveType: A ``MTLPrimitiveType`` representing how the command interprets vertex argument data.
481        /// - indexCount: An integer that represents the number of vertices the command reads from `indexBuffer`.
482        /// - indexType: A ``MTLIndexType`` instance that represents the index format.
483        /// - indexBuffer: GPUAddress of a ``MTLBuffer`` instance that contains `indexCount` indices of `indexType` format.
484        /// You are responsible for ensuring this address is aligned to 2 bytes if the `indexType` format is
485        /// ``MTLIndexType/MTLIndexTypeUInt16``, and aligned to 4 bytes if the format is
486        /// ``MTLIndexType/MTLIndexTypeUInt32``.
487        /// - indexBufferLength: An integer that represents the length of `indexBuffer`, in bytes. You are responsible for
488        /// ensuring this this size is a multiple of 2 if the `indexType` format is ``MTLIndexType/MTLIndexTypeUInt16``,
489        /// and a multiple of 4 if the format is ``MTLIndexType/MTLIndexTypeUInt32``.
490        /// If this draw call causes Metal to read indices at or beyond the `indexBufferLength`, Metal
491        /// continues to execute them assigning a value of `0` to the `vertex_id` attribute.
492        ///
493        /// # Safety
494        ///
495        /// - `indexCount` might not be bounds-checked.
496        /// - `indexBuffer` might not be bounds-checked.
497        /// - `indexBufferLength` might not be bounds-checked.
498        #[unsafe(method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferLength:))]
499        #[unsafe(method_family = none)]
500        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength(
501            &self,
502            primitive_type: MTLPrimitiveType,
503            index_count: NSUInteger,
504            index_type: MTLIndexType,
505            index_buffer: MTLGPUAddress,
506            index_buffer_length: NSUInteger,
507        );
508
509        #[cfg(all(
510            feature = "MTLArgument",
511            feature = "MTLGPUAddress",
512            feature = "MTLRenderCommandEncoder"
513        ))]
514        /// Encodes a draw command that renders multiple instances of a geometric primitive with indexed vertices.
515        ///
516        /// Use this method to perform instanced indexed drawing, where an index buffer determines how Metal assembles primitives.
517        ///
518        /// The command assigns each drawing instance a unique `instance_id` value that increases
519        /// from `0` through `(instanceCount - 1)`. Your shader can use this value to identify which
520        /// instance the vertex belongs to.
521        ///
522        /// Metal imposes some restrictions on the index buffer's address, which needs to be 2- or 4-byte aligned, and its length
523        /// in bytes, which needs to be a multiple of 2 or 4, depending on whether the format of the index is
524        /// ``MTLIndexType/MTLIndexTypeUInt16`` or ``MTLIndexType/MTLIndexTypeUInt32``.
525        ///
526        /// Use an instance of ``MTLResidencySet`` to mark residency of the index buffer the `indexBuffer` parameter references.
527        ///
528        /// - Parameters:
529        /// - primitiveType: A ``MTLPrimitiveType`` representing how the command interprets vertex argument data.
530        /// - indexCount: An integer that represents the number of vertices the command reads from `indexBuffer`.
531        /// - indexType: A ``MTLIndexType`` instance that represents the index format.
532        /// - indexBuffer: GPUAddress of a ``MTLBuffer`` instance that contains `indexCount` indices of `indexType` format.
533        /// You are responsible for ensuring this address is aligned to 2 bytes if the `indexType` format is
534        /// ``MTLIndexType/MTLIndexTypeUInt16``, and aligned to 4 bytes if the format is
535        /// ``MTLIndexType/MTLIndexTypeUInt32``.
536        /// - indexBufferLength: An integer that represents the length of `indexBuffer`, in bytes. You are responsible for
537        /// ensuring this this size is a multiple of 2 if the `indexType` format is ``MTLIndexType/MTLIndexTypeUInt16``,
538        /// and a multiple of 4 if the format is ``MTLIndexType/MTLIndexTypeUInt32``.
539        /// Metal disregards this value and assigns `0` to the `vertex_id` attribute for all primitives that
540        /// require loading indices at a byte offset of `indexBufferLength` or greater.
541        /// - instanceCount: An integer that represents the number of times the command draws `primitiveType` with `indexCount`
542        /// vertices.
543        ///
544        /// # Safety
545        ///
546        /// - `indexCount` might not be bounds-checked.
547        /// - `indexBuffer` might not be bounds-checked.
548        /// - `indexBufferLength` might not be bounds-checked.
549        /// - `instanceCount` might not be bounds-checked.
550        #[unsafe(method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferLength:instanceCount:))]
551        #[unsafe(method_family = none)]
552        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_instanceCount(
553            &self,
554            primitive_type: MTLPrimitiveType,
555            index_count: NSUInteger,
556            index_type: MTLIndexType,
557            index_buffer: MTLGPUAddress,
558            index_buffer_length: NSUInteger,
559            instance_count: NSUInteger,
560        );
561
562        #[cfg(all(
563            feature = "MTLArgument",
564            feature = "MTLGPUAddress",
565            feature = "MTLRenderCommandEncoder"
566        ))]
567        /// Encodes a draw command that renders multiple instances of a geometric primitive with indexed vertices,
568        /// starting with a custom vertex and instance.
569        ///
570        /// Use this method to perform instanced indexed drawing, where an index buffer determines how Metal assembles primitives
571        /// whilst customizing the base vertex and base instance value Metal passes to the vertex shader function.
572        ///
573        /// The command assigns each drawing instance a unique `instance_id` value that increases
574        /// from `baseInstance` through `(baseInstance + instanceCount - 1)`. Your shader can use this value
575        /// to identify which instance the vertex belongs to.
576        ///
577        /// Metal imposes some restrictions on the index buffer's address, which needs to be 2- or 4-byte aligned, and its length
578        /// in bytes, which needs to be a multiple of 2 or 4, depending on whether the format of the index is
579        /// ``MTLIndexType/MTLIndexTypeUInt16`` or ``MTLIndexType/MTLIndexTypeUInt32``.
580        ///
581        /// Use an instance of ``MTLResidencySet`` to mark residency of the index buffer the `indexBuffer` parameter references.
582        ///
583        /// - Parameters:
584        /// - primitiveType: A ``MTLPrimitiveType`` representing how the command interprets vertex argument data.
585        /// - indexCount: An integer that represents the number of vertices the command reads from `indexBuffer`.
586        /// - indexType: A ``MTLIndexType`` instance that represents the index format.
587        /// - indexBuffer: GPUAddress of a ``MTLBuffer`` instance that contains `indexCount` indices of `indexType` format.
588        /// You are responsible for ensuring this address is aligned to 2 bytes if the `indexType` format is
589        /// ``MTLIndexType/MTLIndexTypeUInt16``, and aligned to 4 bytes if the format is
590        /// ``MTLIndexType/MTLIndexTypeUInt32``.
591        /// - indexBufferLength: An integer that represents the length of `indexBuffer`, in bytes. You are responsible for
592        /// ensuring this this size is a multiple of 2 if the `indexType` format is ``MTLIndexType/MTLIndexTypeUInt16``,
593        /// and a multiple of 4 if the format is ``MTLIndexType/MTLIndexTypeUInt32``.
594        /// If this draw call causes Metal to read indices at or beyond the `indexBufferLength`, Metal
595        /// continues to execute them assigning a value of `0` to the `vertex_id` attribute.
596        /// - instanceCount: An integer that represents the number of times the command draws `primitiveType` with `indexCount`
597        /// vertices.
598        /// - baseVertex: The lowest value the command passes to your vertex shader functions’s parameter with the `vertex_id`
599        /// attribute. Metal disregards this value and assigns `0` to the `vertex_id` attribute for all
600        /// primitives that require loading indices at a byte offset of `indexBufferLength` or greater.
601        /// - baseInstance: The lowest value the command passes to your vertex shader’s parameter with the `instance_id` attribute.
602        ///
603        /// # Safety
604        ///
605        /// - `indexCount` might not be bounds-checked.
606        /// - `indexBuffer` might not be bounds-checked.
607        /// - `indexBufferLength` might not be bounds-checked.
608        /// - `instanceCount` might not be bounds-checked.
609        #[unsafe(method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferLength:instanceCount:baseVertex:baseInstance:))]
610        #[unsafe(method_family = none)]
611        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_instanceCount_baseVertex_baseInstance(
612            &self,
613            primitive_type: MTLPrimitiveType,
614            index_count: NSUInteger,
615            index_type: MTLIndexType,
616            index_buffer: MTLGPUAddress,
617            index_buffer_length: NSUInteger,
618            instance_count: NSUInteger,
619            base_vertex: NSInteger,
620            base_instance: NSUInteger,
621        );
622
623        #[cfg(all(feature = "MTLGPUAddress", feature = "MTLRenderCommandEncoder"))]
624        /// Encodes a draw command that renders multiple instances of a geometric primitive with indirect arguments.
625        ///
626        /// When you use this function, Metal reads the parameters to the draw command from an ``MTLBuffer`` instance,
627        /// allowing you to implement a GPU-driven workflow where a compute pipeline state determines the draw arguments.
628        ///
629        /// You are responsible for ensuring that the address of the indirect buffer you provide to this method has 4-byte
630        /// alignment.
631        ///
632        /// Because this is a non-indexed draw call, Metal interprets the contents of the indirect buffer to match the
633        /// layout of struct ``MTLDrawPrimitivesIndirectArguments``.
634        ///
635        /// Use an instance of ``MTLResidencySet`` to mark residency of the indirect buffer that the `indirectBuffer` parameter
636        /// references.
637        ///
638        /// - Parameters:
639        /// - primitiveType: A ``MTLPrimitiveType`` representing how the command interprets vertex argument data.
640        /// - indirectBuffer: GPUAddress of a ``MTLBuffer`` instance with data that matches the layout of the
641        /// ``MTLDrawPrimitivesIndirectArguments`` structure. You are responsible for ensuring that the
642        /// alignment of this address is 4 bytes.
643        #[unsafe(method(drawPrimitives:indirectBuffer:))]
644        #[unsafe(method_family = none)]
645        fn drawPrimitives_indirectBuffer(
646            &self,
647            primitive_type: MTLPrimitiveType,
648            indirect_buffer: MTLGPUAddress,
649        );
650
651        #[cfg(all(
652            feature = "MTLArgument",
653            feature = "MTLGPUAddress",
654            feature = "MTLRenderCommandEncoder"
655        ))]
656        /// Encodes a draw command that renders multiple instances of a geometric primitive with indexed vertices
657        /// and indirect arguments.
658        ///
659        /// When you use this function, Metal reads the parameters to the draw command from an ``MTLBuffer`` instance,
660        /// allowing you to implement a GPU-driven workflow where a compute pipeline state determines the draw arguments.
661        ///
662        /// Because this is an indexed draw call, Metal interprets the contents of the indirect buffer to match the
663        /// layout of struct ``MTLDrawIndexedPrimitivesIndirectArguments``, which includes `indexStart` and `indexCount`
664        /// members, denoting a range within the index buffer you provide in the `indexBuffer` parameter.
665        ///
666        /// The range of indices within the `indexBuffer` form the primitives Metal draws.
667        ///
668        /// Metal imposes some restrictions on the index buffer's address, which needs to be 2- or 4-byte aligned, and its length
669        /// in bytes, which needs to be a multiple of 2 or 4, depending on whether the format of the index is
670        /// ``MTLIndexType/MTLIndexTypeUInt16`` or ``MTLIndexType/MTLIndexTypeUInt32``.
671        ///
672        /// Similarly, you are responsible for ensuring the indirect buffer's address has 4-byte alignment.
673        ///
674        /// Use an instance of ``MTLResidencySet`` to mark residency of the indirect buffer that the `indirectBuffer` parameter
675        /// references, and of the index buffer the `indexBuffer` parameter references.
676        ///
677        /// - Parameters:
678        /// - primitiveType: A ``MTLPrimitiveType`` representing how the command interprets vertex argument data.
679        /// - indexType: A ``MTLIndexType`` instance that represents the index format.
680        /// - indexBuffer: GPUAddress of a ``MTLBuffer`` instance that contains `indexCount` indices of `indexType` format.
681        /// You are responsible for ensuring this address is aligned to 2 bytes if the `indexType` format is
682        /// ``MTLIndexType/MTLIndexTypeUInt16``, and aligned to 4 bytes if the format is
683        /// ``MTLIndexType/MTLIndexTypeUInt32``.
684        /// - indexBufferLength: An integer that represents the length of `indexBuffer`, in bytes. You are responsible for
685        /// ensuring this this size is a multiple of 2 if the `indexType` format is ``MTLIndexType/MTLIndexTypeUInt16``,
686        /// and a multiple of 4 if the format is ``MTLIndexType/MTLIndexTypeUInt32``.
687        /// If this draw call causes Metal to read indices at or beyond the `indexBufferLength`, Metal
688        /// continues to execute them assigning a value of `0` to the `vertex_id` attribute.
689        /// - indirectBuffer: GPUAddress of an ``MTLBuffer`` instance with data that matches the layout of the
690        /// ``MTLDrawIndexedPrimitivesIndirectArguments`` structure. This address requires 4-byte alignment.
691        ///
692        /// # Safety
693        ///
694        /// - `indexBuffer` might not be bounds-checked.
695        /// - `indexBufferLength` might not be bounds-checked.
696        #[unsafe(method(drawIndexedPrimitives:indexType:indexBuffer:indexBufferLength:indirectBuffer:))]
697        #[unsafe(method_family = none)]
698        unsafe fn drawIndexedPrimitives_indexType_indexBuffer_indexBufferLength_indirectBuffer(
699            &self,
700            primitive_type: MTLPrimitiveType,
701            index_type: MTLIndexType,
702            index_buffer: MTLGPUAddress,
703            index_buffer_length: NSUInteger,
704            indirect_buffer: MTLGPUAddress,
705        );
706
707        #[cfg(all(
708            feature = "MTLAllocation",
709            feature = "MTLIndirectCommandBuffer",
710            feature = "MTLResource"
711        ))]
712        /// Encodes a command that runs a range of commands from an indirect command buffer.
713        ///
714        /// - Parameters:
715        /// - indirectCommandBuffer: A ``MTLIndirectCommandBuffer`` instance containing other commands that the current command runs.
716        /// - executionRange: A span of integers that represent the command entries in the buffer that the current command runs.
717        ///
718        /// # Safety
719        ///
720        /// - `indirect_command_buffer` may need to be synchronized.
721        /// - `indirect_command_buffer` may be unretained, you must ensure it is kept alive while in use.
722        /// - `executionRange` might not be bounds-checked.
723        #[unsafe(method(executeCommandsInBuffer:withRange:))]
724        #[unsafe(method_family = none)]
725        unsafe fn executeCommandsInBuffer_withRange(
726            &self,
727            indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
728            execution_range: NSRange,
729        );
730
731        #[cfg(all(
732            feature = "MTLAllocation",
733            feature = "MTLGPUAddress",
734            feature = "MTLIndirectCommandBuffer",
735            feature = "MTLResource"
736        ))]
737        /// Encodes a command that runs an indirect range of commands from an indirect command buffer.
738        ///
739        /// Use this method to indicate to Metal the span of indices in the command buffer to execute indirectly via an
740        /// ``MTLBuffer`` instance you provide in the `indirectRangeBuffer` parameter. This allows you to calculate the
741        /// span of commands Metal executes in the GPU timeline, enabling GPU-driven workflows.
742        ///
743        /// Metal requires that the contents of this buffer match the layout of struct ``MTLIndirectCommandBufferExecutionRange``,
744        /// which specifies a location and a length within the indirect command buffer. You are responsible for ensuring the
745        /// address of this buffer has 4-byte alignment.
746        ///
747        /// Use an instance of ``MTLResidencySet`` to mark residency of the indirect buffer that the `indirectRangeBuffer`
748        /// parameter references.
749        ///
750        /// - Parameters:
751        /// - indirectCommandBuffer: A ``MTLIndirectCommandBuffer`` instance that contains other commands
752        /// the current command runs.
753        /// - indirectRangeBuffer: GPUAddress of a ``MTLBuffer`` instance with data that matches the layout of the
754        /// ``MTLIndirectCommandBufferExecutionRange`` structure. This address requires 4-byte alignment.
755        ///
756        /// # Safety
757        ///
758        /// - `indirect_command_buffer` may need to be synchronized.
759        /// - `indirect_command_buffer` may be unretained, you must ensure it is kept alive while in use.
760        /// - `indirectRangeBuffer` might not be bounds-checked.
761        #[unsafe(method(executeCommandsInBuffer:indirectBuffer:))]
762        #[unsafe(method_family = none)]
763        unsafe fn executeCommandsInBuffer_indirectBuffer(
764            &self,
765            indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
766            indirect_range_buffer: MTLGPUAddress,
767        );
768
769        /// Configures the size of a threadgroup memory buffer for a threadgroup argument in the object shader function.
770        ///
771        /// - Parameters:
772        /// - length: The size of the threadgroup memory, in bytes.
773        /// - index: An integer that corresponds to the index of the argument you annotate with attribute `[[threadgroup(index)]]`
774        /// in the shader function.
775        ///
776        /// # Safety
777        ///
778        /// `index` might not be bounds-checked.
779        #[unsafe(method(setObjectThreadgroupMemoryLength:atIndex:))]
780        #[unsafe(method_family = none)]
781        unsafe fn setObjectThreadgroupMemoryLength_atIndex(
782            &self,
783            length: NSUInteger,
784            index: NSUInteger,
785        );
786
787        #[cfg(feature = "MTLTypes")]
788        /// Encodes a draw command that invokes a mesh shader and, optionally, an object shader with a grid of threadgroups.
789        ///
790        /// - Parameters:
791        /// - threadgroupsPerGrid: A ``MTLSize`` instance that represents the number of threadgroups for each grid dimension.
792        /// - threadsPerObjectThreadgroup: A ``MTLSize`` instance that represents the number of threads in an object
793        /// shader threadgroup, if applicable.
794        /// - threadsPerMeshThreadgroup: A ``MTLSize`` instance that represents the number of threads in a mesh shader
795        /// threadgroup.
796        #[unsafe(method(drawMeshThreadgroups:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
797        #[unsafe(method_family = none)]
798        fn drawMeshThreadgroups_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
799            &self,
800            threadgroups_per_grid: MTLSize,
801            threads_per_object_threadgroup: MTLSize,
802            threads_per_mesh_threadgroup: MTLSize,
803        );
804
805        #[cfg(feature = "MTLTypes")]
806        /// Encodes a draw command that invokes a mesh shader and, optionally, an object shader with a grid of threads.
807        ///
808        /// - Parameters:
809        /// - threadsPerGrid: A ``MTLSize`` instance that represents the number of threads for each grid dimension.
810        /// For mesh shaders, the command rounds the value down to the nearest multiple of
811        /// `threadsPerMeshThreadgroup` for each dimension. For object shaders, the value doesn’t
812        /// need to be a multiple of `threadsPerObjectThreadgroup`.
813        /// - threadsPerObjectThreadgroup: A ``MTLSize`` instance that represents the number of threads in an object
814        /// shader threadgroup, if applicable.
815        /// - threadsPerMeshThreadgroup: A ``MTLSize`` instance that represents the number of threads in a mesh shader
816        /// threadgroup.
817        #[unsafe(method(drawMeshThreads:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
818        #[unsafe(method_family = none)]
819        fn drawMeshThreads_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
820            &self,
821            threads_per_grid: MTLSize,
822            threads_per_object_threadgroup: MTLSize,
823            threads_per_mesh_threadgroup: MTLSize,
824        );
825
826        #[cfg(all(feature = "MTLGPUAddress", feature = "MTLTypes"))]
827        /// Encodes a draw command that invokes a mesh shader and, optionally, an object shader with indirect arguments.
828        ///
829        /// This method enables you to determine the number of threadgroups per grid indirectly, in the GPU timeline.
830        /// Metal expects this buffer's contents to match the layout of structure ``MTLDispatchThreadgroupsIndirectArguments``.
831        /// You are responsible for ensuring the address of this buffer has 4-byte alignment.
832        ///
833        /// Use an instance of ``MTLResidencySet`` to mark residency of the indirect buffer that the `indirectBuffer` parameter
834        /// references.
835        ///
836        /// - Parameters:
837        /// - indirectBuffer: GPUAddress of an ``MTLBuffer`` instance with data that matches the layout of the
838        /// ``MTLDispatchThreadgroupsIndirectArguments`` structure. This address requires 4-byte alignment.
839        /// - threadsPerObjectThreadgroup: A ``MTLSize`` instance that represents the number of threads in an object
840        /// shader threadgroup, if applicable.
841        /// - threadsPerMeshThreadgroup: A ``MTLSize`` instance that represents the number of threads in a mesh shader
842        /// threadgroup.
843        #[unsafe(method(drawMeshThreadgroupsWithIndirectBuffer:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
844        #[unsafe(method_family = none)]
845        fn drawMeshThreadgroupsWithIndirectBuffer_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
846            &self,
847            indirect_buffer: MTLGPUAddress,
848            threads_per_object_threadgroup: MTLSize,
849            threads_per_mesh_threadgroup: MTLSize,
850        );
851
852        #[cfg(feature = "MTLTypes")]
853        /// Encodes a command that invokes a tile shader function from the encoder’s current tile render pipeline state.
854        ///
855        /// - Parameter threadsPerTile: A ``MTLSize`` instance that represents the number of threads the render pass uses per tile.
856        /// Set the size’s ``MTLSize/width`` and ``MTLSize/height`` properties to values that are less
857        /// than or equal to ``tileWidth`` and ``tileHeight``, respectively. Some GPU families
858        /// only support square tile dispatches and require the same value for width and height.
859        /// Set ``MTLSize/depth`` to `1`.
860        #[unsafe(method(dispatchThreadsPerTile:))]
861        #[unsafe(method_family = none)]
862        fn dispatchThreadsPerTile(&self, threads_per_tile: MTLSize);
863
864        /// Configures the size of a threadgroup memory buffer for a threadgroup argument in the fragment and tile shader functions.
865        ///
866        /// - Parameters:
867        /// - length: The size of the threadgroup memory, in bytes.
868        /// - offset: An integer that represents the location, in bytes, from the start of the threadgroup memory buffer
869        /// at `index` where the threadgroup memory begins.
870        /// - index: An integer that corresponds to the index of the argument you annotate with attribute `[[threadgroup(index)]]`
871        /// in the shader function.
872        ///
873        /// # Safety
874        ///
875        /// - `offset` might not be bounds-checked.
876        /// - `index` might not be bounds-checked.
877        #[unsafe(method(setThreadgroupMemoryLength:offset:atIndex:))]
878        #[unsafe(method_family = none)]
879        unsafe fn setThreadgroupMemoryLength_offset_atIndex(
880            &self,
881            length: NSUInteger,
882            offset: NSUInteger,
883            index: NSUInteger,
884        );
885
886        #[cfg(all(feature = "MTL4ArgumentTable", feature = "MTLRenderCommandEncoder"))]
887        /// Associates an argument table with a set of render stages.
888        ///
889        /// Metal takes a snapshot of the resources in the argument table when you encode a draw, dispatch, or execute command.
890        /// This snapshot becomes available to the `stages` you specify to this method.
891        ///
892        /// - Parameters:
893        /// - argumentTable: ``MTL4ArgumentTable`` to set.
894        /// - stages: A ``MTLRenderStages`` bitmask that specifies the shader stages with visibility over the table.
895        #[unsafe(method(setArgumentTable:atStages:))]
896        #[unsafe(method_family = none)]
897        fn setArgumentTable_atStages(
898            &self,
899            argument_table: &ProtocolObject<dyn MTL4ArgumentTable>,
900            stages: MTLRenderStages,
901        );
902
903        #[cfg(feature = "MTLRenderCommandEncoder")]
904        /// Configures the vertex winding order that determines which face of a geometric primitive is the front one.
905        ///
906        /// - Parameter frontFacingWinding: A ``MTLWinding`` value that determines which side of a primitive the render pipeline
907        /// interprets as front facing.
908        #[unsafe(method(setFrontFacingWinding:))]
909        #[unsafe(method_family = none)]
910        fn setFrontFacingWinding(&self, front_facing_winding: MTLWinding);
911
912        #[cfg(all(feature = "MTL4Counters", feature = "MTLRenderCommandEncoder"))]
913        /// Writes a GPU timestamp into the given ``MTL4CounterHeap`` at `index` after `stage` completes.
914        ///
915        /// This command only guarantees all draws prior to this command are complete when Metal writes the timestamp into
916        /// the counter heap you provide in the `counterHeap` parameter. The timestamp may also include subsequent operations.
917        ///
918        /// If you call this method before any draw calls, Metal writes a timestamp before the stage you specify in the
919        /// `stage` parameter begins.
920        ///
921        /// - Parameters:
922        /// - granularity: a ``MTL4TimestampGranularity`` hint.
923        /// - stage: ``MTLRenderStages`` that need to complete before Metal writes the timestamp. This may also include later
924        /// stages that are related, for example ``MTLRenderStages/MTLRenderStageMesh`` may include
925        /// ``MTLRenderStages/MTLRenderStageVertex``.
926        /// - counterHeap: ``MTL4CounterHeap`` into which Metal writes timestamps.
927        /// - index: The index value into which Metal writes this timestamp.
928        ///
929        /// # Safety
930        ///
931        /// `index` might not be bounds-checked.
932        #[unsafe(method(writeTimestampWithGranularity:afterStage:intoHeap:atIndex:))]
933        #[unsafe(method_family = none)]
934        unsafe fn writeTimestampWithGranularity_afterStage_intoHeap_atIndex(
935            &self,
936            granularity: MTL4TimestampGranularity,
937            stage: MTLRenderStages,
938            counter_heap: &ProtocolObject<dyn MTL4CounterHeap>,
939            index: NSUInteger,
940        );
941    }
942);