Contents

Textures

Create and manage typed data your app uses to exchange information with its shader functions.

Overview

MTLTexture instances can serve as input and output resources to shader functions, as well as render pass destinations, or render attachments. Unlike buffers, textures define the underlying pixel type and structure. Textures can:

  • Store 1-, 2-, or 3-dimensional data

  • Contain several faces or layers

  • Work as an array of texture data

Apps typically use textures to render details onto the surfaces in a scene or a 3D model. You can also use textures for post-processing pipelines, such as adding an advanced visual effect to an image before presenting it to a display.

Although textures can consume large amounts of memory, they also offer strategies, such as texture compression, that can save storage and memory bandwidth. Apple silicon GPUs support memoryless textures for transient render attachments that only need to exist for the duration of a render pass.

Topics

Texture basics

Texture samplers

Texture mipmapping

Sparse textures

Texture loading

See Also

Resources