Contents

setVisibilityResultMode(_:offset:)

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

Declaration

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

Parameters

  • mode:

    An 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. 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 instance to the visibilityResultBuffer property of an 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.

The default mode for a render pass is MTLVisibilityResultMode.disabled.