Class CpuComputeContext
CPU compute context implementation providing fallback compute capabilities
public sealed class CpuComputeContext : IComputeContext, IDisposable
- Inheritance
-
CpuComputeContext
- Implements
- Inherited Members
Constructors
CpuComputeContext(ILogger)
Initializes a new instance of the CpuComputeContext class
public CpuComputeContext(ILogger logger)
Parameters
loggerILoggerLogger instance for diagnostics
Properties
Backend
Gets the compute backend type (CPU)
public GpuBackend Backend { get; }
Property Value
DeviceIndex
Gets the device index (always 0 for CPU)
public int DeviceIndex { get; }
Property Value
Methods
CompileKernel(string, string)
Compiles a compute kernel for CPU execution
public IComputeKernel CompileKernel(string source, string entryPoint)
Parameters
Returns
- IComputeKernel
A compiled CPU kernel instance
CreateBuffer<T>(int, BufferUsage)
Creates a new CPU compute buffer
public IComputeBuffer<T> CreateBuffer<T>(int size, BufferUsage usage) where T : unmanaged
Parameters
sizeintNumber of elements in the buffer
usageBufferUsageUsage flags for the buffer
Returns
- IComputeBuffer<T>
A new CPU compute buffer instance
Type Parameters
TThe unmanaged element type
Dispose()
Disposes the CPU compute context
public void Dispose()
Execute(IComputeKernel, int)
Executes a CPU compute kernel
public void Execute(IComputeKernel kernel, int workSize)
Parameters
kernelIComputeKernelThe kernel to execute
workSizeintNumber of work items to execute
Synchronize()
Synchronizes the CPU compute context (no-op for CPU)
public void Synchronize()