Table of Contents

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

commandQueue nint

The Metal command queue to create buffers from.

logger ILogger<MetalCommandBufferPool>

Logger for diagnostics.

maxPoolSize int

Maximum number of buffers to keep in pool.

Properties

Stats

Gets statistics about the command buffer pool.

public CommandBufferPoolStats Stats { get; }

Property Value

CommandBufferPoolStats

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

CommandBufferPoolStats

ReturnCommandBuffer(nint)

Returns a command buffer to the pool for reuse.

public void ReturnCommandBuffer(nint buffer)

Parameters

buffer nint

The command buffer to return.