Instance Method

setViewports:count:

Sets an array of viewports, one of which is used for transformations and clipping.

Required.

Declaration

- (void)setViewports:(const MTLViewport *)viewports count:(NSUInteger)count;

Parameters

viewports

An array of viewports.

count

The number of viewports in the array.

Discussion

Use this method to specify multiple active viewports and corresponding scissor rectangles, enabling you to draw into separate areas of an image without issuing multiple separate draw calls.

Only one of the viewports in the array is used for transformations and clipping. You select this viewport by specifying a [[viewport_array_index]] value in your vertex shader.

Calling this method with a single-viewport array is equivalent to calling the setViewport: method. Calling setViewport: after calling setViewports:count: overrides previously set viewports, and vice-versa.

You can call the setScissorRect: method to set a single scissor rectangle for all viewports. Otherwise, you can call the setScissorRects:count: method to set different scissor rectangles for different viewports, as long as the number of scissor rectangles matches the number of viewports.

See Also

Setting Graphics Rendering State

setBlendColorRed:green:blue:alpha:

Specifies the constant blend color and alpha values.

Required.

setCullMode:

Controls whether primitives are culled when front facing, back facing, or not culled at all.

Required.

setDepthBias:slopeScale:clamp:

Adjusts the depth values from fragment functions by a scaling factor and a scaling bias, clamping the bias to a maximum amount.

Required.

setDepthClipMode:

Controls what is done with fragments outside of the near or far planes.

Required.

setDepthStencilState:

Sets the depth and stencil test state.

Required.

setFrontFacingWinding:

Sets the winding order of front-facing primitives.

Required.

setRenderPipelineState:

Sets the current render pipeline state object.

Required.

setStencilFrontReferenceValue:backReferenceValue:

Separately sets the front and back stencil reference values for stencil comparison tests.

Required.

setStencilReferenceValue:

Jointly sets the front and back stencil reference values for stencil comparison tests.

Required.

setTriangleFillMode:

Sets how to rasterize triangle and triangle strip primitives.

Required.

setVisibilityResultMode:offset:

Controls how to monitor samples that pass the depth and stencil tests.

Required.

setViewport:

Sets the viewport used for transformations and clipping.

Required.

setScissorRect:

Sets the scissor rectangle for a fragment scissor test.

Required.

setScissorRects:count:

Sets an array of scissor rectangles, one of which is used for a fragment scissor test.

Required.