Class

MTLRenderPipelineColorAttachmentDescriptor

A color render target that specifies the color configuration and color operations associated with a render pipeline.

Declaration

class MTLRenderPipelineColorAttachmentDescriptor : NSObject

Overview

A MTLRenderPipelineColorAttachmentDescriptor object defines the configuration of a color attachment associated with a rendering pipeline.

The pixelFormat property must be specified for the rendering pipeline state at the color attachment.

Blend operations determine how a source fragment is combined with a destination value in a color attachment to determine the pixel value to be written. The following properties define whether and how blending is performed:

Topics

Specifying Render Pipeline State

var pixelFormat: MTLPixelFormat

The pixel format of the color attachment’s texture.

var writeMask: MTLColorWriteMask

A bitmask that restricts which color channels are written into the texture.

Controlling the Blend Operation

var isBlendingEnabled: Bool

A Boolean value that determines whether blending is enabled.

var alphaBlendOperation: MTLBlendOperation

The blend operation assigned for the alpha data.

var rgbBlendOperation: MTLBlendOperation

The blend operation assigned for the RGB data.

Specifying Blend Factors

var destinationAlphaBlendFactor: MTLBlendFactor

The destination blend factor (DBF) used by the alpha blend operation.

var destinationRGBBlendFactor: MTLBlendFactor

The destination blend factor (DBF) used by the RGB blend operation.

var sourceAlphaBlendFactor: MTLBlendFactor

The source blend factor (SBF) used by the alpha blend operation.

var sourceRGBBlendFactor: MTLBlendFactor

The source blend factor (SBF) used by the RGB blend operation.

Constants

enum MTLBlendOperation

For every pixel, MTLBlendOperation determines how to combine and weight the source fragment values with the destination values. Some blend operations multiply the source values by a source blend factor (SBF), multiply the destination values by a destination blend factor (DBF), and then combine the results using addition or subtraction. Other blend operations use either a minimum or maximum function to determine the result.

enum MTLBlendFactor

The source and destination blend factors are often needed to complete specification of a blend operation. In most cases, the blend factor for both RGB values (F(rgb)) and alpha values (F(a)) are similar to one another, but in some cases, such as MTLBlendFactorSourceAlphaSaturated, the blend factor is slightly different. Four blend factors (MTLBlendFactorBlendColor, MTLBlendFactorOneMinusBlendColor, MTLBlendFactorBlendAlpha, and MTLBlendFactorOneMinusBlendAlpha) refer to a constant blend color value that is set by the setBlendColor(red:green:blue:alpha:) method of MTLRenderCommandEncoder.

struct MTLColorWriteMask

Values used to specify a mask to permit or restrict writing to color channels of a color value. The values red, green, blue, and alpha select one color channel each, and they can be bitwise combined.

Relationships

Inherits From

See Also

Specifying Rendering Pipeline State

func reset()

Specifies the default rendering pipeline state values for the descriptor.

var colorAttachments: MTLRenderPipelineColorAttachmentDescriptorArray

An array of attachments that store color data.

var depthAttachmentPixelFormat: MTLPixelFormat

The pixel format of the attachment that stores depth data.

var stencilAttachmentPixelFormat: MTLPixelFormat

The pixel format of the attachment that stores stencil data.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software