A resource that holds formatted image data.
- iOS 8.0+
- macOS 10.11+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
Don’t implement this protocol yourself; instead, use one of the following methods to create a
To create a texture that uses an existing
IOSurfaceto hold the texture data, create an
MTLTextureobject to describe the image data in the surface and then call the
makemethod to create the texture.
Texture(descriptor: iosurface: plane:)
To create a texture that reinterprets another texture's data as if it had a different format, call the
Texture View(pixel Format:)
makemethod on a texture object. You must choose a pixel format for the new texture compatible with the source texture's pixel format. The new texture shares the same storage allocation as the source texture. If you make changes to the new texture, those changes are reflected in the source texture, and vice versa.
Texture View(pixel Format: texture Type: levels: slices:)
To create a texture that uses an
MTLBufferobject's contents to hold pixel data, create an
MTLTextureobject to describe the texture's properties and then call the
makemethod on the buffer object. The new texture object shares the storage allocation of the source buffer object. If you make changes to the texture, those changes are reflected in the buffer, and vice versa.
Texture(descriptor: offset: bytes Per Row:)
To copy pixel data from system memory into the texture, call
To copy pixel data back into system memory, call