<!--
{
  "documentType" : "article",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/textures",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Textures"
}
-->

# Textures

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

## Discussion

[`MTLTexture`](/documentation/Metal/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

[Understanding color-renderable pixel format sizes](/documentation/Metal/understanding-color-renderable-pixel-format-sizes)

Know the size limits of color render targets in Apple GPUs based on the target’s pixel format.

[Optimizing texture data](/documentation/Metal/optimizing-texture-data)

Optimize a texture’s data to improve GPU or CPU access.

[`protocol MTLTexture`](/documentation/Metal/MTLTexture)

A resource that holds formatted image data.

[`enum MTLTextureCompressionType`](/documentation/Metal/MTLTextureCompressionType)

[`class MTLTextureDescriptor`](/documentation/Metal/MTLTextureDescriptor)

An instance that you use to configure new Metal texture instances.

  <doc://com.apple.documentation/documentation/MetalKit/MTKTextureLoader>

[`class MTLSharedTextureHandle`](/documentation/Metal/MTLSharedTextureHandle)

A texture handle that can be shared across process address space boundaries.

[`enum MTLPixelFormat`](/documentation/Metal/MTLPixelFormat)

The data formats that describe the organization and characteristics of individual pixels in a texture.

### Texture samplers

[Creating and sampling textures](/documentation/Metal/creating-and-sampling-textures)

Load image data into a texture and apply it to a quadrangle.

[`protocol MTLSamplerState`](/documentation/Metal/MTLSamplerState)

An instance that defines how a texture should be sampled.

[`class MTLSamplerDescriptor`](/documentation/Metal/MTLSamplerDescriptor)

An object that you use to configure a texture sampler.

[`struct MTLSamplePosition`](/documentation/Metal/MTLSamplePosition)

A subpixel sample position for use in multisample antialiasing (MSAA).

[`enum MTLSamplerReductionMode`](/documentation/Metal/MTLSamplerReductionMode)

Configures how the sampler aggregates contributing samples to a final value.

### Texture mipmapping

[Improving texture sampling quality and performance with mipmaps](/documentation/Metal/improving-texture-sampling-quality-and-performance-with-mipmaps)

Avoid texture-rendering artifacts and reduce the GPU’s workload by creating smaller versions of a texture.

[Creating a mipmapped texture](/documentation/Metal/creating-a-mipmapped-texture)

Decide whether a texture that you’re creating needs mipmaps.

[Copying data into or out of mipmaps](/documentation/Metal/copying-data-into-or-out-of-mipmaps)

Specify which mipmaps that the data transfer affects.

[Generating mipmap data](/documentation/Metal/generating-mipmap-data)

Create your mipmaps either when you author content or at runtime.

[Adding mipmap filtering to samplers](/documentation/Metal/adding-mipmap-filtering-to-samplers)

Specify how the GPU samples mipmaps in your textures.

[Restricting access to specific mipmaps](/documentation/Metal/restricting-access-to-specific-mipmaps)

Set the range of mipmap levels that a sampler can access.

[Predicting which mips the GPU samples with level-of-detail queries](/documentation/Metal/predicting-which-mips-the-gpu-samples-with-level-of-detail-queries)

Determine in advance which mipmap levels the GPU requires to sample a texture.

[Dynamically adjusting texture level of detail](/documentation/Metal/dynamically-adjusting-texture-level-of-detail)

Defer generating or loading larger mipmaps until that level of detail is needed.

### Sparse textures

[Managing sparse texture memory](/documentation/Metal/managing-sparse-texture-memory)

Take direct control of memory allocation for texture data by using sparse textures.

[Creating sparse heaps and sparse textures](/documentation/Metal/creating-sparse-heaps-and-sparse-textures)

Allocate memory for sparse textures by creating a sparse heap.

[Converting between pixel regions and sparse tile regions](/documentation/Metal/converting-between-pixel-regions-and-sparse-tile-regions)

Learn how a sparse texture’s contents are organized in memory.

[Assigning memory to sparse textures](/documentation/Metal/assigning-memory-to-sparse-textures)

Use a resource state encoder to allocate and deallocate sparse tiles for a sparse texture.

[Reading and writing to sparse textures](/documentation/Metal/reading-and-writing-to-sparse-textures)

Decide how to handle access to unmapped texture regions.

[Estimating how often a texture region is accessed](/documentation/Metal/estimating-how-often-a-texture-region-is-accessed)

Use texture access patterns to determine when you need to map a texture region.

[`class MTLResourceStatePassDescriptor`](/documentation/Metal/MTLResourceStatePassDescriptor)

A configuration for a resource state pass, used to create a resource state command encoder.

[`class MTLResourceStatePassSampleBufferAttachmentDescriptor`](/documentation/Metal/MTLResourceStatePassSampleBufferAttachmentDescriptor)

A description of where to store GPU counter information at the start and end of a resource state pass.

[`class MTLResourceStatePassSampleBufferAttachmentDescriptorArray`](/documentation/Metal/MTLResourceStatePassSampleBufferAttachmentDescriptorArray)

An array of sample buffer attachments for a resource state pass.

[`protocol MTLResourceStateCommandEncoder`](/documentation/Metal/MTLResourceStateCommandEncoder)

An encoder that encodes commands that modify resource configurations.

[`struct MTLMapIndirectArguments`](/documentation/Metal/MTLMapIndirectArguments)

The data layout for mapping sparse texture regions when using indirect commands.

### Texture loading

  <doc://com.apple.documentation/documentation/MetalKit/MTKTextureLoader>

  <doc://com.apple.documentation/documentation/MetalKit/MTKTextureLoader/Error>

  <doc://com.apple.documentation/documentation/MetalKit/MTKTextureLoader/Option>

  <doc://com.apple.documentation/documentation/MetalKit/MTKTextureLoader/Callback>

  <doc://com.apple.documentation/documentation/MetalKit/MTKTextureLoader/ArrayCallback>



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)