MTLRender protocol defines the interface for a lightweight object used to encode the state for a configured graphics rendering pipeline.
- iOS 8.0+
- macOS 10.11+
- tvOS 8.0+
MTLRender to encode commands for a rendering pass, specify a
MTLRender object that defines the graphics state, including vertex and fragment shader functions, before issuing any draw calls. Because creating a pipeline state object can require an expensive evaluation of graphics state and a possible compilation of the specified graphics shader functions, you usually create these pipeline state objects early in the development of your app and reuse them throughout its lifetime.
Do not use standard allocation and initialization techniques to create a
MTLRender object. To create a
MTLRender object, first create a
MTLRender object that describes the desired state of the pipeline. Then call one of these
Call either the
Render Pipeline State(descriptor:)
makemethod to synchronously create a
Render Pipeline State(descriptor: options: reflection:)
MTLRenderobject and compile the graphics state, including graphics shader code.
Call either the
Render Pipeline State(descriptor: completion Handler:)
makemethod to asynchronously create a
Render Pipeline State(descriptor: options: completion Handler:)
MTLRenderobject and compile the graphics state, including graphics shader code. The completion handler is the last operation executed during creation of the pipeline state object.
make methods of
MTLDevice also obtain reflection data in a
MTLRender object that reveals details of the arguments of the vertex and fragment functions. (In
make, the reflection data is returned in the completion handler.) Obtain reflection data only if it will be used.