MTLVertexFormat
The vertex data format options for render pipelines.
Declaration
enum MTLVertexFormatOverview
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
MTLVertexFormat.floatMTLVertexFormat.float2MTLVertexFormat.float3MTLVertexFormat.float4MTLVertexFormat.floatRG11B10MTLVertexFormat.floatRGB9E5
32-bit integer formats
MTLVertexFormat.intMTLVertexFormat.int2MTLVertexFormat.int3MTLVertexFormat.int4MTLVertexFormat.uintMTLVertexFormat.uint2MTLVertexFormat.uint3MTLVertexFormat.uint4
32-bit normalized integer formats
MTLVertexFormat.int1010102NormalizedMTLVertexFormat.uint1010102NormalizedMTLVertexFormat.uchar4Normalized_bgra
16-bit floating-point formats
16-bit integer formats
MTLVertexFormat.shortMTLVertexFormat.short2MTLVertexFormat.short3MTLVertexFormat.short4MTLVertexFormat.ushortMTLVertexFormat.ushort2MTLVertexFormat.ushort3MTLVertexFormat.ushort4
16-bit normalized integer formats
MTLVertexFormat.shortNormalizedMTLVertexFormat.short2NormalizedMTLVertexFormat.short3NormalizedMTLVertexFormat.short4NormalizedMTLVertexFormat.ushortNormalizedMTLVertexFormat.ushort2NormalizedMTLVertexFormat.ushort3NormalizedMTLVertexFormat.ushort4Normalized
8-bit integer formats
MTLVertexFormat.charMTLVertexFormat.char2MTLVertexFormat.char3MTLVertexFormat.char4MTLVertexFormat.ucharMTLVertexFormat.uchar2MTLVertexFormat.uchar3MTLVertexFormat.uchar4
8-bit normalized integer formats
MTLVertexFormat.charNormalizedMTLVertexFormat.char2NormalizedMTLVertexFormat.char3NormalizedMTLVertexFormat.char4NormalizedMTLVertexFormat.ucharNormalizedMTLVertexFormat.uchar2NormalizedMTLVertexFormat.uchar3NormalizedMTLVertexFormat.uchar4Normalized