MTLDataType
The parameter type options for GPU functions, such as shaders and compute kernels.
Declaration
enum MTLDataTypeOverview
Metal reports or accepts this type in several reflection and configuration contexts, such as:
The type property of MTLFunctionConstant
The attributeType property of MTLAttribute
The attributeType property of MTLVertexAttribute
The setConstantValue(_:type:withName:) method of MTLFunctionConstantValues
Normalized integer types
Color types with Snorm in the name are normalized signed integer types. For these types, 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).
Color types with Unorm in the name are normalized unsigned integer types. For these types, 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
64-bit integer types
MTLDataType.longMTLDataType.long2MTLDataType.long3MTLDataType.long4MTLDataType.ulongMTLDataType.ulong2MTLDataType.ulong3MTLDataType.ulong4
64-bit color integer types
32-bit floating-point types
32-bit floating-point matrix types
MTLDataType.float2x2MTLDataType.float2x3MTLDataType.float2x4MTLDataType.float3x2MTLDataType.float3x3MTLDataType.float3x4MTLDataType.float4x2MTLDataType.float4x3MTLDataType.float4x4
32-bit color floating-point types
32-bit color integer types
MTLDataType.rgba8SnormMTLDataType.rgba8UnormMTLDataType.rgba8Unorm_srgbMTLDataType.rg16SnormMTLDataType.rg16UnormMTLDataType.rgb10a2Unorm
32-bit integer types
MTLDataType.intMTLDataType.int2MTLDataType.int3MTLDataType.int4MTLDataType.uintMTLDataType.uint2MTLDataType.uint3MTLDataType.uint4
16-bit floating-point types
16-bit floating-point matrix types
MTLDataType.half2x2MTLDataType.half2x3MTLDataType.half2x4MTLDataType.half3x2MTLDataType.half3x3MTLDataType.half3x4MTLDataType.half4x2MTLDataType.half4x3MTLDataType.half4x4
16-bit brain floating-point types
16-bit integer types
MTLDataType.shortMTLDataType.short2MTLDataType.short3MTLDataType.short4MTLDataType.ushortMTLDataType.ushort2MTLDataType.ushort3MTLDataType.ushort4
16-bit color integer types
8-bit integer types
MTLDataType.charMTLDataType.char2MTLDataType.char3MTLDataType.char4MTLDataType.ucharMTLDataType.uchar2MTLDataType.uchar3MTLDataType.uchar4
8-bit color integer types
Boolean types
Resource types
MTLDataType.tensorMTLDataType.samplerMTLDataType.textureMTLDataType.renderPipelineMTLDataType.computePipelineMTLDataType.depthStencilStateMTLDataType.indirectCommandBufferMTLDataType.visibleFunctionTableMTLDataType.intersectionFunctionTableMTLDataType.primitiveAccelerationStructureMTLDataType.instanceAccelerationStructure