<!--
{
  "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.

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

A 64-bit, signed integer value.

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

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

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

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

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

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

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

A 64-bit, unsigned integer value.

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

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

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

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

[`MTLDataType.ulong4`](/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.

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

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

[`MTLDataType.rgba16Unorm`](/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.

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

A 32-bit floating-point value.

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

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

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

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

[`MTLDataType.float4`](/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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[`MTLDataType.float4x4`](/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.

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

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

[`MTLDataType.rg11b10Float`](/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.

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

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

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

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

[`MTLDataType.rgba8Unorm_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.

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

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

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

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

[`MTLDataType.rgb10a2Unorm`](/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.

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

A 32-bit, signed integer value.

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

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

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

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

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

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

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

A 32-bit, unsigned integer value.

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

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

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

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

[`MTLDataType.uint4`](/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.

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

A 16-bit floating-point value.

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

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

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

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

[`MTLDataType.half4`](/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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[`MTLDataType.half4x4`](/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.

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

A 16-bit, brain floating-point value.

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

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

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

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

[`MTLDataType.bfloat4`](/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.

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

A 16-bit, signed integer value.

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

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

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

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

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

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

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

A 16-bit, unsigned integer value.

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

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

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

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

[`MTLDataType.ushort4`](/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.

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

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

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

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

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

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

[`MTLDataType.r16Unorm`](/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.

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

An 8-bit, signed integer value.

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

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

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

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

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

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

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

An 8-bit, unsigned integer value.

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

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

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

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

[`MTLDataType.uchar4`](/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.

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

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

[`MTLDataType.r8Unorm`](/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.

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

A Boolean value.

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

A two-component Boolean vector.

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

A three-component Boolean vector.

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

A four-component Boolean vector.

### Resource types

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

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

Represents a data type corresponding to a machine learning tensor.

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

A Metal texture sampler instance.

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

A Metal texture resource instance.

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

A Metal render pipeline instance.

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

A Metal compute pipeline instance.

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

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

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

An indirect command buffer resource instance.

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

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

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

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

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

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

[`MTLDataType.instanceAccelerationStructure`](/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.

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

A structure instance.

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

An array instance.

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

A pointer.

### Sentinel values

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

[`MTLDataType.none`](/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.



---

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)