---
title: "setVisibilityResultMode(_:offset:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtl4rendercommandencoder/setvisibilityresultmode(_:offset:)"
---

# setVisibilityResultMode(_:offset:)

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

## Declaration

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

## Parameters

- `mode`: A doc://com.apple.metal/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 doc://com.apple.metal/documentation/Metal/MTL4RenderPassDescriptor/visibilityResultBuffer The GPU stores the result of a visibility test at offset, which needs to be a multiple of 8.

## Discussion

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.
