<!--
{
  "availability" : [
    "Reality Composer Pro: -",
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ComputeGraph",
  "identifier" : "/documentation/ComputeGraph/ComputeNodeGraph/StateType",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Compute Graph",
      "ComputeGraph"
    ],
    "preciseIdentifier" : "s:12ComputeGraph0a4NodeB0V9StateTypeO"
  },
  "title" : "ComputeNodeGraph.StateType"
}
-->

# ComputeNodeGraph.StateType

The shape of a value stored in a compute graph’s state.

```
enum StateType
```

## Overview

`StateType` describes what kind of value a state holds. The shape determines the slot’s size,
alignment, and how it is surfaced in generated Metal source and in graph serialization.

## Topics

### Enumeration Cases

[`case array(definition: ComputeNodeGraph.ArrayDefinition)`](/documentation/ComputeGraph/ComputeNodeGraph/StateType/array(definition:))

Value is an array with the provided definition

[`case data(length: Int)`](/documentation/ComputeGraph/ComputeNodeGraph/StateType/data(length:))

Value is a fixed number of untyped bytes

[`case dataType(type: MTLDataType)`](/documentation/ComputeGraph/ComputeNodeGraph/StateType/dataType(type:))

Legacy. Do not construct in new code.

[`case primitive(type: ComputeNodeGraph.DataType)`](/documentation/ComputeGraph/ComputeNodeGraph/StateType/primitive(type:))

Value is a primitive with the given type

[`case structure(definition: ComputeNodeGraph.StructureDefinition)`](/documentation/ComputeGraph/ComputeNodeGraph/StateType/structure(definition:))

Value is a structure with the given layout

### Instance Methods

[`func loadBuffer(from: Data) throws -> (data: Data, elementCount: Int)`](/documentation/ComputeGraph/ComputeNodeGraph/StateType/loadBuffer(from:))

## Relationships

### Conforms To

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

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

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

---

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)