Instance Property

currentRenderPassDescriptor

A render pass descriptor generated from the current drawable’s texture, the view’s buffers, and the view’s clear values.

Declaration

@property(nonatomic, readonly) MTLRenderPassDescriptor *currentRenderPassDescriptor;

Discussion

This is a convenience property. MTKView does not use this descriptor, and there is no requirement for your application to use this descriptor, either.

This property is nil if the view’s device is not set. This property is also nil if currentDrawable is nil. Your app should check that currentRenderPassDescriptor is not nil before attempting to draw.

The color attachment at index 0 of the render pass descriptor points to the texture assigned to the current drawable.

Use a MTLRenderCommandEncoder object to render into the drawable’s texture and present it for display (typically registered via the presentDrawable:method of a command buffer). Try to minimize the time between when you fetch the drawable and when you submit the command buffer that uses it. For example, you might perform other work on the CPU, render to offscreen textures or execute compute passes, then obtain the drawable and encode a command buffer to render to it. After you submit this command buffer, release all strong references to the drawable. A texture can be reused only if it is not onscreen and all strong references to the drawable have been released. If you don’t release drawables correctly, the view will run out of drawables to vend.

See Also

Generated Render Target Objects

currentDrawable

The drawable to be used for the current frame.

depthStencilTexture

A packed depth/stencil texture attached to the currentDrawable object’s texture.

multisampleColorTexture

A multisample color sample texture resolved into the currentDrawable object’s texture.