Sample Code

Forward Plus Lighting with Tile Shading

Implement a forward plus renderer with Metal’s latest features for Apple GPUs.

Download

Overview

Configure the Sample Code Project

To run the app:

  • Build the project with Xcode 11 or later.

  • Target an iOS device with an A11 chip or later and iOS 11 or later.

See Also

GPU Programming Techniques

Deferred Lighting

Demonstrates how to implement a deferred lighting renderer that takes advantage of unique Metal features.

Reflections with Layer Selection

Demonstrates how to use layer selection to reduce the number of render passes needed for a reflective object.

LOD with Function Specialization

Demonstrates how to use specialized functions to select a level of detail based on dynamic conditions.

Dynamic Terrain with Argument Buffers

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

Mixing Metal and OpenGL Rendering in a View

Draw with Metal and OpenGL in the same view using an interoperable texture.

Modern Rendering with Metal

Use advanced Metal features such as Indirect Command Buffers, Sparse Textures, and Variable Rate Rasterization to implement modern rendering algorithms.