Sets an array of viewports.
- iOS 12.0+
- macOS 10.13+
- Mac Catalyst 13.0+Beta
An array of viewports.
The number of viewports in the array.
Use this method to specify multiple active viewports and corresponding scissor rectangles, enabling you to draw into separate areas of an image using a single draw call.
The maximum number of supported viewports and scissor rectangles varies by device. For more information, see Using Metal Feature Set Tables.
The rendering pipeline uses only one of the viewports to transform and clip vertices. You select this viewport per primitive by specifying a
[[viewport attribute on an output value from your vertex function.
Calling this method with an array of length
1 is equivalent to calling the
set method. Calling
set after calling
set, and vice versa, overrides previously set viewports.
You can call the
set method to set a single scissor rectangle for all viewports. Otherwise, you can call the
set method to set different scissor rectangles for different viewports. The number of scissor rectangles must match the number of viewports.