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

# setScissorRects(_:)

Configures multiple rectangles for the fragment scissor test.

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

## Parameters

`scissorRects`

An array of [`MTLScissorRect`](/documentation/Metal/MTLScissorRect) instances the command applies to the render pipeline for clipping.

## 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(_:)`](/documentation/Metal/MTLRenderCommandEncoder/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(_:)`](/documentation/Metal/MTLRenderCommandEncoder/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 ``doc://com.apple.metal/documentation/Metal/MTLRenderCommandEncoder/setViewports(_:)`` method.

The maximum number of viewports and scissor rectangles a GPU supports varies by device family. For more information, see [`MTLGPUFamily`](/documentation/Metal/MTLGPUFamily) and [Detecting GPU features and Metal software versions](/documentation/Metal/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 ``doc://com.apple.metal/documentation/Metal/MTLRenderCommandEncoder/setScissorRect(_:)`` method.

The [`setScissorRect(_:)`](/documentation/Metal/MTLRenderCommandEncoder/setScissorRect(_:)) method is equivalent to calling this method with a single element in the `scissorRects` array.

---

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)