Resource Objects

Data structures you use to manage your app's computational or graphical data.

Topics

First Steps

Setting Resource Storage Modes

Set a storage mode that defines the memory location and access permissions of a resource.

protocol MTLResource

A memory allocation for storing specialized data that is accessible to the GPU.

Buffers

Basic Buffers

Demonstrates how to manage hundreds of vertices with a vertex buffer.

protocol MTLBuffer

A memory allocation for storing unformatted data that is accessible to the GPU.

class MTLPipelineBufferDescriptor

An object that contains the mutability options for buffers used in a render or compute pass.

Textures

Basic Texturing

Demonstrates how to load image data and texture a quad.

About Color-Renderable Pixel Format Sizes

Know the size limits of pixel formats used by color render targets in iOS and tvOS GPUs.

protocol MTLTexture

A memory allocation for storing formatted image data that is accessible to the GPU.

class MTLTextureDescriptor

An object that configures new MTLTexture objects.

class MTKTextureLoader

An object that decodes common image formats into Metal textures for use in your app.

class MTLSharedTextureHandle

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

enum MTLPixelFormat

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

Samplers

protocol MTLSamplerState

An object that defines the sampling behavior for a texture within a graphics or compute function.

class MTLSamplerDescriptor

An object that configures new MTLSamplerState objects.

Resource Heaps

Image Filter Graph with Heaps and Fences

Demonstrates how to use heaps and fences to optimize a multistage image filter.

protocol MTLHeap

An abstract memory pool from which you can create resources.

class MTLHeapDescriptor

An object that configures new MTLHeap objects.

protocol MTLFence

An object that can capture, track, and manage resource dependencies across command encoders.

struct MTLSizeAndAlign

The size and alignment of a resource, in bytes, typically used when creating a heap.

Argument Buffers

About Argument Buffers

Improve your app's performance by grouping your resources into an argument buffer.

Basic Argument Buffers

Demonstrates how to manage groups of resources with an argument buffer.

Argument Buffers with Arrays and Resource Heaps

Demonstrates how to define an argument buffer with arrays and reduce CPU overhead by combining argument buffers with resource heaps.

Argument Buffers with GPU Encoding

Demonstrates how to encode an argument buffer with a compute pass and then access its arguments in a subsequent render pass.

Dynamic Terrain with Argument Buffers

Demonstrates how to use argument buffers to render a dynamic terrain in real time with a GPU-driven pipeline.

Indexing Argument Buffers

Assign resource indices within an argument buffer.

Tracking the Resource Residency of Argument Buffers

Optimize resource performance within an argument buffer.

protocol MTLArgumentEncoder

An encoder that specifies resources for an argument buffer.

class MTLArgumentDescriptor

A representation of an argument within an argument buffer.

See Also

Resource Management

protocol MTLBlitCommandEncoder

An encoder that moves resources between the CPU and GPU.

Resource Dimensions

Define the origin, size, or rectangular region of your app's resources.