Contents

setViewports(_:)

Sets an array of viewports to transform vertices from normalized device coordinates to window coordinates.

Declaration

func setViewports(_ viewports: [MTLViewport])

Parameters

Discussion

Metal clips fragments that lie outside of the viewport, and optionally clamps fragments outside of z-near/z-far range, depending on the value you assign to setDepthClipMode(_:).

Metal selects the viewport to use from the [[ viewport_array_index ]] attribute you specify in the pipeline state’s vertex shader function in the Metal Shading Language.

See Also

Configuring viewport and scissor behavior