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

# setVisibilityResultMode(_:offset:)

Configures a visibility test for Metal to run, and the destination for any results it generates.

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

## Parameters

`mode`

A [`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
[`visibilityResultBuffer`](/documentation/Metal/MTL4RenderPassDescriptor/visibilityResultBuffer) The GPU stores
the result of a visibility test at `offset`, which needs to be a multiple of `8`.

## Discussion

You use the `mode` parameter to enable or disable the visibility test, and determine if it produces a boolean
response for passing fragments, or if it counts the number of fragments.

---

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)