<!--
{
  "documentType" : "article",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/metalperformanceshaders-functions",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "MetalPerformanceShaders Functions"
}
-->

# MetalPerformanceShaders Functions

## Topics

### Functions

[`func MPSDataTypeBitsCount(MPSDataType) -> Int`](/documentation/MetalPerformanceShaders/MPSDataTypeBitsCount(_:))

[`func MPSFindIntegerDivisionParams(UInt16) -> MPSIntegerDivisionParams`](/documentation/MetalPerformanceShaders/MPSFindIntegerDivisionParams(_:))

Returns the integer division parameters for a specified divisor.

[`func MPSGetCustomKernelBatchedDestinationIndex(MPSCustomKernelArgumentCount) -> UInt`](/documentation/MetalPerformanceShaders/MPSGetCustomKernelBatchedDestinationIndex(_:))

Returns the index of the first destination texture argument.

[`func MPSGetCustomKernelBatchedSourceIndex(MPSCustomKernelArgumentCount, UInt, UInt) -> UInt`](/documentation/MetalPerformanceShaders/MPSGetCustomKernelBatchedSourceIndex(_:_:_:))

Returns the index of the specified batched source texture argument.

[`func MPSGetCustomKernelBroadcastSourceIndex(MPSCustomKernelArgumentCount, UInt, UInt) -> UInt`](/documentation/MetalPerformanceShaders/MPSGetCustomKernelBroadcastSourceIndex(_:_:_:))

Returns the index of the specified nonbatched source texture argument.

[`func MPSGetCustomKernelMaxBatchSize(MPSCustomKernelArgumentCount, UInt) -> UInt`](/documentation/MetalPerformanceShaders/MPSGetCustomKernelMaxBatchSize(_:_:))

Returns the maximum allowed batch size.

[`func MPSGetImageType(MPSImage) -> MPSImageType`](/documentation/MetalPerformanceShaders/MPSGetImageType(_:))

[`func MPSGetPreferredDevice(MPSDeviceOptions) -> (any MTLDevice)?`](/documentation/MetalPerformanceShaders/MPSGetPreferredDevice(_:))

[`func MPSHintTemporaryMemoryHighWaterMark(any MTLCommandBuffer, Int)`](/documentation/MetalPerformanceShaders/MPSHintTemporaryMemoryHighWaterMark(_:_:))

Triggers Metal Performance Shaders to prefetch a Metal heap of the indicated size into its internal cache.

[`func MPSImageBatchIncrementReadCount([MPSImage], Int) -> Int`](/documentation/MetalPerformanceShaders/MPSImageBatchIncrementReadCount(_:_:))

Increments or decrements the read count of an image batch by a specified amount.

[`func MPSImageBatchIterate([MPSImage], (MPSImage, Int) -> Int) -> Int`](/documentation/MetalPerformanceShaders/MPSImageBatchIterate(_:_:))

Executes a callback block once for each unique image in a batch.

[`func MPSImageBatchResourceSize([MPSImage]) -> Int`](/documentation/MetalPerformanceShaders/MPSImageBatchResourceSize(_:))

Returns the number of bytes used to allocate the specified image batch.

[`func MPSImageBatchSynchronize([MPSImage], any MTLCommandBuffer)`](/documentation/MetalPerformanceShaders/MPSImageBatchSynchronize(_:_:))

Removes any copy of the specified image batch from the device’s caches, and, if needed, invalidates any CPU caches.

[`func MPSSetHeapCacheDuration(any MTLCommandBuffer, Double)`](/documentation/MetalPerformanceShaders/MPSSetHeapCacheDuration(_:_:))

Sets the timeout after which unused cached Metal heaps are released.

[`func MPSSizeofMPSDataType(MPSDataType) -> Int`](/documentation/MetalPerformanceShaders/MPSSizeofMPSDataType(_:))

[`func MPSStateBatchIncrementReadCount([MPSState]?, Int) -> Int`](/documentation/MetalPerformanceShaders/MPSStateBatchIncrementReadCount(_:_:))

Increments or decrements the read count of a state batch by a specified amount.

[`func MPSStateBatchResourceSize([MPSState]?) -> Int`](/documentation/MetalPerformanceShaders/MPSStateBatchResourceSize(_:))

Returns the number of bytes used to allocate the specified state batch.

[`func MPSStateBatchSynchronize([MPSState], any MTLCommandBuffer)`](/documentation/MetalPerformanceShaders/MPSStateBatchSynchronize(_:_:))

Removes any copy of the specified state batch from the device’s caches, and, if needed, invalidates any CPU caches.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)