Instance Method

encodeToCommandBuffer:sourceTexture:histogram:histogramOffset:

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

Declaration

- (void)encodeToCommandBuffer:(id<MTLCommandBuffer>)commandBuffer sourceTexture:(id<MTLTexture>)source histogram:(id<MTLBuffer>)histogram histogramOffset:(NSUInteger)histogramOffset;

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 NO 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

- initWithDevice:histogramInfo:

Initializes a histogram with specific information.

MPSImageHistogramInfo

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

- histogramSizeForSourceFormat:

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