Instance Property

visibilityResultBuffer

A buffer where the GPU writes visibility test results when fragments pass depth and stencil tests.

Declaration

@property(nonatomic, strong) id<MTLBuffer> visibilityResultBuffer;

Discussion

When encoding a render pass, you can tell the GPU to record data about fragments that pass depth and stencil tests. Typically, you use visibility testing to track whether a particular piece of geometry is visible in the current frame, so you can omit drawing calls for hidden objects when encoding future frames. This technique is sometimes called occlusion culling. You can record separate tests for different pieces of geometry.

Set this property to provide the buffer for the GPU to store visibility results when it executes the render pass. Visibility results are stored as 64-bit integers, so you need to reserve 8 bytes for each visibility result you want to track. After creating the render command encoder, call setVisibilityResultMode:offset: to start each visibility test.

See Also