Initializes an image from a texture. The user-allocated texture has been created for a specific number of feature channels and number of images.
- iOS 10.0+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 10.0+
- Metal Performance Shaders
The texture allocated by the user to be used as a backing storage for the image.
The number of feature channels the texture contains.
MPSImage object or
nil, if failure.
In a memory-intensive app, you can save memory (and allocation/deallocation time) by using an
MPSTemporary object, where the framework aggressively reuses underlying texture memory within the same command buffer. However, in certain cases, you may want more control on the allocation, placement, reuse, and recycling of memory-backing textures used in your app by using the Metal Resource Heaps API. In this case, an app can create an
MPSImage object from a pre-allocated texture by calling this method.
texture property of the given texture can be of type
MTLTexture only if
feature (meaning that
number). Otherwise, the texture type should be
MTLTexture with the
array property of the given texture being equal to
For textures containing typical image data, the
feature parameter should be set to the number of valid color channels (e.g. for RGB data, even though the pixel format is a form of
feature should be set to 3.).