<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTL4RenderCommandEncoder/setScissorRects(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "s:So24MTL4RenderCommandEncoderP5MetalE15setScissorRectsyySaySo14MTLScissorRectaGF"
  },
  "title" : "setScissorRects(_:)"
}
-->

# setScissorRects(_:)

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

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

## Parameters

`scissorRects`

A Swift array of [`MTLScissorRect`](/documentation/Metal/MTLScissorRect) elements.

## 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)