Contents

MTLTexture

A resource that holds formatted image data.

Declaration

protocol MTLTexture : MTLResource

Mentioned in

Overview

Don’t implement this protocol yourself; instead, use one of the following methods to create an MTLTexture instance:

After you create an MTLTexture instance, most of its characteristics, such as its size, type, and pixel format are all immutable. Only the texture’s pixel data is mutable.

To copy pixel data from system memory into the texture, call replace(region:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage:) or replace(region:mipmapLevel:withBytes:bytesPerRow:).

To copy pixel data back to system memory, call getBytes(_:bytesPerRow:bytesPerImage:from:mipmapLevel:slice:) or getBytes(_:bytesPerRow:from:mipmapLevel:).

Topics

Copying data into a texture image

Copying data from a texture image

Creating textures by reinterpreting existing texture data

Querying texture attributes

Getting information about the IOSurface the texture was created from

Getting information about ancestor resources

Creating a shared texture handle

Creating views of textures on other GPUs

Querying sparse properties

Instance Properties

Instance Methods

See Also

Texture basics