Metal
Render advanced 3D graphics and compute data in parallel with graphics processors.
Overview
The Metal framework gives your app direct access to a device’s graphics processing unit (GPU). With Metal, apps can leverage a GPU to quickly render complex scenes and run computational tasks in parallel. For example, apps in these categories use Metal to maximize their performance:
Games that render sophisticated 2D or 3D environments
Video processing apps, like Final Cut Pro
Scientific research apps that analyze and process large datasets
Fully immersive visionOS apps
Metal works hand-in-hand with other frameworks that supplement its capability. For example, MetalFX upscales your renderings in less time than rendering them natively, and MetalKit simplifies the tasks that display your Metal content onscreen. The Metal Performance Shaders framework provides a large library of optimized compute and rendering shaders that take advantage of each GPU’s unique hardware. In visionOS, create fully immersive stereoscopic content with the help of the Compositor Services framework.
Many high-level Apple frameworks leverage the performance of Metal, including RealityKit, SpriteKit, and Core Image. These high-level frameworks implement the GPU programming details for you. However, you can typically get better performance by writing your own custom Metal and shader code. See the Metal Shading Language Specification for shader implementation details.
Topics
Essentials
Understanding the Metal 4 core APIDrawing a triangle with Metal 4Performing calculations on a GPUUsing Metal to draw a view’s contents
Samples
GPU devices
Command encoders
Render passesCompute passesMachine learning passesBlit passesIndirect command encodingRay tracing with acceleration structures
Resources
Shader compilation and libraries
Writing reusable GPU functions with generic pointersUsing the Metal 4 compilation APIShader librariesUsing function specialization to build pipeline variants
Presentation
Managing your game window for Metal in macOSManaging your Metal app window in iPadOSAdapting your game interface for smaller screensOnscreen presentationHDR content
Developer tools
Supporting Simulator in a Metal appCapturing Metal commands programmaticallyLogging shader debug messagesDeveloping Metal apps that run in SimulatorImproving your game’s graphics performance and settingsMetal debuggerMetal developer workflowsGPU counters and counter sample buffersMetal debugging types
Apple silicon
Porting your Metal code to Apple siliconTailor your apps for Apple GPUs and tile-based deferred rendering
Reference
Classes
MTLTensorAuxiliaryPlaneDescriptorMTLTensorAuxiliaryPlaneDescriptorMapMTLTensorAuxiliaryPlaneTypeMTLTensorBufferAttachments