Contents

MTLVertexFormat

The vertex data format options for render pipelines.

Declaration

enum MTLVertexFormat

Overview

Set the format property of MTLVertexAttributeDescriptor to one of these format values. The format configures how Metal interprets the vertex data in memory for the corresponding argument in your vertex shader. Choose a format that matches the type and component count the shader expects.

Normalized integer formats

Normalized signed integer formats have Normalized in the name and signed types like MTLVertexFormat.char or MTLVertexFormat.short. For these formats, values in the range [-1.0, 1.0] map to [MIN_INT, MAX_INT], where MIN_INT is the most negative integer and MAX_INT is the most positive integer for the number of bits in the storage size. Positive values and zero distribute uniformly in the range [0.0, 1.0], and negative integer values greater than (MIN_INT + 1) distribute uniformly in the range (-1.0, 0.0).

Normalized unsigned integer formats have Normalized in the name and unsigned types like MTLVertexFormat.uchar or MTLVertexFormat.ushort. For these formats, values in the range [0.0, 1.0] map to [0, MAX_UINT], where MAX_UINT is the largest unsigned integer for the number of bits in the storage size.

Metal stores data in little-endian byte order, with the least-significant byte at the lowest memory address. Formats with multibyte components also store each component in little-endian byte order.

Topics

32-bit floating-point formats

32-bit integer formats

32-bit normalized integer formats

16-bit floating-point formats

16-bit integer formats

16-bit normalized integer formats

8-bit integer formats

8-bit normalized integer formats

Sentinel values

Swift support

See Also

Organizing the vertex attribute