---
title: MTLDataType
framework: metal
role: symbol
role_heading: Enumeration
path: metal/mtldatatype
---

# MTLDataType

The parameter type options for GPU functions, such as shaders and compute kernels.

## Declaration

```swift
enum MTLDataType
```

## Overview

Overview 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). important: For normalized signed integer types, the values MIN_INT and (MIN_INT + 1) both map to -1.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.long](metal/mtldatatype/long.md)
- [MTLDataType.long2](metal/mtldatatype/long2.md)
- [MTLDataType.long3](metal/mtldatatype/long3.md)
- [MTLDataType.long4](metal/mtldatatype/long4.md)
- [MTLDataType.ulong](metal/mtldatatype/ulong.md)
- [MTLDataType.ulong2](metal/mtldatatype/ulong2.md)
- [MTLDataType.ulong3](metal/mtldatatype/ulong3.md)
- [MTLDataType.ulong4](metal/mtldatatype/ulong4.md)

### 64-bit color integer types

- [MTLDataType.rgba16Snorm](metal/mtldatatype/rgba16snorm.md)
- [MTLDataType.rgba16Unorm](metal/mtldatatype/rgba16unorm.md)

### 32-bit floating-point types

- [MTLDataType.float](metal/mtldatatype/float.md)
- [MTLDataType.float2](metal/mtldatatype/float2.md)
- [MTLDataType.float3](metal/mtldatatype/float3.md)
- [MTLDataType.float4](metal/mtldatatype/float4.md)

### 32-bit floating-point matrix types

- [MTLDataType.float2x2](metal/mtldatatype/float2x2.md)
- [MTLDataType.float2x3](metal/mtldatatype/float2x3.md)
- [MTLDataType.float2x4](metal/mtldatatype/float2x4.md)
- [MTLDataType.float3x2](metal/mtldatatype/float3x2.md)
- [MTLDataType.float3x3](metal/mtldatatype/float3x3.md)
- [MTLDataType.float3x4](metal/mtldatatype/float3x4.md)
- [MTLDataType.float4x2](metal/mtldatatype/float4x2.md)
- [MTLDataType.float4x3](metal/mtldatatype/float4x3.md)
- [MTLDataType.float4x4](metal/mtldatatype/float4x4.md)

### 32-bit color floating-point types

- [MTLDataType.rgb9e5Float](metal/mtldatatype/rgb9e5float.md)
- [MTLDataType.rg11b10Float](metal/mtldatatype/rg11b10float.md)

### 32-bit color integer types

- [MTLDataType.rgba8Snorm](metal/mtldatatype/rgba8snorm.md)
- [MTLDataType.rgba8Unorm](metal/mtldatatype/rgba8unorm.md)
- [MTLDataType.rgba8Unorm_srgb](metal/mtldatatype/rgba8unorm_srgb.md)
- [MTLDataType.rg16Snorm](metal/mtldatatype/rg16snorm.md)
- [MTLDataType.rg16Unorm](metal/mtldatatype/rg16unorm.md)
- [MTLDataType.rgb10a2Unorm](metal/mtldatatype/rgb10a2unorm.md)

### 32-bit integer types

- [MTLDataType.int](metal/mtldatatype/int.md)
- [MTLDataType.int2](metal/mtldatatype/int2.md)
- [MTLDataType.int3](metal/mtldatatype/int3.md)
- [MTLDataType.int4](metal/mtldatatype/int4.md)
- [MTLDataType.uint](metal/mtldatatype/uint.md)
- [MTLDataType.uint2](metal/mtldatatype/uint2.md)
- [MTLDataType.uint3](metal/mtldatatype/uint3.md)
- [MTLDataType.uint4](metal/mtldatatype/uint4.md)

### 16-bit floating-point types

- [MTLDataType.half](metal/mtldatatype/half.md)
- [MTLDataType.half2](metal/mtldatatype/half2.md)
- [MTLDataType.half3](metal/mtldatatype/half3.md)
- [MTLDataType.half4](metal/mtldatatype/half4.md)

### 16-bit floating-point matrix types

- [MTLDataType.half2x2](metal/mtldatatype/half2x2.md)
- [MTLDataType.half2x3](metal/mtldatatype/half2x3.md)
- [MTLDataType.half2x4](metal/mtldatatype/half2x4.md)
- [MTLDataType.half3x2](metal/mtldatatype/half3x2.md)
- [MTLDataType.half3x3](metal/mtldatatype/half3x3.md)
- [MTLDataType.half3x4](metal/mtldatatype/half3x4.md)
- [MTLDataType.half4x2](metal/mtldatatype/half4x2.md)
- [MTLDataType.half4x3](metal/mtldatatype/half4x3.md)
- [MTLDataType.half4x4](metal/mtldatatype/half4x4.md)

### 16-bit brain floating-point types

- [MTLDataType.bfloat](metal/mtldatatype/bfloat.md)
- [MTLDataType.bfloat2](metal/mtldatatype/bfloat2.md)
- [MTLDataType.bfloat3](metal/mtldatatype/bfloat3.md)
- [MTLDataType.bfloat4](metal/mtldatatype/bfloat4.md)

### 16-bit integer types

- [MTLDataType.short](metal/mtldatatype/short.md)
- [MTLDataType.short2](metal/mtldatatype/short2.md)
- [MTLDataType.short3](metal/mtldatatype/short3.md)
- [MTLDataType.short4](metal/mtldatatype/short4.md)
- [MTLDataType.ushort](metal/mtldatatype/ushort.md)
- [MTLDataType.ushort2](metal/mtldatatype/ushort2.md)
- [MTLDataType.ushort3](metal/mtldatatype/ushort3.md)
- [MTLDataType.ushort4](metal/mtldatatype/ushort4.md)

### 16-bit color integer types

- [MTLDataType.rg8Snorm](metal/mtldatatype/rg8snorm.md)
- [MTLDataType.rg8Unorm](metal/mtldatatype/rg8unorm.md)
- [MTLDataType.r16Snorm](metal/mtldatatype/r16snorm.md)
- [MTLDataType.r16Unorm](metal/mtldatatype/r16unorm.md)

### 8-bit integer types

- [MTLDataType.char](metal/mtldatatype/char.md)
- [MTLDataType.char2](metal/mtldatatype/char2.md)
- [MTLDataType.char3](metal/mtldatatype/char3.md)
- [MTLDataType.char4](metal/mtldatatype/char4.md)
- [MTLDataType.uchar](metal/mtldatatype/uchar.md)
- [MTLDataType.uchar2](metal/mtldatatype/uchar2.md)
- [MTLDataType.uchar3](metal/mtldatatype/uchar3.md)
- [MTLDataType.uchar4](metal/mtldatatype/uchar4.md)

### 8-bit color integer types

- [MTLDataType.r8Snorm](metal/mtldatatype/r8snorm.md)
- [MTLDataType.r8Unorm](metal/mtldatatype/r8unorm.md)

### Boolean types

- [MTLDataType.bool](metal/mtldatatype/bool.md)
- [MTLDataType.bool2](metal/mtldatatype/bool2.md)
- [MTLDataType.bool3](metal/mtldatatype/bool3.md)
- [MTLDataType.bool4](metal/mtldatatype/bool4.md)

### Resource types

- [MTLDataType.tensor](metal/mtldatatype/tensor.md)
- [MTLDataType.sampler](metal/mtldatatype/sampler.md)
- [MTLDataType.texture](metal/mtldatatype/texture.md)
- [MTLDataType.renderPipeline](metal/mtldatatype/renderpipeline.md)
- [MTLDataType.computePipeline](metal/mtldatatype/computepipeline.md)
- [MTLDataType.depthStencilState](metal/mtldatatype/depthstencilstate.md)
- [MTLDataType.indirectCommandBuffer](metal/mtldatatype/indirectcommandbuffer.md)
- [MTLDataType.visibleFunctionTable](metal/mtldatatype/visiblefunctiontable.md)
- [MTLDataType.intersectionFunctionTable](metal/mtldatatype/intersectionfunctiontable.md)
- [MTLDataType.primitiveAccelerationStructure](metal/mtldatatype/primitiveaccelerationstructure.md)
- [MTLDataType.instanceAccelerationStructure](metal/mtldatatype/instanceaccelerationstructure.md)

### Collection types

- [MTLDataType.struct](metal/mtldatatype/struct.md)
- [MTLDataType.array](metal/mtldatatype/array.md)
- [MTLDataType.pointer](metal/mtldatatype/pointer.md)

### Sentinel values

- [MTLDataType.none](metal/mtldatatype/none.md)

### Swift support

- [init(rawValue:)](metal/mtldatatype/init(rawvalue:).md)

## Relationships

### Conforms To

- [BitwiseCopyable](swift/bitwisecopyable.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [RawRepresentable](swift/rawrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Shader types

- [MTLType](metal/mtltype.md)
- [MTLArrayType](metal/mtlarraytype.md)
- [MTLStructType](metal/mtlstructtype.md)
- [MTLStructMember](metal/mtlstructmember.md)
- [MTLPointerType](metal/mtlpointertype.md)
- [MTLTextureReferenceType](metal/mtltexturereferencetype.md)
