Instance Method

histogramSize(forSourceFormat:)

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

Declaration

func histogramSize(forSourceFormat sourceFormat: MTLPixelFormat) -> Int

Parameters

sourceFormat

The pixel format of the source image, corresponding to the sourceTexture object of the encode(to:sourceTexture:histogram:histogramOffset:) method.

Return Value

The number of bytes needed to store the histogram results.

Discussion

This convenience function calculates the minimum amount of space needed in the output histogram for the results. The buffer should be at least this length and longer if the histogramOffset value in the encode(to:sourceTexture:histogram:histogramOffset:) method is non-zero.

See Also

Methods

struct MPSImageHistogramInfo

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

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

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