<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/LowLevelMeshResource",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:19RealityCoreRenderer20LowLevelMeshResourceC"
  },
  "title" : "LowLevelMeshResource"
}
-->

# LowLevelMeshResource

A container for vertex and index data in a custom format.

```
final class LowLevelMeshResource
```

## Overview

Use `LowLevelMeshResource` when you want to bring your own vertex format to the renderer
or update your data frequently. Vertex and index data can be written directly on the CPU
through span-based accessors, or on the GPU by writing to a `MTLBuffer` returned by
`replaceVertices(at:commandBuffer:)` / `replaceIndices(commandBuffer:)`.

Create a `LowLevelMeshResource` using
[`makeMeshResource(descriptor:)`](/documentation/RealityKit/LowLevelRenderContext/makeMeshResource(descriptor:)).

## Topics

### Describing the mesh layout

[`var descriptor: LowLevelMeshResource.Descriptor`](/documentation/RealityKit/LowLevelMeshResource/descriptor-swift.property)

The descriptor used to create this mesh resource.

[`struct Descriptor`](/documentation/RealityKit/LowLevelMeshResource/Descriptor-swift.struct)

An object that describes the data format and layout of the buffers in a low-level mesh.

[`struct Layout`](/documentation/RealityKit/LowLevelMeshResource/Layout)

An object that describes a set of attributes that share a buffer index, offset, and stride.

[`struct Attribute`](/documentation/RealityKit/LowLevelMeshResource/Attribute)

An object that determines how to store vertex attribute data in memory and map it to
RealityKit custom shader attributes.

[`enum VertexSemantic`](/documentation/RealityKit/LowLevelMeshResource/VertexSemantic)

The intended usage of a vertex attribute.

### Accessing vertex data

[`func readVertices<R, E>(at: Int, (RawSpan) throws(E) -> R) throws(E) -> R`](/documentation/RealityKit/LowLevelMeshResource/readVertices(at:_:))

Reads the current contents of a vertex buffer synchronously on the CPU.

[`func updateVertices<R, E>(at: Int, (inout MutableRawSpan) throws(E) -> R) throws(E) -> R`](/documentation/RealityKit/LowLevelMeshResource/updateVertices(at:_:))

Updates a vertex buffer in place synchronously on the CPU.

[`func replaceVertices<R, E>(at: Int, (inout MutableRawSpan) throws(E) -> R) throws(E) -> R`](/documentation/RealityKit/LowLevelMeshResource/replaceVertices(at:_:))

Replaces the entire contents of a vertex buffer synchronously on the CPU.

[`func readVertices(at: Int, commandBuffer: (any MTLCommandBuffer)?) -> any MTLBuffer`](/documentation/RealityKit/LowLevelMeshResource/readVertices(at:commandBuffer:))

Returns a Metal buffer containing the current contents of the vertex buffer for GPU read operations.

[`func replaceVertices(at: Int, commandBuffer: (any MTLCommandBuffer)?) -> any MTLBuffer`](/documentation/RealityKit/LowLevelMeshResource/replaceVertices(at:commandBuffer:))

Returns a Metal buffer you populate on the GPU with the new contents of the vertex buffer.

### Accessing index data

[`func readIndices<R, E>((RawSpan) throws(E) -> R) throws(E) -> R`](/documentation/RealityKit/LowLevelMeshResource/readIndices(_:))

Reads the current contents of the index buffer synchronously on the CPU.

[`func updateIndices<R, E>((inout MutableRawSpan) throws(E) -> R) throws(E) -> R`](/documentation/RealityKit/LowLevelMeshResource/updateIndices(_:))

Updates the index buffer in place synchronously on the CPU.

[`func replaceIndices<R, E>((inout MutableRawSpan) throws(E) -> R) throws(E) -> R`](/documentation/RealityKit/LowLevelMeshResource/replaceIndices(_:))

Replaces the entire contents of the index buffer synchronously on the CPU.

[`func readIndices(commandBuffer: (any MTLCommandBuffer)?) -> any MTLBuffer`](/documentation/RealityKit/LowLevelMeshResource/readIndices(commandBuffer:))

Returns a Metal buffer containing the current contents of the index buffer for GPU read operations.

[`func replaceIndices(commandBuffer: (any MTLCommandBuffer)?) -> any MTLBuffer`](/documentation/RealityKit/LowLevelMeshResource/replaceIndices(commandBuffer:))

Returns a Metal buffer you populate on the GPU with the new contents of the index buffer.



---

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)