iOS Guides | Samples

Metal Namespace

The Metal namespace provides GPU-accelerated 3D rendering and data-parallel computation.


The Metal framework, introduced in iOS 8, provides low-level control of Graphical Processing Unit (GPU) accelerated rendering and data-parallel computation (GPGPU).

The Metal framework provides low-level access to the A7 GPU. Metal provides precompiled shaders, state objects, and explicit command scheduling. Its facilities can be used for either 3D rendering or General-Purpose GPU computation.


IMTLBlitCommandEncoderProtocol for writing data into frame buffers.
IMTLBufferSystem protocol for raw data that is accessible in strides.
IMTLCommandBufferProtocol for commands that are run on a GPU
IMTLCommandEncoderSystem protocol for enqueuing and writing commands into a buffer.
IMTLCommandQueueSystem protocol for objects that can queue command buffers for running on a GPU.
IMTLComputeCommandEncoderProtocol for encoding and running parallel commands on a GPU.
IMTLComputePipelineStateSystem protocol that represents a compiled compute program.
IMTLDepthStencilStateSystem protocol for describing how the depth stencil should interact with the depth buffer during rendering.
IMTLDeviceSystem protocol for interacting with a single graphics device.
IMTLDrawableInterface representing the required methods (if any) of the protocol MTLDrawable.
IMTLFunctionSystem protocol for shader functions that are suitable for use on a GPU in a shader or compute function.
IMTLLibrarySystem protocol for libraries of shaders.
IMTLParallelRenderCommandEncoderSystem protocol for breaking a single rendering pass into parallel command sets.
IMTLRenderCommandEncoderSystem protocol for encoding render commands and state into a buffer.
IMTLRenderPipelineStateSystem protocol for encoding the state of a rendering pipeline.
IMTLResourceSystem protocol for for allocated segments of GPU memory.
IMTLSamplerStateSystem protocol the way that shaders or compute kernels will sample textures.
IMTLTextureSystem protocol for image data that is used by vertex shaders, fragment shaders, and compute kernels.
MTLArgumentEncapsulates a single parameter to a Metal function.
MTLArgumentAccessFunction access restrictions of argument data in the shader code.
MTLArgumentTypeThe resource type of an argument of a function.
MTLArrayTypeEncapsulates the details of an array argument to a Metal function.
MTLBlendFactorArgument values for use with MTLBlendOperation.
MTLBlendOperationHow the source and destination values are combined.
MTLBlitCommandEncoder_ExtensionsExtension methods to the IMTLBlitCommandEncoder interface to support all the methods from the MTLBlitCommandEncoder protocol.
MTLBlitOptionEnumerates blitting options.
MTLBuffer_ExtensionsExtension methods to the IMTLBuffer interface to support all the methods from the MTLBuffer protocol.
MTLClearColorAn RGBA color representing a clear pixel.
MTLClearValueStruct that contains values that are used to clear various buffers and stencils.
MTLColorWriteMaskPermits or restricts writing to specific color channels.
MTLCommandBufferErrorEnumeration of error codes describing why a command buffer has failed.
MTLCommandBufferErrorExtensionsExtension methods for the Metal.MTLCommandBufferError enumeration.
MTLCommandBufferStatusThe state of the command-buffer state-machine. Enqueued->Committed->Scheduled->Completed.
MTLCompareFunctionHolds a comparison test. When the comparison test passes, the incoming fragment is compared to the stored data at the specified location.
MTLCompileOptionsConfigures the compilation of a Metal shader library.
MTLComputeCommandEncoder_ExtensionsExtension methods to the IMTLComputeCommandEncoder interface to support all the methods from the MTLComputeCommandEncoder protocol.
MTLComputePipelineDescriptorDescribes the compute state used during a compute operation pass. (See also MTLComputePipelineState.)
MTLComputePipelineReflectionEncapsulates the details of the arguments of the compute function used to create an MTLComputePipelineState object.
MTLCpuCacheModeEnumerates what cache mode is used for CPU mapping of a resource.
MTLCullModeEnumerates modes for culling and which types of primitives are culled.
MTLDataTypeThe data type of a function argument, as used in the shader language code.
MTLDeallocatorCompletion handler for deallocating a buffer.
MTLDepthClipModeEnumerates values that indicate whether to clip or clamp depth values.
MTLDepthStencilDescriptorConfigures a depth stencil test operation.
MTLDeviceRepresents a single GPU.
MTLDevice_ExtensionsExtension methods to the IMTLDevice interface to support all the methods from the MTLDevice protocol.
MTLDispatchThreadgroupsIndirectArgumentsRepresents the number of threadgroups in each grid dimension for indirectly dispatched threadgroups.
MTLDrawableInterface definition for objects that can receive rendering commands.
MTLDrawIndexedPrimitivesIndirectArgumentsRepresents the data layout needed to draw indexed primitives.
MTLDrawPrimitivesIndirectArgumentsRepresents the data layout needed to draw primitives.
MTLFeatureSetEnumerates the hardware feature sets that are available on a device.
MTLFunction_ExtensionsExtension methods to the IMTLFunction interface to support all the methods from the MTLFunction protocol.
MTLFunctionTypeThe type of a Metal function.
MTLIndexTypeThe index type for an index buffer.
MTLLanguageVersionEnumerates Metal shader programming language versions.
MTLLibrary_ExtensionsExtension methods to the IMTLLibrary interface to support all the methods from the MTLLibrary protocol.
MTLLibraryErrorEnumerates errors possible in the creation of an MTLLibrary or MTLFunction object.
MTLLibraryErrorExtensionsExtension methods for the Metal.MTLLibraryError enumeration.
MTLLoadActionAn action performed at the start of a rendering pass.
MTLMultisampleDepthResolveFilterEnumerates MSAA dept resolve filter operations.
MTLOriginThe location of a pixel in an image or texture.
MTLParallelRenderCommandEncoder_ExtensionsExtension methods to the IMTLParallelRenderCommandEncoder interface to support all the methods from the MTLParallelRenderCommandEncoder protocol.
MTLPipelineOptionOptions relating to argument information in the creation of a pipeline.
MTLPixelFormatThe format used by pixels, including color, depth, compression technigue, and data type for components.
MTLPrimitiveTypeEnumerates the primitive geometry used for drawing commands.
MTLPurgeableStateThe purgeable state of the resource.
MTLRegionA rectangle of pixels in an image or texture.
MTLRenderCommandEncoder_ExtensionsExtension methods to the IMTLRenderCommandEncoder interface to support all the methods from the MTLRenderCommandEncoder protocol.
MTLRenderPassAttachmentDescriptorConfigures a render target of a framebuffer.
MTLRenderPassColorAttachmentDescriptorA MTLRenderPassAttachmentDescriptor that holds the clear color for the rendering pass.
MTLRenderPassColorAttachmentDescriptorArrayHolds an array of MTLRenderPassColorAttachmentDescriptor objects.
MTLRenderPassDepthAttachmentDescriptorA MTLRenderPassAttachmentDescriptor that holds the clear depth for a rendering pass.
MTLRenderPassDescriptorDefines the rendering target for pixels generated by a rendering pass.
MTLRenderPassStencilAttachmentDescriptorA MTLRenderPassAttachmentDescriptor that holds the clear stencil for a rendering pass.
MTLRenderPipelineColorAttachmentDescriptorConfigures a color attachment associated with a rendering pipeline.
MTLRenderPipelineColorAttachmentDescriptorArrayAn array of MTLRenderPipelineColorAttachmentDescriptor objects.
MTLRenderPipelineDescriptorConfigures a rendering pipeline with rasterization properties, visibility, blending, and shader functions.
MTLRenderPipelineErrorEnumerates errors possible in the creation of a MTLRenderPipelineState.
MTLRenderPipelineErrorExtensionsExtension methods for the Metal.MTLRenderPipelineError enumeration.
MTLRenderPipelineReflectionThe arguments (see MTLArgument) of a vertex or fragment function within a MTLRenderPipelineState.
MTLResource_ExtensionsExtension methods to the IMTLResource interface to support all the methods from the MTLResource protocol.
MTLResourceOptionsHolds options used by buffer and texture objects.
MTLSamplerAddressModeThe wrapping mode. Used when a fetch falls outside the bounds of a texture.
MTLSamplerDescriptorConfigures a sampler (see MTLSamplerState).
MTLSamplerMinMagFilterOptions for calculating the pixel value returned within a mipmap level.
MTLSamplerMipFilterOptions for calculating the pixel value returned with multiple mipmap levels.
MTLScissorRectThe retangle used for the scissor fragment test.
MTLSizeThe dimensions of a grid, image, texture, or threadgroup.
MTLStencilDescriptorConfigures a stencil test operation.
MTLStencilOperationWhat to do if a stencil value passes or fails a comparison test.
MTLStorageModeEnumerates CPU cache modes for resource mapping.
MTLStoreActionThe action to be performed at the end of a rendering pass.
MTLStructMemberDescribes a single field within a MTLStructType struct.
MTLStructTypeDefines a type representing a struct, which can be passed as an argument to Metal functions.
MTLTexture_ExtensionsExtension methods to the IMTLTexture interface to support all the methods from the MTLTexture protocol.
MTLTextureDescriptorConfiguration for MTLTexture objects.
MTLTextureTypeThe dimensionality of each texture and how multiple images are arranged.
MTLTextureUsageEnumerates the ways in which a MTLTexture may be used.
MTLTriangleFillModeHow to rasterize triangle and triangle-strip primitives.
MTLVertexAttributeAn attribute for per-vertex input to a vertex shader function.
MTLVertexAttributeDescriptorAn attribute for per-vertex input for a vertex shader function.
MTLVertexAttributeDescriptorArrayHolds an array of MTLVertexAttributeDescriptor objects.
MTLVertexBufferLayoutDescriptorConfigures how vertex and attribute data are fetched by a vertex shader function.
MTLVertexBufferLayoutDescriptorArrayHolds an array of MTLVertexBufferLayoutDescriptor objects.
MTLVertexDescriptorMaps vertex data in memory to attributes in a vertex shader.
MTLVertexFormatEnumerates vertex data formats (type and number).
MTLVertexFormatExtensionsExtensions methods for MTLVertexFormat.
MTLVertexStepFunctionThe frequency at which the vertex shader function should fetch attribute data.
MTLViewportDefines the clipping viewport.
MTLVisibilityResultModeEnumerates values that control how and whether to monitor samples that pass depth and stencil tests.
MTLWindingVertex winding rule for front-facing primitives.