Sets an array of viewports.
- iOS 12.0+
- macOS 10.13+
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 Metal Feature Sets.
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 a single-viewport array is equivalent to calling the
set method. Calling
set after calling
set overrides previously set viewports, and vice versa.
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, as long as the number of scissor rectangles matches the number of viewports.
The number of scissor rectangles must match the number of viewports.