Class MetalCommandEncoder
- Namespace
- DotCompute.Backends.Metal.Execution
- Assembly
- DotCompute.Backends.Metal.dll
High-level Metal command encoder abstraction for compute operations, providing a simplified interface over native Metal compute command encoders.
public sealed class MetalCommandEncoder : IDisposable
- Inheritance
-
MetalCommandEncoder
- Implements
- Inherited Members
- Extension Methods
Constructors
MetalCommandEncoder(nint, ILogger<MetalCommandEncoder>)
public MetalCommandEncoder(nint commandBuffer, ILogger<MetalCommandEncoder> logger)
Parameters
commandBuffernintloggerILogger<MetalCommandEncoder>
Properties
EncoderHandle
Gets the native encoder handle
public nint EncoderHandle { get; }
Property Value
IsEncodingEnded
Gets whether encoding has been ended
public bool IsEncodingEnded { get; }
Property Value
Methods
DispatchThreadgroups(MetalDispatchSize, MetalDispatchSize)
Dispatches threadgroups for compute execution
public void DispatchThreadgroups(MetalDispatchSize gridSize, MetalDispatchSize threadgroupSize)
Parameters
gridSizeMetalDispatchSizethreadgroupSizeMetalDispatchSize
DispatchThreadgroups1D(int, int)
Dispatches threadgroups with 1D configuration
public void DispatchThreadgroups1D(int gridWidth, int threadgroupWidth)
Parameters
DispatchThreadgroups2D(int, int, int, int)
Dispatches threadgroups with 2D configuration
public void DispatchThreadgroups2D(int gridWidth, int gridHeight, int threadgroupWidth, int threadgroupHeight)
Parameters
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
EndEncoding()
Ends encoding and finalizes the command encoder
public void EndEncoding()
~MetalCommandEncoder()
protected ~MetalCommandEncoder()
GetCommandHistory()
Gets detailed information about all encoded commands
public IReadOnlyList<MetalEncoderCommand> GetCommandHistory()
Returns
GetEncodingStats()
Gets a summary of all commands encoded
public MetalEncodingStats GetEncodingStats()
Returns
SetBuffer(nint, nuint, int)
Binds a buffer to the specified index
public void SetBuffer(nint buffer, nuint offset, int index)
Parameters
SetBytes(ReadOnlySpan<byte>, int)
Sets constant data from a byte array
public void SetBytes(ReadOnlySpan<byte> data, int index)
Parameters
dataReadOnlySpan<byte>indexint
SetBytes<T>(T, int)
Sets constant data at the specified index
public void SetBytes<T>(T data, int index) where T : unmanaged
Parameters
dataTindexint
Type Parameters
T
SetComputePipelineState(nint)
Sets the compute pipeline state for subsequent operations
public void SetComputePipelineState(nint pipelineState)
Parameters
pipelineStatenint