MTLAttributeFormat
The data format options for acceleration structures.
Declaration
enum MTLAttributeFormatOverview
All formats use little-endian byte order, which stores the least significant byte first. For GPU compute functions that manipulate data that other parts of your app consume, check that the data it exposes to the GPU matches the byte and bit alignments of the source format.
In a GPU compute function’s attributes, you can use a type that’s different from the original source data if it has the same number of bits. For example, a GPU function can interpret a 128-bit little-endian integer as a four-component vector of unsigned 32-bit integers (MTLAttributeFormat.uint4).
Normalized integer formats
Normalized signed integer formats have Normalized in the name and signed types like MTLAttributeFormat.char or MTLAttributeFormat.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 MTLAttributeFormat.uchar or MTLAttributeFormat.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.
Topics
32-bit floating-point formats
MTLAttributeFormat.floatMTLAttributeFormat.float2MTLAttributeFormat.float3MTLAttributeFormat.float4MTLAttributeFormat.floatRG11B10MTLAttributeFormat.floatRGB9E5
32-bit integer formats
MTLAttributeFormat.intMTLAttributeFormat.int2MTLAttributeFormat.int3MTLAttributeFormat.int4MTLAttributeFormat.uintMTLAttributeFormat.uint2MTLAttributeFormat.uint3MTLAttributeFormat.uint4
32-bit normalized integer formats
MTLAttributeFormat.int1010102NormalizedMTLAttributeFormat.uint1010102NormalizedMTLAttributeFormat.uchar4Normalized_bgra
16-bit floating-point formats
16-bit integer formats
MTLAttributeFormat.shortMTLAttributeFormat.short2MTLAttributeFormat.short3MTLAttributeFormat.short4MTLAttributeFormat.ushortMTLAttributeFormat.ushort2MTLAttributeFormat.ushort3MTLAttributeFormat.ushort4
16-bit normalized integer formats
MTLAttributeFormat.shortNormalizedMTLAttributeFormat.short2NormalizedMTLAttributeFormat.short3NormalizedMTLAttributeFormat.short4NormalizedMTLAttributeFormat.ushortNormalizedMTLAttributeFormat.ushort2NormalizedMTLAttributeFormat.ushort3NormalizedMTLAttributeFormat.ushort4Normalized
8-bit integer formats
MTLAttributeFormat.charMTLAttributeFormat.char2MTLAttributeFormat.char3MTLAttributeFormat.char4MTLAttributeFormat.ucharMTLAttributeFormat.uchar2MTLAttributeFormat.uchar3MTLAttributeFormat.uchar4
8-bit normalized integer formats
MTLAttributeFormat.charNormalizedMTLAttributeFormat.char2NormalizedMTLAttributeFormat.char3NormalizedMTLAttributeFormat.char4NormalizedMTLAttributeFormat.ucharNormalizedMTLAttributeFormat.uchar2NormalizedMTLAttributeFormat.uchar3NormalizedMTLAttributeFormat.uchar4Normalized