Framework

MetalKit

Build Metal apps quicker and easier, using far less code. Load textures from many sources, render graphics in a standard Metal view, and work efficiently with models provided by Model I/O.

Overview

The MetalKit framework provides functions and classes that reduce the effort required to create a Metal application.

MetalKit Features

MetalKit provides functionality in three key areas:

  • Texture loading allows your application to easily load textures from a variety of sources. Textures can even be loaded asynchronously with just a few lines of code. For more information, see MTKTextureLoader.

  • Model handling provides Metal-specific functionality to easily interface with Model I/O assets. This collection of highly optimized functions and objects allows for efficient data transfer between Model I/O meshes and Metal buffers.

  • View management provides a standard implementation of a Metal view, with an optional drawing delegate, that drastically reduces the amount of code needed to create a graphics-rendering app. For more information, see MTKView and MTKViewDelegate.

Symbols

Classes

MTKMesh

The MTKMesh class provides a container for the vertex data of a MetalKit mesh and its submeshes, suitable for rendering in a Metal application. For more information on the Model I/O objects used to generate MetalKit mesh data, see MDLMesh and MDLAsset.

MTKMeshBuffer

The MTKMeshBuffer class provides a Metal buffer to back vertex and index data for Model I/O meshes and submeshes.

MTKMeshBufferAllocator

The MTKMeshBufferAllocator class provides an allocator object conforming to the MDLMeshBufferAllocator protocol. Model I/O’s MDLAsset class can use a MTKMeshBufferAllocator object to allocate MTKMeshBuffer objects to back vertex and index data within Metal buffers. For more information on model assets, see MDLAsset.

MTKSubmesh

The MTKSubmesh class provides a container for a segment of mesh data that can be rendered in a single draw call.

MTKTextureLoader

The MTKTextureLoader class simplifies the effort required to load your texture data into a Metal application. This class can load images from common file formats such as PNG, JPEG, and TIFF. Images can also be loaded from KTX and PVR files, along with additional loading options. Images are always loaded as type2D types and their pixel format is intrinsically inferred from their data.

MTKView

The MTKView class simplifies the effort required to create a Metal drawing application by providing a default implementation of a Metal-aware view. A MTKView object provides a convenient way to manage a MTLRenderPassDescriptor object and its associated render target attachments on your application’s behalf. You simply draw into the view when its contents need to be updated.

Protocols

MTKViewDelegate

An object that implements the MTKViewDelegate protocol can be set as a MTKView object’s delegate. A delegate allows your Metal application to provide a drawing method to a MTKView object and respond to rendering events without subclassing the MTKView class.

See Also

Related Symbols

Metal

Render advanced 3D graphics and perform data-parallel computations. Get fine-grained access to the GPU while minimizing CPU overhead.

Related Documentation