Metal Shading Language Guide

Introduction

Important: This is a preliminary document for an API or technology in development. Apple is supplying this information to help you plan for the adoption of the technologies and programming interfaces described herein for use on Apple-branded products. This information is subject to change, and software implemented according to this document should be tested with final operating system software and final documentation. Newer versions of this document may be provided with future betas of the API or technology.

The Metal shading language is a unified programming language for writing both graphics and compute functions that are used by apps written with the Metal framework.

The Metal shading language is designed to work together with the Metal framework, which manages the execution, and optionally the compilation, of the Metal shading language code. The Metal shading language uses clang and LLVM so developers get a compiler that delivers close to the metal performance for code executing on the GPU.

At a Glance

This document describes the Metal unified graphics and compute shading language. The Metal shading language is a C++ based programming language that developers can use to write code that is executed on the GPU for graphics and general-purpose data-parallel computations. Since the Metal shading language is based on C++, developers will find it familiar and easy to use. With the Metal shading language, both graphics and compute programs can be written with a single, unified language, which allows tighter integration between the two.

How to Use This Document

Developers who are writing code with the Metal framework will want to read this document, because they will need to use the Metal shading language to write graphics and compute programs to be executed on the GPU. This document is organized into the following chapters:

Metal and C++11 covers the similarities and differences between the Metal shading language and C++11.