---
title: "setScissorRects(_:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/setscissorrects(_:)"
---

# setScissorRects(_:)

Configures multiple rectangles for the fragment scissor test.

## Declaration

```swift
func setScissorRects(_ scissorRects: [MTLScissorRect])
```

## Parameters

- `scissorRects`: An array of doc://com.apple.metal/documentation/Metal/MTLScissorRect instances the command applies to the render pipeline for clipping.

## Mentioned in

Rendering to multiple viewports in a draw command

## Discussion

Discussion The rendering pipeline discards any fragments that lie outside the scissor rectangle. The default scissor rectangle is the same size as the current render attachment, with its origin coordinates in the upper-left corner at (0, 0). Use this method to configure a different scissor rectangle for multiple viewports you configure with the setViewports(_:) method. Multiple viewports give your app the ability to draw into separate areas of an image with a single draw call. You can either set a single scissor rectangle for all viewports with the setScissorRect(_:) method, or set each viewport’s rectangle with this method. important: The number of scissor rectangles you pass to this method needs to match the number of viewports you configure with the setViewports(_:) method. The maximum number of viewports and scissor rectangles a GPU supports varies by device family. For more information, see MTLGPUFamily and Detecting GPU features and Metal software versions. The rendering pipeline sends each primitive to a single viewport and its associated scissor rectangle. You can select which viewport each primitive uses in your vertex shader by adding the [[viewport_array_index]] attribute to an output value. note: You can change the render pass’s scissor rectangle configuration by calling this method again or by calling the setScissorRect(_:) method. The setScissorRect(_:) method is equivalent to calling this method with a single element in the scissorRects array.

## See Also

### Configuring viewport and scissor behavior

- [setViewport(_:)](metal/mtlrendercommandencoder/setviewport(_:).md)
- [setViewports(_:)](metal/mtlrendercommandencoder/setviewports(_:).md)
- [setScissorRect(_:)](metal/mtlrendercommandencoder/setscissorrect(_:).md)
