Class MetalCommandBufferPool
- Namespace
- DotCompute.Backends.Metal.Utilities
- Assembly
- DotCompute.Backends.Metal.dll
Pool for managing Metal command buffers to reduce allocation overhead.
public sealed class MetalCommandBufferPool : IDisposable
- Inheritance
-
MetalCommandBufferPool
- Implements
- Inherited Members
- Extension Methods
Constructors
MetalCommandBufferPool(nint, ILogger<MetalCommandBufferPool>, int)
Initializes a new instance of the MetalCommandBufferPool.
public MetalCommandBufferPool(nint commandQueue, ILogger<MetalCommandBufferPool> logger, int maxPoolSize = 16)
Parameters
commandQueuenintThe Metal command queue to create buffers from.
loggerILogger<MetalCommandBufferPool>Logger for diagnostics.
maxPoolSizeintMaximum number of buffers to keep in pool.
Properties
Stats
Gets statistics about the command buffer pool.
public CommandBufferPoolStats Stats { get; }
Property Value
Methods
Cleanup()
Performs cleanup of stale buffers from the pool.
public void Cleanup()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetCommandBuffer()
Gets a command buffer from the pool or creates a new one.
public nint GetCommandBuffer()
Returns
- nint
A command buffer handle.
GetStats()
Gets statistics about the command buffer pool (API compatibility method).
public CommandBufferPoolStats GetStats()
Returns
ReturnCommandBuffer(nint)
Returns a command buffer to the pool for reuse.
public void ReturnCommandBuffer(nint buffer)
Parameters
buffernintThe command buffer to return.