A render target that serves as the output destination for pixels generated by a render pass.
- iOS 8.0+
- macOS 10.11+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
MTLRender object is used to configure an individual render target of a framebuffer. Each
MTLRender object specifies one texture that a graphics rendering pass can write into.
Typically, you do not directly create
MTLRender objects. Instead, when you initialize a
MTLRender object, a default set of attachment objects is created automatically. For each attachment that you intend to use as a render target, you retrieve the
MTLRender object from the render pass descriptor and configure its properties for how it is used during this rendering pass.
You must set the attachment’s
texture property, choosing an appropriate pixel format. The
depth properties specify the mipmap level, slice, and depth plane (for 3D textures) of the texture, respectively.
store properties specify actions that are performed at the start or end of a rendering pass, respectively, for the attachment. For example, if the
load property of an attachment is set to
MTLRender, then at the start of a rendering pass, the contents of the texture are filled with a value that is appropriate for the type of attachment.
There are specific
MTLRender subclasses for color, depth, and stencil attachments. Each subclass provides additional properties to configure for that kind of attachment. Table 1 provides the list of subclasses.
To perform multisampled antialiased rendering, you use two textures. Attach a
MTLTexture texture to the
texture property and a 2D or cube texture to the
resolve property. When a rendering command is executed, all rendering is performed on the multisample texture as usual. Then, the contents of the multisample texture are resolved and written into the resolve texture. The
resolve properties specify where the resolved image is written to. The contents of the multisample texture are then discarded.