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

# MTLAttributeFormat

The data format options for acceleration structures.

```
enum MTLAttributeFormat
```

## 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`](/documentation/Metal/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`](/documentation/Metal/MTLAttributeFormat/char) or [`MTLAttributeFormat.short`](/documentation/Metal/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`](/documentation/Metal/MTLAttributeFormat/uchar) or [`MTLAttributeFormat.ushort`](/documentation/Metal/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

Formats for high-precision floating-point data, such as in acceleration structures.

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

A 32-bit floating-point value.

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

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

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

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

[`MTLAttributeFormat.float4`](/documentation/Metal/MTLAttributeFormat/float4)

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

[`MTLAttributeFormat.floatRG11B10`](/documentation/Metal/MTLAttributeFormat/floatRG11B10)

One packed 32-bit value representing pixel data containing 11-bit float red and green channels, and a 10-bit float blue channel.

[`MTLAttributeFormat.floatRGB9E5`](/documentation/Metal/MTLAttributeFormat/floatRGB9E5)

One packed 32-bit value representing pixel data containing 9-bit float red, green, and blue channels, and a 5-bit float shared exponent channel.

### 32-bit integer formats

Formats for full-range integer data.

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

A 32-bit, signed integer value.

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

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

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

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

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

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

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

A 32-bit, unsigned integer value.

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

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

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

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

[`MTLAttributeFormat.uint4`](/documentation/Metal/MTLAttributeFormat/uint4)

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

### 32-bit normalized integer formats

Formats that store integer data in memory but the GPU interprets as floating-point values in the range `[0.0, 1.0]` or `[-1.0, 1.0]`.

[`MTLAttributeFormat.int1010102Normalized`](/documentation/Metal/MTLAttributeFormat/int1010102Normalized)

One packed 32-bit value with four normalized signed two’s complement integer values, arranged as 10 bits, 10 bits, 10 bits, and 2 bits.

[`MTLAttributeFormat.uint1010102Normalized`](/documentation/Metal/MTLAttributeFormat/uint1010102Normalized)

One packed 32-bit value with four normalized unsigned integer values, arranged as 10 bits, 10 bits, 10 bits, and 2 bits.

[`MTLAttributeFormat.uchar4Normalized_bgra`](/documentation/Metal/MTLAttributeFormat/uchar4Normalized_bgra)

Four unsigned normalized 8-bit values, arranged as blue, green, red, and alpha components.

### 16-bit floating-point formats

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

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

A 16-bit floating-point value.

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

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

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

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

[`MTLAttributeFormat.half4`](/documentation/Metal/MTLAttributeFormat/half4)

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

### 16-bit integer formats

Formats for integer data when the range of 8-bit values is insufficient.

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

A 16-bit, signed integer value.

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

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

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

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

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

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

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

A 16-bit, unsigned integer value.

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

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

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

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

[`MTLAttributeFormat.ushort4`](/documentation/Metal/MTLAttributeFormat/ushort4)

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

### 16-bit normalized integer formats

Formats that store integer data in memory but the GPU interprets as floating-point values in the range `[0.0, 1.0]` or `[-1.0, 1.0]`.

[`MTLAttributeFormat.shortNormalized`](/documentation/Metal/MTLAttributeFormat/shortNormalized)

A 16-bit, normalized, signed integer value.

[`MTLAttributeFormat.short2Normalized`](/documentation/Metal/MTLAttributeFormat/short2Normalized)

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

[`MTLAttributeFormat.short3Normalized`](/documentation/Metal/MTLAttributeFormat/short3Normalized)

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

[`MTLAttributeFormat.short4Normalized`](/documentation/Metal/MTLAttributeFormat/short4Normalized)

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

[`MTLAttributeFormat.ushortNormalized`](/documentation/Metal/MTLAttributeFormat/ushortNormalized)

A 16-bit, normalized, unsigned integer value.

[`MTLAttributeFormat.ushort2Normalized`](/documentation/Metal/MTLAttributeFormat/ushort2Normalized)

Two unsigned normalized 16-bit values

[`MTLAttributeFormat.ushort3Normalized`](/documentation/Metal/MTLAttributeFormat/ushort3Normalized)

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

[`MTLAttributeFormat.ushort4Normalized`](/documentation/Metal/MTLAttributeFormat/ushort4Normalized)

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

### 8-bit integer formats

Formats for compact integer data that reduce memory bandwidth and cache impact.

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

An 8-bit, signed integer value.

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

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

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

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

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

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

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

An 8-bit, unsigned integer value.

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

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

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

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

[`MTLAttributeFormat.uchar4`](/documentation/Metal/MTLAttributeFormat/uchar4)

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

### 8-bit normalized integer formats

Formats that store integer data in memory but the GPU interprets as floating-point values in the range `[0.0, 1.0]` or `[-1.0, 1.0]`.

[`MTLAttributeFormat.charNormalized`](/documentation/Metal/MTLAttributeFormat/charNormalized)

An 8-bit, normalized, signed integer value.

[`MTLAttributeFormat.char2Normalized`](/documentation/Metal/MTLAttributeFormat/char2Normalized)

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

[`MTLAttributeFormat.char3Normalized`](/documentation/Metal/MTLAttributeFormat/char3Normalized)

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

[`MTLAttributeFormat.char4Normalized`](/documentation/Metal/MTLAttributeFormat/char4Normalized)

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

[`MTLAttributeFormat.ucharNormalized`](/documentation/Metal/MTLAttributeFormat/ucharNormalized)

An 8-bit, normalized, unsigned integer value.

[`MTLAttributeFormat.uchar2Normalized`](/documentation/Metal/MTLAttributeFormat/uchar2Normalized)

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

[`MTLAttributeFormat.uchar3Normalized`](/documentation/Metal/MTLAttributeFormat/uchar3Normalized)

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

[`MTLAttributeFormat.uchar4Normalized`](/documentation/Metal/MTLAttributeFormat/uchar4Normalized)

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

### Sentinel values

Special values that represent something other than an attribute format.

[`MTLAttributeFormat.invalid`](/documentation/Metal/MTLAttributeFormat/invalid)

A sentinel value that represents an invalid attribute format.

### Swift support

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



---

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)