<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLDataType",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:@E@MTLDataType"
  },
  "title" : "MTLDataType"
}
-->

# MTLDataType

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

```
enum MTLDataType
```

## Overview

Metal reports or accepts this type in several reflection and configuration contexts, such as:

- The [`type`](/documentation/Metal/MTLFunctionConstant/type) property of [`MTLFunctionConstant`](/documentation/Metal/MTLFunctionConstant)
- The [`attributeType`](/documentation/Metal/MTLAttribute/attributeType) property of [`MTLAttribute`](/documentation/Metal/MTLAttribute)
- The [`attributeType`](/documentation/Metal/MTLVertexAttribute/attributeType) property of [`MTLVertexAttribute`](/documentation/Metal/MTLVertexAttribute)
- The [`setConstantValue(_:type:withName:)`](/documentation/Metal/MTLFunctionConstantValues/setConstantValue(_:type:withName:)) method of [`MTLFunctionConstantValues`](/documentation/Metal/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

Types for full-range 64-bit integer data.

[`MTLDataTypeLong`](/documentation/Metal/MTLDataType/long)

A 64-bit, signed integer value.

[`MTLDataTypeLong2`](/documentation/Metal/MTLDataType/long2)

A two-component vector with 64-bit, signed integer values.

[`MTLDataTypeLong3`](/documentation/Metal/MTLDataType/long3)

A three-component vector with 64-bit, signed integer values.

[`MTLDataTypeLong4`](/documentation/Metal/MTLDataType/long4)

A four-component vector with 64-bit, signed integer values.

[`MTLDataTypeULong`](/documentation/Metal/MTLDataType/ulong)

A 64-bit, unsigned integer value.

[`MTLDataTypeULong2`](/documentation/Metal/MTLDataType/ulong2)

A two-component vector with 64-bit, unsigned integer values.

[`MTLDataTypeULong3`](/documentation/Metal/MTLDataType/ulong3)

A three-component vector with 64-bit, unsigned integer values.

[`MTLDataTypeULong4`](/documentation/Metal/MTLDataType/ulong4)

A four-component vector with 64-bit, unsigned integer values.

### 64-bit color integer types

Packed, normalized integer types for high-precision color values.

[`MTLDataTypeRGBA16Snorm`](/documentation/Metal/MTLDataType/rgba16Snorm)

An ordinary pixel with four components, each of which is a 16-bit, normalized, signed integer value.

[`MTLDataTypeRGBA16Unorm`](/documentation/Metal/MTLDataType/rgba16Unorm)

An ordinary pixel with four components, each of which is a 16-bit, normalized, unsigned integer value.

### 32-bit floating-point types

Types for high-precision floating-point data.

[`MTLDataTypeFloat`](/documentation/Metal/MTLDataType/float)

A 32-bit floating-point value.

[`MTLDataTypeFloat2`](/documentation/Metal/MTLDataType/float2)

A two-component vector with 32-bit floating-point values.

[`MTLDataTypeFloat3`](/documentation/Metal/MTLDataType/float3)

A three-component vector with 32-bit floating-point values.

[`MTLDataTypeFloat4`](/documentation/Metal/MTLDataType/float4)

A four-component vector with 32-bit floating-point values.

### 32-bit floating-point matrix types

Matrix types for transformations and linear algebra operations.

[`MTLDataTypeFloat2x2`](/documentation/Metal/MTLDataType/float2x2)

A 2x2 component matrix with 32-bit floating-point values.

[`MTLDataTypeFloat2x3`](/documentation/Metal/MTLDataType/float2x3)

A 2x3 component matrix with 32-bit floating-point values.

[`MTLDataTypeFloat2x4`](/documentation/Metal/MTLDataType/float2x4)

A 2x4 component matrix with 32-bit floating-point values.

[`MTLDataTypeFloat3x2`](/documentation/Metal/MTLDataType/float3x2)

A 3x2 component matrix with 32-bit floating-point values.

[`MTLDataTypeFloat3x3`](/documentation/Metal/MTLDataType/float3x3)

A 3x3 component matrix with 32-bit floating-point values.

[`MTLDataTypeFloat3x4`](/documentation/Metal/MTLDataType/float3x4)

A 3x4 component matrix with 32-bit floating-point values.

[`MTLDataTypeFloat4x2`](/documentation/Metal/MTLDataType/float4x2)

A 4x2 component matrix with 32-bit floating-point values.

[`MTLDataTypeFloat4x3`](/documentation/Metal/MTLDataType/float4x3)

A 4x3 component matrix with 32-bit floating-point values.

[`MTLDataTypeFloat4x4`](/documentation/Metal/MTLDataType/float4x4)

A 4x4 component matrix with 32-bit floating-point values.

### 32-bit color floating-point types

Packed, floating-point types for color values.

[`MTLDataTypeRGB9E5Float`](/documentation/Metal/MTLDataType/rgb9e5Float)

A packed 32-bit format with three color components, each of which is a 9-bit floating-point value.

[`MTLDataTypeRG11B10Float`](/documentation/Metal/MTLDataType/rg11b10Float)

A packed 32-bit format with three floating-point color components, two of which are 11-bit values, and one is a 10-bit value.

### 32-bit color integer types

Packed, normalized integer types for color values.

[`MTLDataTypeRGBA8Snorm`](/documentation/Metal/MTLDataType/rgba8Snorm)

An ordinary pixel with four components, each of which is an 8-bit, normalized, signed integer value.

[`MTLDataTypeRGBA8Unorm`](/documentation/Metal/MTLDataType/rgba8Unorm)

An ordinary pixel with four components, each of which is an 8-bit, normalized, unsigned integer value.

[`MTLDataTypeRGBA8Unorm_sRGB`](/documentation/Metal/MTLDataType/rgba8Unorm_srgb)

An ordinary pixel with four components, each of which is an 8-bit, normalized, unsigned integer value in the sRGB color space.

[`MTLDataTypeRG16Snorm`](/documentation/Metal/MTLDataType/rg16Snorm)

An ordinary pixel with two components, each of which is a 16-bit, normalized, signed integer value.

[`MTLDataTypeRG16Unorm`](/documentation/Metal/MTLDataType/rg16Unorm)

An ordinary pixel with two components, each of which is a 16-bit, normalized, unsigned integer value.

[`MTLDataTypeRGB10A2Unorm`](/documentation/Metal/MTLDataType/rgb10a2Unorm)

A packed 32-bit format with three color components, each of which is a 10-bit, normalized, unsigned integer value.

### 32-bit integer types

Types for full-range 32-bit integer data.

[`MTLDataTypeInt`](/documentation/Metal/MTLDataType/int)

A 32-bit, signed integer value.

[`MTLDataTypeInt2`](/documentation/Metal/MTLDataType/int2)

A two-component vector with 32-bit, signed integer values.

[`MTLDataTypeInt3`](/documentation/Metal/MTLDataType/int3)

A three-component vector with 32-bit, signed integer values.

[`MTLDataTypeInt4`](/documentation/Metal/MTLDataType/int4)

A four-component vector with 32-bit, signed integer values.

[`MTLDataTypeUInt`](/documentation/Metal/MTLDataType/uint)

A 32-bit, unsigned integer value.

[`MTLDataTypeUInt2`](/documentation/Metal/MTLDataType/uint2)

A two-component vector with 32-bit, unsigned integer values.

[`MTLDataTypeUInt3`](/documentation/Metal/MTLDataType/uint3)

A three-component vector with 32-bit, unsigned integer values.

[`MTLDataTypeUInt4`](/documentation/Metal/MTLDataType/uint4)

A four-component vector with 32-bit, unsigned integer values.

### 16-bit floating-point types

Types for half-precision floating-point data that reduce memory bandwidth.

[`MTLDataTypeHalf`](/documentation/Metal/MTLDataType/half)

A 16-bit floating-point value.

[`MTLDataTypeHalf2`](/documentation/Metal/MTLDataType/half2)

A two-component vector with 16-bit floating-point values.

[`MTLDataTypeHalf3`](/documentation/Metal/MTLDataType/half3)

A three-component vector with 16-bit floating-point values.

[`MTLDataTypeHalf4`](/documentation/Metal/MTLDataType/half4)

A four-component vector with 16-bit floating-point values.

### 16-bit floating-point matrix types

Matrix types for transformations and linear algebra operations that reduce memory bandwidth.

[`MTLDataTypeHalf2x2`](/documentation/Metal/MTLDataType/half2x2)

A 2x2 component matrix with 16-bit floating-point values.

[`MTLDataTypeHalf2x3`](/documentation/Metal/MTLDataType/half2x3)

A 2x3 component matrix with 16-bit floating-point values.

[`MTLDataTypeHalf2x4`](/documentation/Metal/MTLDataType/half2x4)

A 2x4 component matrix with 16-bit floating-point values.

[`MTLDataTypeHalf3x2`](/documentation/Metal/MTLDataType/half3x2)

A 3x2 component matrix with 16-bit floating-point values.

[`MTLDataTypeHalf3x3`](/documentation/Metal/MTLDataType/half3x3)

A 3x3 component matrix with 16-bit floating-point values.

[`MTLDataTypeHalf3x4`](/documentation/Metal/MTLDataType/half3x4)

A 3x4 component matrix with 16-bit floating-point values.

[`MTLDataTypeHalf4x2`](/documentation/Metal/MTLDataType/half4x2)

A 4x2 component matrix with 16-bit floating-point values.

[`MTLDataTypeHalf4x3`](/documentation/Metal/MTLDataType/half4x3)

A 4x3 component matrix with 16-bit floating-point values.

[`MTLDataTypeHalf4x4`](/documentation/Metal/MTLDataType/half4x4)

A 4x4 component matrix with 16-bit floating-point values.

### 16-bit brain floating-point types

Types for machine learning workloads that balance range and precision.

[`MTLDataTypeBFloat`](/documentation/Metal/MTLDataType/bfloat)

A 16-bit, brain floating-point value.

[`MTLDataTypeBFloat2`](/documentation/Metal/MTLDataType/bfloat2)

A two-component vector with 16-bit, brain floating-point values.

[`MTLDataTypeBFloat3`](/documentation/Metal/MTLDataType/bfloat3)

A three-component vector with 16-bit, brain floating-point values.

[`MTLDataTypeBFloat4`](/documentation/Metal/MTLDataType/bfloat4)

A four-component vector with 16-bit, brain floating-point values.

### 16-bit integer types

Types for integer data that have more range than 8-bit types.

[`MTLDataTypeShort`](/documentation/Metal/MTLDataType/short)

A 16-bit, signed integer value.

[`MTLDataTypeShort2`](/documentation/Metal/MTLDataType/short2)

A two-component vector with 16-bit, signed integer values.

[`MTLDataTypeShort3`](/documentation/Metal/MTLDataType/short3)

A three-component vector with 16-bit, signed integer values.

[`MTLDataTypeShort4`](/documentation/Metal/MTLDataType/short4)

A four-component vector with 16-bit, signed integer values.

[`MTLDataTypeUShort`](/documentation/Metal/MTLDataType/ushort)

A 16-bit, unsigned integer value.

[`MTLDataTypeUShort2`](/documentation/Metal/MTLDataType/ushort2)

A two-component vector with 16-bit, unsigned integer values.

[`MTLDataTypeUShort3`](/documentation/Metal/MTLDataType/ushort3)

A three-component vector with 16-bit, unsigned integer values.

[`MTLDataTypeUShort4`](/documentation/Metal/MTLDataType/ushort4)

A four-component vector with 16-bit, unsigned integer values.

### 16-bit color integer types

Packed, normalized integer types for compact color values.

[`MTLDataTypeRG8Snorm`](/documentation/Metal/MTLDataType/rg8Snorm)

An ordinary pixel with two components, each of which is an 8-bit, normalized, signed integer value.

[`MTLDataTypeRG8Unorm`](/documentation/Metal/MTLDataType/rg8Unorm)

An ordinary pixel with two components, each of which is an 8-bit, normalized, unsigned integer value.

[`MTLDataTypeR16Snorm`](/documentation/Metal/MTLDataType/r16Snorm)

An ordinary pixel with one component that’s a 16-bit, normalized, signed integer value.

[`MTLDataTypeR16Unorm`](/documentation/Metal/MTLDataType/r16Unorm)

An ordinary pixel with one component that’s a 16-bit, normalized, unsigned integer value.

### 8-bit integer types

Integer types that reduce memory bandwidth and cache impact.

[`MTLDataTypeChar`](/documentation/Metal/MTLDataType/char)

An 8-bit, signed integer value.

[`MTLDataTypeChar2`](/documentation/Metal/MTLDataType/char2)

A two-component vector with 8-bit, signed integer values.

[`MTLDataTypeChar3`](/documentation/Metal/MTLDataType/char3)

A three-component vector with 8-bit, signed integer values.

[`MTLDataTypeChar4`](/documentation/Metal/MTLDataType/char4)

A four-component vector with 8-bit, signed integer values.

[`MTLDataTypeUChar`](/documentation/Metal/MTLDataType/uchar)

An 8-bit, unsigned integer value.

[`MTLDataTypeUChar2`](/documentation/Metal/MTLDataType/uchar2)

A two-component vector with 8-bit, unsigned integer values.

[`MTLDataTypeUChar3`](/documentation/Metal/MTLDataType/uchar3)

A three-component vector with 8-bit, unsigned integer values.

[`MTLDataTypeUChar4`](/documentation/Metal/MTLDataType/uchar4)

A four-component vector with 8-bit, unsigned integer values.

### 8-bit color integer types

Packed, normalized integer types for compact color values.

[`MTLDataTypeR8Snorm`](/documentation/Metal/MTLDataType/r8Snorm)

An ordinary pixel with one component that’s an 8-bit, normalized, signed integer value.

[`MTLDataTypeR8Unorm`](/documentation/Metal/MTLDataType/r8Unorm)

An ordinary pixel with one component that’s an 8-bit, normalized, unsigned integer value.

### Boolean types

Logical types for `true` or `false` values.

[`MTLDataTypeBool`](/documentation/Metal/MTLDataType/bool)

A Boolean value.

[`MTLDataTypeBool2`](/documentation/Metal/MTLDataType/bool2)

A two-component Boolean vector.

[`MTLDataTypeBool3`](/documentation/Metal/MTLDataType/bool3)

A three-component Boolean vector.

[`MTLDataTypeBool4`](/documentation/Metal/MTLDataType/bool4)

A four-component Boolean vector.

### Resource types

Types that refer to GPU resources, such as textures and buffers.

[`MTLDataTypeTensor`](/documentation/Metal/MTLDataType/tensor)

Represents a data type corresponding to a machine learning tensor.

[`MTLDataTypeSampler`](/documentation/Metal/MTLDataType/sampler)

A Metal texture sampler instance.

[`MTLDataTypeTexture`](/documentation/Metal/MTLDataType/texture)

A Metal texture resource instance.

[`MTLDataTypeRenderPipeline`](/documentation/Metal/MTLDataType/renderPipeline)

A Metal render pipeline instance.

[`MTLDataTypeComputePipeline`](/documentation/Metal/MTLDataType/computePipeline)

A Metal compute pipeline instance.

[`MTLDataTypeDepthStencilState`](/documentation/Metal/MTLDataType/depthStencilState)

Represents a data type corresponding to a depth-stencil state object.

[`MTLDataTypeIndirectCommandBuffer`](/documentation/Metal/MTLDataType/indirectCommandBuffer)

An indirect command buffer resource instance.

[`MTLDataTypeVisibleFunctionTable`](/documentation/Metal/MTLDataType/visibleFunctionTable)

A table of visible functions that a render or compute pipeline can call.

[`MTLDataTypeIntersectionFunctionTable`](/documentation/Metal/MTLDataType/intersectionFunctionTable)

A table of intersection functions that a render or compute pipeline can call.

[`MTLDataTypePrimitiveAccelerationStructure`](/documentation/Metal/MTLDataType/primitiveAccelerationStructure)

A low-level ray-tracing acceleration structure for a set of primitives.

[`MTLDataTypeInstanceAccelerationStructure`](/documentation/Metal/MTLDataType/instanceAccelerationStructure)

A high-level, ray-tracing acceleration structure for a set of low-level primitive instances.

### Collection types

Types for structured or indirect data access.

[`MTLDataTypeStruct`](/documentation/Metal/MTLDataType/struct)

A structure instance.

[`MTLDataTypeArray`](/documentation/Metal/MTLDataType/array)

An array instance.

[`MTLDataTypePointer`](/documentation/Metal/MTLDataType/pointer)

A pointer.

### Sentinel values

Special values that represent something other than a valid data type.

[`MTLDataTypeNone`](/documentation/Metal/MTLDataType/none)

A sentinel value that represents a GPU function parameter that doesn’t have a valid data type.

### Swift support

[`init(rawValue:)`](/documentation/Metal/MTLDataType/init(rawValue:))

Creates a data type instance from a raw integer value.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)