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

# setScissorRects(_:)

Sets an array of scissor rectangles for a fragment scissor test.

## Declaration

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

## Parameters

- `scissorRects`: A Swift array of doc://com.apple.metal/documentation/Metal/MTLScissorRect elements.

## Discussion

Discussion Metal uses the specific scissor rectangle corresponding to the index you specify via the [[ viewport_array_index ]] output attribute of the vertex shader function in the Metal Shading Language, discarding all fragments outside of the scissor rect.

## See Also

### Configuring viewport and scissor behavior

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