Instance Method

encode(to:sourceTexture:histogram:histogramOffset:)

Encodes the filter to a command buffer using a compute command encoder.

Declaration

func encode(to commandBuffer: MTLCommandBuffer, sourceTexture source: MTLTexture, histogram: MTLBuffer, histogramOffset: Int)

Parameters

commandBuffer

A valid command buffer.

source

A valid texture containing the source image for the filter.

histogram

A valid buffer to receive the histogram results.

histogramOffset

The byte offset into the histogram buffer at which to write the histogram results. Must be a multiple of 32 bytes. The histogram results per channel are stored together. The number of channels for which histogram results are stored is determined by the number of channels in the image. If the histogramForAlpha value of the histogramInfo property is false and the source image is RGBA, then only histogram results for RGB channels are stored.

Discussion

The filter will not begin to execute until after the command buffer has been enqueued and committed.

See Also

Methods

struct MPSImageHistogramInfo

The information used to compute the histogram channels of an image.

func histogramSize(forSourceFormat: MTLPixelFormat) -> Int

The amount of space the histogram will take up in the output buffer.