---
title: MTLAttributeFormat
framework: metal
role: symbol
role_heading: Enumeration
path: metal/mtlattributeformat
---

# MTLAttributeFormat

The data format options for acceleration structures.

## Declaration

```swift
enum MTLAttributeFormat
```

## Overview

Overview 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). tip: Avoid visual corruption when manipulating pixel data in a GPU compute function for a subsequent stage by using an exact match for the underlying pixel data. 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). important: For normalized signed integer formats, the values MIN_INT and (MIN_INT + 1) both map to -1.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.float](metal/mtlattributeformat/float.md)
- [MTLAttributeFormat.float2](metal/mtlattributeformat/float2.md)
- [MTLAttributeFormat.float3](metal/mtlattributeformat/float3.md)
- [MTLAttributeFormat.float4](metal/mtlattributeformat/float4.md)
- [MTLAttributeFormat.floatRG11B10](metal/mtlattributeformat/floatrg11b10.md)
- [MTLAttributeFormat.floatRGB9E5](metal/mtlattributeformat/floatrgb9e5.md)

### 32-bit integer formats

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

### 32-bit normalized integer formats

- [MTLAttributeFormat.int1010102Normalized](metal/mtlattributeformat/int1010102normalized.md)
- [MTLAttributeFormat.uint1010102Normalized](metal/mtlattributeformat/uint1010102normalized.md)
- [MTLAttributeFormat.uchar4Normalized_bgra](metal/mtlattributeformat/uchar4normalized_bgra.md)

### 16-bit floating-point formats

- [MTLAttributeFormat.half](metal/mtlattributeformat/half.md)
- [MTLAttributeFormat.half2](metal/mtlattributeformat/half2.md)
- [MTLAttributeFormat.half3](metal/mtlattributeformat/half3.md)
- [MTLAttributeFormat.half4](metal/mtlattributeformat/half4.md)

### 16-bit integer formats

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

### 16-bit normalized integer formats

- [MTLAttributeFormat.shortNormalized](metal/mtlattributeformat/shortnormalized.md)
- [MTLAttributeFormat.short2Normalized](metal/mtlattributeformat/short2normalized.md)
- [MTLAttributeFormat.short3Normalized](metal/mtlattributeformat/short3normalized.md)
- [MTLAttributeFormat.short4Normalized](metal/mtlattributeformat/short4normalized.md)
- [MTLAttributeFormat.ushortNormalized](metal/mtlattributeformat/ushortnormalized.md)
- [MTLAttributeFormat.ushort2Normalized](metal/mtlattributeformat/ushort2normalized.md)
- [MTLAttributeFormat.ushort3Normalized](metal/mtlattributeformat/ushort3normalized.md)
- [MTLAttributeFormat.ushort4Normalized](metal/mtlattributeformat/ushort4normalized.md)

### 8-bit integer formats

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

### 8-bit normalized integer formats

- [MTLAttributeFormat.charNormalized](metal/mtlattributeformat/charnormalized.md)
- [MTLAttributeFormat.char2Normalized](metal/mtlattributeformat/char2normalized.md)
- [MTLAttributeFormat.char3Normalized](metal/mtlattributeformat/char3normalized.md)
- [MTLAttributeFormat.char4Normalized](metal/mtlattributeformat/char4normalized.md)
- [MTLAttributeFormat.ucharNormalized](metal/mtlattributeformat/ucharnormalized.md)
- [MTLAttributeFormat.uchar2Normalized](metal/mtlattributeformat/uchar2normalized.md)
- [MTLAttributeFormat.uchar3Normalized](metal/mtlattributeformat/uchar3normalized.md)
- [MTLAttributeFormat.uchar4Normalized](metal/mtlattributeformat/uchar4normalized.md)

### Sentinel values

- [MTLAttributeFormat.invalid](metal/mtlattributeformat/invalid.md)

### Swift support

- [init(rawValue:)](metal/mtlattributeformat/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

### Defining attribute location

- [bufferIndex](metal/mtlattributedescriptor/bufferindex.md)
- [offset](metal/mtlattributedescriptor/offset.md)
- [format](metal/mtlattributedescriptor/format.md)
