An object used to customize how a new compute pipeline state object is compiled.


class MTLComputePipelineDescriptor : NSObject


To create a MTLComputePipelineState object, you create a pipeline descriptor, configure its properties, and pass it to one of the creation methods on a MTLDevice object. See Creating a Compute Pipeline.

Use standard allocation and initialization techniques to create a MTLComputePipelineDescriptor object and configure its properties. The most important property to set is the computeFunction property, which specifies which Metal function to call.


Specifying the Compute Function and Associated Data

var computeFunction: MTLFunction?

The compute function to be compiled into the pipeline state object.

var threadGroupSizeIsMultipleOfThreadExecutionWidth: Bool

A Boolean that indicates whether the threadgroup size must always be a multiple of the thread execution width.

var maxTotalThreadsPerThreadgroup: Int

The maximum number of threads allowed for a threadgroup dispatched to the compute function.

Specifying Buffer Layouts and Fetch Behavior

var stageInputDescriptor: MTLStageInputOutputDescriptor?

The organization of input and output data for the compute function.

class MTLStageInputOutputDescriptor

An object that describes the input and output data of a function.

class MTLAttributeDescriptor

An object that describes an argument's format and where its data is stored in memory.

class MTLBufferLayoutDescriptor

An object that configures how input data for an attribute is fetched by a function.

Specifying Buffer Mutability

var buffers: MTLPipelineBufferDescriptorArray

The buffer mutability options for a compute pipeline's kernel function.

class MTLPipelineBufferDescriptor

An object that contains the mutability options for buffers used in a render or compute pass.

Identifying the Pipeline State Object

var label: String?

A string that identifies this object.

Setting Indirect Command Buffer Support

Resetting the Compute Pipeline State

func reset()

Resets all compute pipeline descriptor properties to their default values.


Inherits From

See Also

Parallel Computation

Processing a Texture in a Compute Function

Perform data-parallel computations on texture data.

Creating Threads and Threadgroups

Learn how Metal organizes compute-processing workloads.

Calculating Threadgroup and Grid Sizes

Calculate the optimum sizes for threadgroups and grids when dispatching compute-processing workloads.

protocol MTLComputePipelineState

An object that contains a compiled compute pipeline.

protocol MTLComputeCommandEncoder

An object used to encode commands in a compute pass.