A resource that holds formatted image data.
- iOS 8.0+
- macOS 10.11+
- tvOS 9.0+
Don’t implement this protocol yourself; instead, use one of the following methods to create a
makemethod of the
MTLDeviceprotocol creates a texture object with a new storage allocation for the texture image data, using a
MTLTextureobject to describe the texture’s properties. To further specify an
IOSurfacefrom which to create the texture, use the
Texture(descriptor: iosurface: plane:)
Texture View(pixel Format:)
makemethods of the
Texture View(pixel Format: texture Type: levels: slices:)
MTLTextureprotocol create and return a new texture object that shares the same storage allocation as the source texture object. Because they share the same storage, any changes to the pixels of the new texture are reflected in the source texture, and vice versa. For the newly created texture, these methods reinterpret the existing texture image data in the storage allocation of the source texture as if this data were stored in the new specified pixel format. The pixel format of the new texture must be compatible with the pixel format of the source texture.
makemethod of the
Texture(descriptor: offset: bytes Per Row:)
MTLBufferprotocol creates and returns a new texture object that shares the storage allocation of the source buffer object as its texture image data. Because they share the same storage, any changes to the pixels of the new texture are reflected in the source buffer, and vice versa.
texture property identifies how the image data is organized. Image data is arranged in one or more slices, and each slice is a single
MTLTexture texture type image and all its mipmaps.
MTLTexture texture types have a single slice. A
MTLTexture texture always has six slices, one for each face. For a texture array object, such as
MTLTexture, every array element is one slice.
After you create a texture, you can call
replace(region: to populate the storage allocation of the texture object with image data from system memory. Call
get to copy image data from a texture object and store the copied data into system memory.