<!--
{
  "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/MTLVertexAttributeDescriptor/format",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLVertexAttributeDescriptor(py)format"
  },
  "title" : "format"
}
-->

# format

The format of the vertex attribute.

```
var format: MTLVertexFormat { get set }
```

## Discussion

This property specifies the data type of the vertex attribute that corresponds to an input argument of a shading language function. The [`MTLVertexFormat`](/documentation/Metal/MTLVertexFormat) may be converted to the data type in the shading function argument with the following specified limitations. Invalid type conversion causes a compilation error.

Conversion of vectors of different lengths is valid. The length of vectors can be reduced. For example,  [`MTLVertexFormat.int4`](/documentation/Metal/MTLVertexFormat/int4) data can be reduced to a single `int` shader argument is valid, and the last three values of the vector are discarded. Vectors can also be expanded; for example, expanding [`MTLVertexFormat.int`](/documentation/Metal/MTLVertexFormat/int) to an `int4` vector shader argument is valid. When expanding, the extra components are filled with the corresponding components of (0,0,0,1).

The sign of an integer [`MTLVertexFormat`](/documentation/Metal/MTLVertexFormat) can not be cast to a shader argument with an integer type of a different sign. For example, casting the signed format [`MTLVertexFormat.int`](/documentation/Metal/MTLVertexFormat/int) to an `uint` shader argument is invalid. Casting [`MTLVertexFormat.uint`](/documentation/Metal/MTLVertexFormat/uint) to an `int` argument is also invalid.

Integer truncation is not supported. For example, casting the [`MTLVertexFormat.int`](/documentation/Metal/MTLVertexFormat/int) to a `short` is invalid. However, casting [`MTLVertexFormat.short2`](/documentation/Metal/MTLVertexFormat/short2) to a vector of `int` values is valid.

Casting any [`MTLVertexFormat`](/documentation/Metal/MTLVertexFormat) to a `float` or `half` is valid. Casting normalized [`MTLVertexFormat`](/documentation/Metal/MTLVertexFormat) types (such as [`MTLVertexFormat.short2Normalized`](/documentation/Metal/MTLVertexFormat/short2Normalized)) are only valid to `float` or `half`.

## See Also

  [Metal Shading Language Guide](https://developer.apple.com/library/archive/documentation/Metal/Reference/MetalShadingLanguageGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40014364)

  [Metal Programming Guide](https://developer.apple.com/library/archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40014221)



---

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)