<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderCommandEncoder/setVisibilityResultMode(_:offset:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLRenderCommandEncoder(im)setVisibilityResultMode:offset:"
  },
  "title" : "setVisibilityResultMode(_:offset:)"
}
-->

# setVisibilityResultMode(_:offset:)

Configures which visibility test the GPU runs and the destination for any results it generates.

```
func setVisibilityResultMode(_ mode: MTLVisibilityResultMode, offset: Int)
```

## Parameters

`mode`

An [`MTLVisibilityResultMode`](/documentation/Metal/MTLVisibilityResultMode) that configures which visibility test results the render pass saves to a buffer, or disables visibility testing.

`offset`

A location, in bytes, relative to the start of the render pass’s [`visibilityResultBuffer`](/documentation/Metal/MTLRenderPassDescriptor/visibilityResultBuffer). The GPU stores the result of a visibility test at `offset`, which needs to be a multiple of 8.

## Discussion

To create a render pass that can enable visibility testing, assign an [`MTLBuffer`](/documentation/Metal/MTLBuffer) instance to the [`visibilityResultBuffer`](/documentation/Metal/MTLRenderPassDescriptor/visibilityResultBuffer) property of an [`MTLRenderPassDescriptor`](/documentation/Metal/MTLRenderPassDescriptor).

You can monitor one or more drawing commands with a visibility test by calling this method before the drawing commands. The encoder uses the new visibility mode and offset for subsequent drawing commands until you change the configuration by calling the method again. For example, you can change the offset or entirely disable visibility tests for subsequent commands by passing [`MTLVisibilityResultMode.disabled`](/documentation/Metal/MTLVisibilityResultMode/disabled).

> Note:
> You can set a specific `offset` value only once per render pass. This means you need to encode all drawing commands for an offset at one time.

The default mode for a render pass is [`MTLVisibilityResultMode.disabled`](/documentation/Metal/MTLVisibilityResultMode/disabled).

---

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)