pub unsafe trait MTL4RenderCommandEncoder: MTL4CommandEncoder {
Show 41 methods
// Provided methods
fn tileWidth(&self) -> NSUInteger
where Self: Sized + Message { ... }
fn tileHeight(&self) -> NSUInteger
where Self: Sized + Message { ... }
fn setColorAttachmentMap(
&self,
mapping: Option<&MTLLogicalToPhysicalColorAttachmentMap>,
)
where Self: Sized + Message { ... }
fn setRenderPipelineState(
&self,
pipeline_state: &ProtocolObject<dyn MTLRenderPipelineState>,
)
where Self: Sized + Message { ... }
fn setViewport(&self, viewport: MTLViewport)
where Self: Sized + Message { ... }
unsafe fn setViewports_count(
&self,
viewports: NonNull<MTLViewport>,
count: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn setVertexAmplificationCount_viewMappings(
&self,
count: NSUInteger,
view_mappings: *const MTLVertexAmplificationViewMapping,
)
where Self: Sized + Message { ... }
fn setCullMode(&self, cull_mode: MTLCullMode)
where Self: Sized + Message { ... }
fn setDepthClipMode(&self, depth_clip_mode: MTLDepthClipMode)
where Self: Sized + Message { ... }
fn setDepthBias_slopeScale_clamp(
&self,
depth_bias: c_float,
slope_scale: c_float,
clamp: c_float,
)
where Self: Sized + Message { ... }
fn setDepthTestMinBound_maxBound(
&self,
min_bound: c_float,
max_bound: c_float,
)
where Self: Sized + Message { ... }
fn setScissorRect(&self, rect: MTLScissorRect)
where Self: Sized + Message { ... }
unsafe fn setScissorRects_count(
&self,
scissor_rects: NonNull<MTLScissorRect>,
count: NSUInteger,
)
where Self: Sized + Message { ... }
fn setTriangleFillMode(&self, fill_mode: MTLTriangleFillMode)
where Self: Sized + Message { ... }
fn setBlendColorRed_green_blue_alpha(
&self,
red: c_float,
green: c_float,
blue: c_float,
alpha: c_float,
)
where Self: Sized + Message { ... }
fn setDepthStencilState(
&self,
depth_stencil_state: Option<&ProtocolObject<dyn MTLDepthStencilState>>,
)
where Self: Sized + Message { ... }
fn setStencilReferenceValue(&self, reference_value: u32)
where Self: Sized + Message { ... }
fn setStencilFrontReferenceValue_backReferenceValue(
&self,
front_reference_value: u32,
back_reference_value: u32,
)
where Self: Sized + Message { ... }
unsafe fn setVisibilityResultMode_offset(
&self,
mode: MTLVisibilityResultMode,
offset: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn setColorStoreAction_atIndex(
&self,
store_action: MTLStoreAction,
color_attachment_index: NSUInteger,
)
where Self: Sized + Message { ... }
fn setDepthStoreAction(&self, store_action: MTLStoreAction)
where Self: Sized + Message { ... }
fn setStencilStoreAction(&self, store_action: MTLStoreAction)
where Self: Sized + Message { ... }
unsafe fn drawPrimitives_vertexStart_vertexCount(
&self,
primitive_type: MTLPrimitiveType,
vertex_start: NSUInteger,
vertex_count: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount(
&self,
primitive_type: MTLPrimitiveType,
vertex_start: NSUInteger,
vertex_count: NSUInteger,
instance_count: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance(
&self,
primitive_type: MTLPrimitiveType,
vertex_start: NSUInteger,
vertex_count: NSUInteger,
instance_count: NSUInteger,
base_instance: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength(
&self,
primitive_type: MTLPrimitiveType,
index_count: NSUInteger,
index_type: MTLIndexType,
index_buffer: MTLGPUAddress,
index_buffer_length: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_instanceCount(
&self,
primitive_type: MTLPrimitiveType,
index_count: NSUInteger,
index_type: MTLIndexType,
index_buffer: MTLGPUAddress,
index_buffer_length: NSUInteger,
instance_count: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_instanceCount_baseVertex_baseInstance(
&self,
primitive_type: MTLPrimitiveType,
index_count: NSUInteger,
index_type: MTLIndexType,
index_buffer: MTLGPUAddress,
index_buffer_length: NSUInteger,
instance_count: NSUInteger,
base_vertex: NSInteger,
base_instance: NSUInteger,
)
where Self: Sized + Message { ... }
fn drawPrimitives_indirectBuffer(
&self,
primitive_type: MTLPrimitiveType,
indirect_buffer: MTLGPUAddress,
)
where Self: Sized + Message { ... }
unsafe fn drawIndexedPrimitives_indexType_indexBuffer_indexBufferLength_indirectBuffer(
&self,
primitive_type: MTLPrimitiveType,
index_type: MTLIndexType,
index_buffer: MTLGPUAddress,
index_buffer_length: NSUInteger,
indirect_buffer: MTLGPUAddress,
)
where Self: Sized + Message { ... }
unsafe fn executeCommandsInBuffer_withRange(
&self,
indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
execution_range: NSRange,
)
where Self: Sized + Message { ... }
unsafe fn executeCommandsInBuffer_indirectBuffer(
&self,
indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
indirect_range_buffer: MTLGPUAddress,
)
where Self: Sized + Message { ... }
unsafe fn setObjectThreadgroupMemoryLength_atIndex(
&self,
length: NSUInteger,
index: NSUInteger,
)
where Self: Sized + Message { ... }
fn drawMeshThreadgroups_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
&self,
threadgroups_per_grid: MTLSize,
threads_per_object_threadgroup: MTLSize,
threads_per_mesh_threadgroup: MTLSize,
)
where Self: Sized + Message { ... }
fn drawMeshThreads_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
&self,
threads_per_grid: MTLSize,
threads_per_object_threadgroup: MTLSize,
threads_per_mesh_threadgroup: MTLSize,
)
where Self: Sized + Message { ... }
fn drawMeshThreadgroupsWithIndirectBuffer_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
&self,
indirect_buffer: MTLGPUAddress,
threads_per_object_threadgroup: MTLSize,
threads_per_mesh_threadgroup: MTLSize,
)
where Self: Sized + Message { ... }
fn dispatchThreadsPerTile(&self, threads_per_tile: MTLSize)
where Self: Sized + Message { ... }
unsafe fn setThreadgroupMemoryLength_offset_atIndex(
&self,
length: NSUInteger,
offset: NSUInteger,
index: NSUInteger,
)
where Self: Sized + Message { ... }
fn setArgumentTable_atStages(
&self,
argument_table: &ProtocolObject<dyn MTL4ArgumentTable>,
stages: MTLRenderStages,
)
where Self: Sized + Message { ... }
fn setFrontFacingWinding(&self, front_facing_winding: MTLWinding)
where Self: Sized + Message { ... }
unsafe fn writeTimestampWithGranularity_afterStage_intoHeap_atIndex(
&self,
granularity: MTL4TimestampGranularity,
stage: MTLRenderStages,
counter_heap: &ProtocolObject<dyn MTL4CounterHeap>,
index: NSUInteger,
)
where Self: Sized + Message { ... }
}MTL4CommandEncoder and MTL4RenderCommandEncoder only.Expand description
Encodes a render pass into a command buffer, including all its draw calls and configuration.
See also Apple’s documentation
Provided Methods§
Sourcefn tileWidth(&self) -> NSUInteger
fn tileWidth(&self) -> NSUInteger
Sets the width of a tile for this render pass.
Sourcefn tileHeight(&self) -> NSUInteger
fn tileHeight(&self) -> NSUInteger
Sets the height of a tile for this render pass.
Sourcefn setColorAttachmentMap(
&self,
mapping: Option<&MTLLogicalToPhysicalColorAttachmentMap>,
)
Available on crate feature MTLRenderPipeline only.
fn setColorAttachmentMap( &self, mapping: Option<&MTLLogicalToPhysicalColorAttachmentMap>, )
MTLRenderPipeline only.Sets the mapping from logical shader color output to physical render pass color attachments.
Use this method to define how the physical color attachments you specify via MTL4RenderPassDescriptor/colorAttachments
map to the logical color output the fragment shader writes to.
To use this feature, make sure to set MTL4RenderPassDescriptor/supportColorAttachmentMapping to
<doc
://com.apple.documentation/documentation/swift/true>.
- Parameter mapping: Mapping from logical shader outputs to physical outputs.
Sourcefn setRenderPipelineState(
&self,
pipeline_state: &ProtocolObject<dyn MTLRenderPipelineState>,
)
Available on crate features MTLAllocation and MTLRenderPipeline only.
fn setRenderPipelineState( &self, pipeline_state: &ProtocolObject<dyn MTLRenderPipelineState>, )
MTLAllocation and MTLRenderPipeline only.Configures this encoder with a render pipeline state that applies to your subsequent draw commands.
- Parameter pipelineState: a non-
nilMTLRenderPipelineStateinstance.
Sourcefn setViewport(&self, viewport: MTLViewport)
Available on crate feature MTLRenderCommandEncoder only.
fn setViewport(&self, viewport: MTLViewport)
MTLRenderCommandEncoder only.Sets the viewport which that transforms vertices from normalized device coordinates to window coordinates.
Metal clips fragments that lie outside this viewport, and optionally clamps fragments outside of z-near/z-far range
depending on the value you assign to setDepthClipMode:.
- Parameter viewport:
MTLViewportto set.
Sourceunsafe fn setViewports_count(
&self,
viewports: NonNull<MTLViewport>,
count: NSUInteger,
)
Available on crate feature MTLRenderCommandEncoder only.
unsafe fn setViewports_count( &self, viewports: NonNull<MTLViewport>, count: NSUInteger, )
MTLRenderCommandEncoder only.Sets an array of viewports to transform vertices from normalized device coordinates to window coordinates.
Metal clips fragments that lie outside of the viewport, and optionally clamps fragments outside of z-near/z-far range,
depending on the value you assign to setDepthClipMode:.
Metal selects the viewport to use from the [[ viewport_array_index ]] attribute you specify in the pipeline
state’s vertex shader function in the Metal Shading Language.
- Parameters:
- viewports: Array of
MTLViewportinstances. - count: Number of
MTLViewportinstances in the array.
§Safety
viewportsmust be a valid pointer.countmight not be bounds-checked.
Sourceunsafe fn setVertexAmplificationCount_viewMappings(
&self,
count: NSUInteger,
view_mappings: *const MTLVertexAmplificationViewMapping,
)
Available on crate feature MTLRenderCommandEncoder only.
unsafe fn setVertexAmplificationCount_viewMappings( &self, count: NSUInteger, view_mappings: *const MTLVertexAmplificationViewMapping, )
MTLRenderCommandEncoder only.Sets the vertex amplification count and its view mapping for each amplification ID.
Each view 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 Metal to route each amplified
vertex to a different [[ render_target_array_index ]] and [[ viewport_array_index ]], even though you can’t
directly amplify these attributes.
- Parameters:
- count: The number of outputs to create. The maximum value is
2. - viewMappings: Array of
MTLVertexAmplificationViewMappinginstances. Each instance provides per-output offsets to a specific render target and viewport.
§Safety
countmight not be bounds-checked.view_mappingsmust be a valid pointer or null.
Sourcefn setCullMode(&self, cull_mode: MTLCullMode)
Available on crate feature MTLRenderCommandEncoder only.
fn setCullMode(&self, cull_mode: MTLCullMode)
MTLRenderCommandEncoder only.Controls whether Metal culls front facing primitives, back facing primitives, or culls no primitives at all.
- Parameter cullMode:
MTLCullModeto set.
Sourcefn setDepthClipMode(&self, depth_clip_mode: MTLDepthClipMode)
Available on crate feature MTLRenderCommandEncoder only.
fn setDepthClipMode(&self, depth_clip_mode: MTLDepthClipMode)
MTLRenderCommandEncoder only.Controls the behavior for fragments outside of the near or far planes.
- Parameter depthClipMode:
MTLDepthClipModeto set.
Sourcefn setDepthBias_slopeScale_clamp(
&self,
depth_bias: c_float,
slope_scale: c_float,
clamp: c_float,
)
fn setDepthBias_slopeScale_clamp( &self, depth_bias: c_float, slope_scale: c_float, clamp: c_float, )
Configures the adjustments a render pass applies to depth values from fragment shader functions by a scaling factor and bias.
- Parameters:
- depthBias: A constant bias the render pipeline applies to all fragments.
- slopeScale: A bias coefficient that scales with the depth of the primitive relative to the camera.
- clamp: A value that limits the bias value the render pipeline can apply to a fragment.
Pass a positive or negative value to limit the largest magnitude of a positive
or negative bias, respectively. Set this value to
0to disable bias clamping.
Sourcefn setDepthTestMinBound_maxBound(&self, min_bound: c_float, max_bound: c_float)
fn setDepthTestMinBound_maxBound(&self, min_bound: c_float, max_bound: c_float)
Configures the minimum and maximum bounds for depth bounds testing.
The render command encoder disables depth bounds testing by default. The render command encoder also disables depth bounds testing when all of the following properties equal a specific value:
- The
minBoundproperty is equal to0.0f. - The
maxBoundproperty is equal to1.0f. BothminBoundandmaxBoundneed to be within[0.0f, 1.0f], andminBoundneeds to be less than or equal tomaxBound. - Parameters:
- minBound: A minimum bound for depth testing, which discards fragments with a stored depth that is less than
minBound. - maxBound: A maximum bound for depth testing, which discards fragments with a stored depth that is greater than
maxBound.
Sourcefn setScissorRect(&self, rect: MTLScissorRect)
Available on crate feature MTLRenderCommandEncoder only.
fn setScissorRect(&self, rect: MTLScissorRect)
MTLRenderCommandEncoder only.Sets a scissor rectangle to discard fragments outside a specific area.
Metal performs a scissor test and discards all fragments outside of the scissor rect.
- Parameter rect:
MTLScissorRectrectangle to specify. This rectangle needs to lie completely within the current render attachment.
Sourceunsafe fn setScissorRects_count(
&self,
scissor_rects: NonNull<MTLScissorRect>,
count: NSUInteger,
)
Available on crate feature MTLRenderCommandEncoder only.
unsafe fn setScissorRects_count( &self, scissor_rects: NonNull<MTLScissorRect>, count: NSUInteger, )
MTLRenderCommandEncoder only.Sets an array of scissor rectangles for a fragment scissor test.
Metal uses the specific scissor rectangle corresponding to the index you specify via the [[ viewport_array_index ]]
output attribute of the vertex shader function in the Metal Shading Language, discarding all fragments outside of
the scissor rect.
- Parameters:
- scissorRects: Array of
MTLScissorRectstructures. - count: Number of
MTLScissorRectstructures in the array.
§Safety
scissor_rectsmust be a valid pointer.countmight not be bounds-checked.
Sourcefn setTriangleFillMode(&self, fill_mode: MTLTriangleFillMode)
Available on crate feature MTLRenderCommandEncoder only.
fn setTriangleFillMode(&self, fill_mode: MTLTriangleFillMode)
MTLRenderCommandEncoder only.Configures how subsequent draw commands rasterize triangle and triangle strip primitives.
- Parameter fillMode:
MTLTriangleFillModethe render pass applies to draw commands that rasterize triangles or triangle strips.
Sourcefn setBlendColorRed_green_blue_alpha(
&self,
red: c_float,
green: c_float,
blue: c_float,
alpha: c_float,
)
fn setBlendColorRed_green_blue_alpha( &self, red: c_float, green: c_float, blue: c_float, alpha: c_float, )
Configures each pixel component value, including alpha, for the render pipeline’s constant blend color.
- Parameters:
- red: A value for the red component for the blend color constant.
- green: A value for the green component for the blend color constant.
- blue: A value for the blue component for the blend color constant.
- alpha: A value for the alpha component for the blend color constant.
Sourcefn setDepthStencilState(
&self,
depth_stencil_state: Option<&ProtocolObject<dyn MTLDepthStencilState>>,
)
Available on crate feature MTLDepthStencil only.
fn setDepthStencilState( &self, depth_stencil_state: Option<&ProtocolObject<dyn MTLDepthStencilState>>, )
MTLDepthStencil only.Configures this encoder with a depth stencil state that applies to your subsequent draw commands.
- Parameter depthStencilState: the
MTLDepthStencilStateinstance to set.
Sourcefn setStencilReferenceValue(&self, reference_value: u32)
fn setStencilReferenceValue(&self, reference_value: u32)
Configures this encoder with a reference value for stencil testing.
The render pipeline applies this reference value to both front-facing and back-facing primitives.
- Parameter referenceValue: A stencil test comparison value.
Sourcefn setStencilFrontReferenceValue_backReferenceValue(
&self,
front_reference_value: u32,
back_reference_value: u32,
)
fn setStencilFrontReferenceValue_backReferenceValue( &self, front_reference_value: u32, back_reference_value: u32, )
Configures the encoder with different stencil test reference values for front-facing and back-facing primitives.
The render pipeline applies frontReferenceValue to front-facing primitives and backReferenceValue to
back-facing primitives.
- Parameters:
- frontReferenceValue: A stencil test comparison value the render pipeline applies to front-facing primitives.
- backReferenceValue: A stencil test comparison value the render pipeline applies to back-facing primitives.
Sourceunsafe fn setVisibilityResultMode_offset(
&self,
mode: MTLVisibilityResultMode,
offset: NSUInteger,
)
Available on crate feature MTLRenderCommandEncoder only.
unsafe fn setVisibilityResultMode_offset( &self, mode: MTLVisibilityResultMode, offset: NSUInteger, )
MTLRenderCommandEncoder only.Configures a visibility test for Metal to run, and the destination for any results it generates.
You use the mode parameter to enable or disable the visibility test, and determine if it produces a boolean
response for passing fragments, or if it counts the number of fragments.
- Parameters:
- mode: A
MTLVisibilityResultModethat configures which visibility test results the render pass saves to a buffer, or disables visibility testing. - offset: A location, in bytes, relative to the start of
MTL4RenderPassDescriptor/visibilityResultBufferThe GPU stores the result of a visibility test atoffset, which needs to be a multiple of8.
§Safety
offset might not be bounds-checked.
Sourceunsafe fn setColorStoreAction_atIndex(
&self,
store_action: MTLStoreAction,
color_attachment_index: NSUInteger,
)
Available on crate feature MTLRenderPass only.
unsafe fn setColorStoreAction_atIndex( &self, store_action: MTLStoreAction, color_attachment_index: NSUInteger, )
MTLRenderPass only.Configures the store action for a color attachment.
- Parameters:
- storeAction: A store action for the color attachment that
can’t be
MTLStoreAction/MTLStoreActionUnknown. - colorAttachmentIndex: The index of a color attachment.
§Safety
colorAttachmentIndex might not be bounds-checked.
Sourcefn setDepthStoreAction(&self, store_action: MTLStoreAction)
Available on crate feature MTLRenderPass only.
fn setDepthStoreAction(&self, store_action: MTLStoreAction)
MTLRenderPass only.Configures the store action for the depth attachment.
- Parameter storeAction: A store action for the depth attachment that
can’t be
MTLStoreAction/MTLStoreActionUnknown.
Sourcefn setStencilStoreAction(&self, store_action: MTLStoreAction)
Available on crate feature MTLRenderPass only.
fn setStencilStoreAction(&self, store_action: MTLStoreAction)
MTLRenderPass only.Configures the store action for the stencil attachment.
- Parameter storeAction: A store action for the stencil attachment that
can’t be
MTLStoreAction/MTLStoreActionUnknown.
Sourceunsafe fn drawPrimitives_vertexStart_vertexCount(
&self,
primitive_type: MTLPrimitiveType,
vertex_start: NSUInteger,
vertex_count: NSUInteger,
)
Available on crate feature MTLRenderCommandEncoder only.
unsafe fn drawPrimitives_vertexStart_vertexCount( &self, primitive_type: MTLPrimitiveType, vertex_start: NSUInteger, vertex_count: NSUInteger, )
MTLRenderCommandEncoder only.Encodes a draw command that renders an instance of a geometric primitive.
This command assigns each vertex a unique vertex_id value that increases from vertexStart through
(vertexStart + vertexCount - 1).
Your vertex shader function can use this value to uniquely identify each vertex.
- Parameters:
- primitiveType: A
MTLPrimitiveTyperepresenting how the command interprets vertex argument data. - vertexStart: The lowest value the command passes to your vertex shader function’s parameter with the
[[vertex_id]]attribute. - vertexCount: An integer that represents the number of vertices of
primitiveTypethe command draws.
§Safety
vertexCount might not be bounds-checked.
Sourceunsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount(
&self,
primitive_type: MTLPrimitiveType,
vertex_start: NSUInteger,
vertex_count: NSUInteger,
instance_count: NSUInteger,
)
Available on crate feature MTLRenderCommandEncoder only.
unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount( &self, primitive_type: MTLPrimitiveType, vertex_start: NSUInteger, vertex_count: NSUInteger, instance_count: NSUInteger, )
MTLRenderCommandEncoder only.Encodes a draw command that renders multiple instances of a geometric primitive.
The command assigns each vertex a unique vertex_id value within its drawing instance
that increases from vertexStart through (vertexStart + vertexCount - 1).
Additionally, the command assigns each drawing instance a unique instance_id value that increases
from 0 through (instanceCount - 1).
Your vertex shader can use the vertex_id value to uniquely identify each vertex in each drawing instance, and the
instance_id value to identify which instance that vertex belongs to.
- Parameters:
- primitiveType: A
MTLPrimitiveTyperepresents how the command interprets vertex argument data. - vertexStart: The lowest value the command passes to your vertex shader function’s parameter with
the
vertex_idattribute. - vertexCount: An integer that represents the number of vertices of
primitiveTypethe command draws. - instanceCount: An integer that represents the number of times the command draws
primitiveTypeprimitives withvertexCountvertices.
§Safety
vertexCountmight not be bounds-checked.instanceCountmight not be bounds-checked.
Sourceunsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance(
&self,
primitive_type: MTLPrimitiveType,
vertex_start: NSUInteger,
vertex_count: NSUInteger,
instance_count: NSUInteger,
base_instance: NSUInteger,
)
Available on crate feature MTLRenderCommandEncoder only.
unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance( &self, primitive_type: MTLPrimitiveType, vertex_start: NSUInteger, vertex_count: NSUInteger, instance_count: NSUInteger, base_instance: NSUInteger, )
MTLRenderCommandEncoder only.Encodes a draw command that renders multiple instances of a geometric primitive, starting with a custom instance identification number.
The command assigns each vertex a unique vertex_id value within its drawing instance
that increases from vertexStart through (vertexStart + vertexCount - 1).
Additionally, the command assigns each drawing instance a unique instance_id value that increases
from baseInstance through (baseInstance + instanceCount - 1).
Your vertex shader can use the vertex_id value to uniquely identify each vertex in each drawing instance, and the
instance_id value to identify which instance that vertex belongs to.
- Parameters:
- primitiveType: A
MTLPrimitiveTyperepresenting how the command interprets vertex argument data. - vertexStart: The lowest value the command passes to your vertex shader function’s parameter with
the
vertex_idattribute. - vertexCount: An integer that represents the number of vertices of
primitiveTypethe command draws. - instanceCount: An integer that represents the number of times the command draws
primitiveTypewithvertexCountvertices. - baseInstance: The lowest value the command passes to your vertex shader function’s parameter with
the
instance_idattribute.
§Safety
vertexCountmight not be bounds-checked.instanceCountmight not be bounds-checked.
Sourceunsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength(
&self,
primitive_type: MTLPrimitiveType,
index_count: NSUInteger,
index_type: MTLIndexType,
index_buffer: MTLGPUAddress,
index_buffer_length: NSUInteger,
)
Available on crate features MTLArgument and MTLGPUAddress and MTLRenderCommandEncoder only.
unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength( &self, primitive_type: MTLPrimitiveType, index_count: NSUInteger, index_type: MTLIndexType, index_buffer: MTLGPUAddress, index_buffer_length: NSUInteger, )
MTLArgument and MTLGPUAddress and MTLRenderCommandEncoder only.Encodes a draw command that renders an instance of a geometric primitive with indexed vertices.
Use this method to perform indexed drawing, where an index buffer determines how Metal assembles primitives.
Metal imposes some restrictions on the index buffer’s address, which needs to be 2- or 4-byte aligned, and its length
in bytes, which needs to be a multiple of 2 or 4, depending on whether the format of the index is
MTLIndexType/MTLIndexTypeUInt16 or MTLIndexType/MTLIndexTypeUInt32.
Use an instance of MTLResidencySet to mark residency of the index buffer the indexBuffer parameter references.
- Parameters:
- primitiveType: A
MTLPrimitiveTyperepresenting how the command interprets vertex argument data. - indexCount: An integer that represents the number of vertices the command reads from
indexBuffer. - indexType: A
MTLIndexTypeinstance that represents the index format. - indexBuffer: GPUAddress of a
MTLBufferinstance that containsindexCountindices ofindexTypeformat. You are responsible for ensuring this address is aligned to 2 bytes if theindexTypeformat isMTLIndexType/MTLIndexTypeUInt16, and aligned to 4 bytes if the format isMTLIndexType/MTLIndexTypeUInt32. - indexBufferLength: An integer that represents the length of
indexBuffer, in bytes. You are responsible for ensuring this this size is a multiple of 2 if theindexTypeformat isMTLIndexType/MTLIndexTypeUInt16, and a multiple of 4 if the format isMTLIndexType/MTLIndexTypeUInt32. If this draw call causes Metal to read indices at or beyond theindexBufferLength, Metal continues to execute them assigning a value of0to thevertex_idattribute.
§Safety
indexCountmight not be bounds-checked.indexBuffermight not be bounds-checked.indexBufferLengthmight not be bounds-checked.
Sourceunsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_instanceCount(
&self,
primitive_type: MTLPrimitiveType,
index_count: NSUInteger,
index_type: MTLIndexType,
index_buffer: MTLGPUAddress,
index_buffer_length: NSUInteger,
instance_count: NSUInteger,
)
Available on crate features MTLArgument and MTLGPUAddress and MTLRenderCommandEncoder only.
unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_instanceCount( &self, primitive_type: MTLPrimitiveType, index_count: NSUInteger, index_type: MTLIndexType, index_buffer: MTLGPUAddress, index_buffer_length: NSUInteger, instance_count: NSUInteger, )
MTLArgument and MTLGPUAddress and MTLRenderCommandEncoder only.Encodes a draw command that renders multiple instances of a geometric primitive with indexed vertices.
Use this method to perform instanced indexed drawing, where an index buffer determines how Metal assembles primitives.
The command assigns each drawing instance a unique instance_id value that increases
from 0 through (instanceCount - 1). Your shader can use this value to identify which
instance the vertex belongs to.
Metal imposes some restrictions on the index buffer’s address, which needs to be 2- or 4-byte aligned, and its length
in bytes, which needs to be a multiple of 2 or 4, depending on whether the format of the index is
MTLIndexType/MTLIndexTypeUInt16 or MTLIndexType/MTLIndexTypeUInt32.
Use an instance of MTLResidencySet to mark residency of the index buffer the indexBuffer parameter references.
- Parameters:
- primitiveType: A
MTLPrimitiveTyperepresenting how the command interprets vertex argument data. - indexCount: An integer that represents the number of vertices the command reads from
indexBuffer. - indexType: A
MTLIndexTypeinstance that represents the index format. - indexBuffer: GPUAddress of a
MTLBufferinstance that containsindexCountindices ofindexTypeformat. You are responsible for ensuring this address is aligned to 2 bytes if theindexTypeformat isMTLIndexType/MTLIndexTypeUInt16, and aligned to 4 bytes if the format isMTLIndexType/MTLIndexTypeUInt32. - indexBufferLength: An integer that represents the length of
indexBuffer, in bytes. You are responsible for ensuring this this size is a multiple of 2 if theindexTypeformat isMTLIndexType/MTLIndexTypeUInt16, and a multiple of 4 if the format isMTLIndexType/MTLIndexTypeUInt32. Metal disregards this value and assigns0to thevertex_idattribute for all primitives that require loading indices at a byte offset ofindexBufferLengthor greater. - instanceCount: An integer that represents the number of times the command draws
primitiveTypewithindexCountvertices.
§Safety
indexCountmight not be bounds-checked.indexBuffermight not be bounds-checked.indexBufferLengthmight not be bounds-checked.instanceCountmight not be bounds-checked.
Sourceunsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_instanceCount_baseVertex_baseInstance(
&self,
primitive_type: MTLPrimitiveType,
index_count: NSUInteger,
index_type: MTLIndexType,
index_buffer: MTLGPUAddress,
index_buffer_length: NSUInteger,
instance_count: NSUInteger,
base_vertex: NSInteger,
base_instance: NSUInteger,
)
Available on crate features MTLArgument and MTLGPUAddress and MTLRenderCommandEncoder only.
unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_instanceCount_baseVertex_baseInstance( &self, primitive_type: MTLPrimitiveType, index_count: NSUInteger, index_type: MTLIndexType, index_buffer: MTLGPUAddress, index_buffer_length: NSUInteger, instance_count: NSUInteger, base_vertex: NSInteger, base_instance: NSUInteger, )
MTLArgument and MTLGPUAddress and MTLRenderCommandEncoder only.Encodes a draw command that renders multiple instances of a geometric primitive with indexed vertices, starting with a custom vertex and instance.
Use this method to perform instanced indexed drawing, where an index buffer determines how Metal assembles primitives whilst customizing the base vertex and base instance value Metal passes to the vertex shader function.
The command assigns each drawing instance a unique instance_id value that increases
from baseInstance through (baseInstance + instanceCount - 1). Your shader can use this value
to identify which instance the vertex belongs to.
Metal imposes some restrictions on the index buffer’s address, which needs to be 2- or 4-byte aligned, and its length
in bytes, which needs to be a multiple of 2 or 4, depending on whether the format of the index is
MTLIndexType/MTLIndexTypeUInt16 or MTLIndexType/MTLIndexTypeUInt32.
Use an instance of MTLResidencySet to mark residency of the index buffer the indexBuffer parameter references.
- Parameters:
- primitiveType: A
MTLPrimitiveTyperepresenting how the command interprets vertex argument data. - indexCount: An integer that represents the number of vertices the command reads from
indexBuffer. - indexType: A
MTLIndexTypeinstance that represents the index format. - indexBuffer: GPUAddress of a
MTLBufferinstance that containsindexCountindices ofindexTypeformat. You are responsible for ensuring this address is aligned to 2 bytes if theindexTypeformat isMTLIndexType/MTLIndexTypeUInt16, and aligned to 4 bytes if the format isMTLIndexType/MTLIndexTypeUInt32. - indexBufferLength: An integer that represents the length of
indexBuffer, in bytes. You are responsible for ensuring this this size is a multiple of 2 if theindexTypeformat isMTLIndexType/MTLIndexTypeUInt16, and a multiple of 4 if the format isMTLIndexType/MTLIndexTypeUInt32. If this draw call causes Metal to read indices at or beyond theindexBufferLength, Metal continues to execute them assigning a value of0to thevertex_idattribute. - instanceCount: An integer that represents the number of times the command draws
primitiveTypewithindexCountvertices. - baseVertex: The lowest value the command passes to your vertex shader functions’s parameter with the
vertex_idattribute. Metal disregards this value and assigns0to thevertex_idattribute for all primitives that require loading indices at a byte offset ofindexBufferLengthor greater. - baseInstance: The lowest value the command passes to your vertex shader’s parameter with the
instance_idattribute.
§Safety
indexCountmight not be bounds-checked.indexBuffermight not be bounds-checked.indexBufferLengthmight not be bounds-checked.instanceCountmight not be bounds-checked.
Sourcefn drawPrimitives_indirectBuffer(
&self,
primitive_type: MTLPrimitiveType,
indirect_buffer: MTLGPUAddress,
)
Available on crate features MTLGPUAddress and MTLRenderCommandEncoder only.
fn drawPrimitives_indirectBuffer( &self, primitive_type: MTLPrimitiveType, indirect_buffer: MTLGPUAddress, )
MTLGPUAddress and MTLRenderCommandEncoder only.Encodes a draw command that renders multiple instances of a geometric primitive with indirect arguments.
When you use this function, Metal reads the parameters to the draw command from an MTLBuffer instance,
allowing you to implement a GPU-driven workflow where a compute pipeline state determines the draw arguments.
You are responsible for ensuring that the address of the indirect buffer you provide to this method has 4-byte alignment.
Because this is a non-indexed draw call, Metal interprets the contents of the indirect buffer to match the
layout of struct MTLDrawPrimitivesIndirectArguments.
Use an instance of MTLResidencySet to mark residency of the indirect buffer that the indirectBuffer parameter
references.
- Parameters:
- primitiveType: A
MTLPrimitiveTyperepresenting how the command interprets vertex argument data. - indirectBuffer: GPUAddress of a
MTLBufferinstance with data that matches the layout of theMTLDrawPrimitivesIndirectArgumentsstructure. You are responsible for ensuring that the alignment of this address is 4 bytes.
Sourceunsafe fn drawIndexedPrimitives_indexType_indexBuffer_indexBufferLength_indirectBuffer(
&self,
primitive_type: MTLPrimitiveType,
index_type: MTLIndexType,
index_buffer: MTLGPUAddress,
index_buffer_length: NSUInteger,
indirect_buffer: MTLGPUAddress,
)
Available on crate features MTLArgument and MTLGPUAddress and MTLRenderCommandEncoder only.
unsafe fn drawIndexedPrimitives_indexType_indexBuffer_indexBufferLength_indirectBuffer( &self, primitive_type: MTLPrimitiveType, index_type: MTLIndexType, index_buffer: MTLGPUAddress, index_buffer_length: NSUInteger, indirect_buffer: MTLGPUAddress, )
MTLArgument and MTLGPUAddress and MTLRenderCommandEncoder only.Encodes a draw command that renders multiple instances of a geometric primitive with indexed vertices and indirect arguments.
When you use this function, Metal reads the parameters to the draw command from an MTLBuffer instance,
allowing you to implement a GPU-driven workflow where a compute pipeline state determines the draw arguments.
Because this is an indexed draw call, Metal interprets the contents of the indirect buffer to match the
layout of struct MTLDrawIndexedPrimitivesIndirectArguments, which includes indexStart and indexCount
members, denoting a range within the index buffer you provide in the indexBuffer parameter.
The range of indices within the indexBuffer form the primitives Metal draws.
Metal imposes some restrictions on the index buffer’s address, which needs to be 2- or 4-byte aligned, and its length
in bytes, which needs to be a multiple of 2 or 4, depending on whether the format of the index is
MTLIndexType/MTLIndexTypeUInt16 or MTLIndexType/MTLIndexTypeUInt32.
Similarly, you are responsible for ensuring the indirect buffer’s address has 4-byte alignment.
Use an instance of MTLResidencySet to mark residency of the indirect buffer that the indirectBuffer parameter
references, and of the index buffer the indexBuffer parameter references.
- Parameters:
- primitiveType: A
MTLPrimitiveTyperepresenting how the command interprets vertex argument data. - indexType: A
MTLIndexTypeinstance that represents the index format. - indexBuffer: GPUAddress of a
MTLBufferinstance that containsindexCountindices ofindexTypeformat. You are responsible for ensuring this address is aligned to 2 bytes if theindexTypeformat isMTLIndexType/MTLIndexTypeUInt16, and aligned to 4 bytes if the format isMTLIndexType/MTLIndexTypeUInt32. - indexBufferLength: An integer that represents the length of
indexBuffer, in bytes. You are responsible for ensuring this this size is a multiple of 2 if theindexTypeformat isMTLIndexType/MTLIndexTypeUInt16, and a multiple of 4 if the format isMTLIndexType/MTLIndexTypeUInt32. If this draw call causes Metal to read indices at or beyond theindexBufferLength, Metal continues to execute them assigning a value of0to thevertex_idattribute. - indirectBuffer: GPUAddress of an
MTLBufferinstance with data that matches the layout of theMTLDrawIndexedPrimitivesIndirectArgumentsstructure. This address requires 4-byte alignment.
§Safety
indexBuffermight not be bounds-checked.indexBufferLengthmight not be bounds-checked.
Sourceunsafe fn executeCommandsInBuffer_withRange(
&self,
indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
execution_range: NSRange,
)
Available on crate features MTLAllocation and MTLIndirectCommandBuffer and MTLResource only.
unsafe fn executeCommandsInBuffer_withRange( &self, indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>, execution_range: NSRange, )
MTLAllocation and MTLIndirectCommandBuffer and MTLResource only.Encodes a command that runs a range of commands from an indirect command buffer.
- Parameters:
- indirectCommandBuffer: A
MTLIndirectCommandBufferinstance containing other commands that the current command runs. - executionRange: A span of integers that represent the command entries in the buffer that the current command runs.
§Safety
indirect_command_buffermay need to be synchronized.indirect_command_buffermay be unretained, you must ensure it is kept alive while in use.executionRangemight not be bounds-checked.
Sourceunsafe fn executeCommandsInBuffer_indirectBuffer(
&self,
indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
indirect_range_buffer: MTLGPUAddress,
)
Available on crate features MTLAllocation and MTLGPUAddress and MTLIndirectCommandBuffer and MTLResource only.
unsafe fn executeCommandsInBuffer_indirectBuffer( &self, indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>, indirect_range_buffer: MTLGPUAddress, )
MTLAllocation and MTLGPUAddress and MTLIndirectCommandBuffer and MTLResource only.Encodes a command that runs an indirect range of commands from an indirect command buffer.
Use this method to indicate to Metal the span of indices in the command buffer to execute indirectly via an
MTLBuffer instance you provide in the indirectRangeBuffer parameter. This allows you to calculate the
span of commands Metal executes in the GPU timeline, enabling GPU-driven workflows.
Metal requires that the contents of this buffer match the layout of struct MTLIndirectCommandBufferExecutionRange,
which specifies a location and a length within the indirect command buffer. You are responsible for ensuring the
address of this buffer has 4-byte alignment.
Use an instance of MTLResidencySet to mark residency of the indirect buffer that the indirectRangeBuffer
parameter references.
- Parameters:
- indirectCommandBuffer: A
MTLIndirectCommandBufferinstance that contains other commands the current command runs. - indirectRangeBuffer: GPUAddress of a
MTLBufferinstance with data that matches the layout of theMTLIndirectCommandBufferExecutionRangestructure. This address requires 4-byte alignment.
§Safety
indirect_command_buffermay need to be synchronized.indirect_command_buffermay be unretained, you must ensure it is kept alive while in use.indirectRangeBuffermight not be bounds-checked.
Sourceunsafe fn setObjectThreadgroupMemoryLength_atIndex(
&self,
length: NSUInteger,
index: NSUInteger,
)
unsafe fn setObjectThreadgroupMemoryLength_atIndex( &self, length: NSUInteger, index: NSUInteger, )
Configures the size of a threadgroup memory buffer for a threadgroup argument in the object shader function.
- Parameters:
- length: The size of the threadgroup memory, in bytes.
- index: An integer that corresponds to the index of the argument you annotate with attribute
[[threadgroup(index)]]in the shader function.
§Safety
index might not be bounds-checked.
Sourcefn drawMeshThreadgroups_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
&self,
threadgroups_per_grid: MTLSize,
threads_per_object_threadgroup: MTLSize,
threads_per_mesh_threadgroup: MTLSize,
)
Available on crate feature MTLTypes only.
fn drawMeshThreadgroups_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup( &self, threadgroups_per_grid: MTLSize, threads_per_object_threadgroup: MTLSize, threads_per_mesh_threadgroup: MTLSize, )
MTLTypes only.Encodes a draw command that invokes a mesh shader and, optionally, an object shader with a grid of threadgroups.
- Parameters:
- threadgroupsPerGrid: A
MTLSizeinstance that represents the number of threadgroups for each grid dimension. - threadsPerObjectThreadgroup: A
MTLSizeinstance that represents the number of threads in an object shader threadgroup, if applicable. - threadsPerMeshThreadgroup: A
MTLSizeinstance that represents the number of threads in a mesh shader threadgroup.
Sourcefn drawMeshThreads_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
&self,
threads_per_grid: MTLSize,
threads_per_object_threadgroup: MTLSize,
threads_per_mesh_threadgroup: MTLSize,
)
Available on crate feature MTLTypes only.
fn drawMeshThreads_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup( &self, threads_per_grid: MTLSize, threads_per_object_threadgroup: MTLSize, threads_per_mesh_threadgroup: MTLSize, )
MTLTypes only.Encodes a draw command that invokes a mesh shader and, optionally, an object shader with a grid of threads.
- Parameters:
- threadsPerGrid: A
MTLSizeinstance that represents the number of threads for each grid dimension. For mesh shaders, the command rounds the value down to the nearest multiple ofthreadsPerMeshThreadgroupfor each dimension. For object shaders, the value doesn’t need to be a multiple ofthreadsPerObjectThreadgroup. - threadsPerObjectThreadgroup: A
MTLSizeinstance that represents the number of threads in an object shader threadgroup, if applicable. - threadsPerMeshThreadgroup: A
MTLSizeinstance that represents the number of threads in a mesh shader threadgroup.
Sourcefn drawMeshThreadgroupsWithIndirectBuffer_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
&self,
indirect_buffer: MTLGPUAddress,
threads_per_object_threadgroup: MTLSize,
threads_per_mesh_threadgroup: MTLSize,
)
Available on crate features MTLGPUAddress and MTLTypes only.
fn drawMeshThreadgroupsWithIndirectBuffer_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup( &self, indirect_buffer: MTLGPUAddress, threads_per_object_threadgroup: MTLSize, threads_per_mesh_threadgroup: MTLSize, )
MTLGPUAddress and MTLTypes only.Encodes a draw command that invokes a mesh shader and, optionally, an object shader with indirect arguments.
This method enables you to determine the number of threadgroups per grid indirectly, in the GPU timeline.
Metal expects this buffer’s contents to match the layout of structure MTLDispatchThreadgroupsIndirectArguments.
You are responsible for ensuring the address of this buffer has 4-byte alignment.
Use an instance of MTLResidencySet to mark residency of the indirect buffer that the indirectBuffer parameter
references.
- Parameters:
- indirectBuffer: GPUAddress of an
MTLBufferinstance with data that matches the layout of theMTLDispatchThreadgroupsIndirectArgumentsstructure. This address requires 4-byte alignment. - threadsPerObjectThreadgroup: A
MTLSizeinstance that represents the number of threads in an object shader threadgroup, if applicable. - threadsPerMeshThreadgroup: A
MTLSizeinstance that represents the number of threads in a mesh shader threadgroup.
Sourcefn dispatchThreadsPerTile(&self, threads_per_tile: MTLSize)
Available on crate feature MTLTypes only.
fn dispatchThreadsPerTile(&self, threads_per_tile: MTLSize)
MTLTypes only.Encodes a command that invokes a tile shader function from the encoder’s current tile render pipeline state.
- Parameter threadsPerTile: A
MTLSizeinstance that represents the number of threads the render pass uses per tile. Set the size’sMTLSize/widthandMTLSize/heightproperties to values that are less than or equal totileWidthandtileHeight, respectively. Some GPU families only support square tile dispatches and require the same value for width and height. SetMTLSize/depthto1.
Sourceunsafe fn setThreadgroupMemoryLength_offset_atIndex(
&self,
length: NSUInteger,
offset: NSUInteger,
index: NSUInteger,
)
unsafe fn setThreadgroupMemoryLength_offset_atIndex( &self, length: NSUInteger, offset: NSUInteger, index: NSUInteger, )
Configures the size of a threadgroup memory buffer for a threadgroup argument in the fragment and tile shader functions.
- Parameters:
- length: The size of the threadgroup memory, in bytes.
- offset: An integer that represents the location, in bytes, from the start of the threadgroup memory buffer
at
indexwhere the threadgroup memory begins. - index: An integer that corresponds to the index of the argument you annotate with attribute
[[threadgroup(index)]]in the shader function.
§Safety
offsetmight not be bounds-checked.indexmight not be bounds-checked.
Sourcefn setArgumentTable_atStages(
&self,
argument_table: &ProtocolObject<dyn MTL4ArgumentTable>,
stages: MTLRenderStages,
)
Available on crate features MTL4ArgumentTable and MTLRenderCommandEncoder only.
fn setArgumentTable_atStages( &self, argument_table: &ProtocolObject<dyn MTL4ArgumentTable>, stages: MTLRenderStages, )
MTL4ArgumentTable and MTLRenderCommandEncoder only.Associates an argument table with a set of render stages.
Metal takes a snapshot of the resources in the argument table when you encode a draw, dispatch, or execute command.
This snapshot becomes available to the stages you specify to this method.
- Parameters:
- argumentTable:
MTL4ArgumentTableto set. - stages: A
MTLRenderStagesbitmask that specifies the shader stages with visibility over the table.
Sourcefn setFrontFacingWinding(&self, front_facing_winding: MTLWinding)
Available on crate feature MTLRenderCommandEncoder only.
fn setFrontFacingWinding(&self, front_facing_winding: MTLWinding)
MTLRenderCommandEncoder only.Configures the vertex winding order that determines which face of a geometric primitive is the front one.
- Parameter frontFacingWinding: A
MTLWindingvalue that determines which side of a primitive the render pipeline interprets as front facing.
Sourceunsafe fn writeTimestampWithGranularity_afterStage_intoHeap_atIndex(
&self,
granularity: MTL4TimestampGranularity,
stage: MTLRenderStages,
counter_heap: &ProtocolObject<dyn MTL4CounterHeap>,
index: NSUInteger,
)
Available on crate features MTL4Counters and MTLRenderCommandEncoder only.
unsafe fn writeTimestampWithGranularity_afterStage_intoHeap_atIndex( &self, granularity: MTL4TimestampGranularity, stage: MTLRenderStages, counter_heap: &ProtocolObject<dyn MTL4CounterHeap>, index: NSUInteger, )
MTL4Counters and MTLRenderCommandEncoder only.Writes a GPU timestamp into the given MTL4CounterHeap at index after stage completes.
This command only guarantees all draws prior to this command are complete when Metal writes the timestamp into
the counter heap you provide in the counterHeap parameter. The timestamp may also include subsequent operations.
If you call this method before any draw calls, Metal writes a timestamp before the stage you specify in the
stage parameter begins.
- Parameters:
- granularity: a
MTL4TimestampGranularityhint. - stage:
MTLRenderStagesthat need to complete before Metal writes the timestamp. This may also include later stages that are related, for exampleMTLRenderStages/MTLRenderStageMeshmay includeMTLRenderStages/MTLRenderStageVertex. - counterHeap:
MTL4CounterHeapinto which Metal writes timestamps. - index: The index value into which Metal writes this timestamp.
§Safety
index might not be bounds-checked.