<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLIOCommandBuffer/load(_:offset:size:sourceHandle:sourceHandleOffset:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLIOCommandBuffer(im)loadBuffer:offset:size:sourceHandle:sourceHandleOffset:"
  },
  "title" : "load(_:offset:size:sourceHandle:sourceHandleOffset:)"
}
-->

# load(_:offset:size:sourceHandle:sourceHandleOffset:)

Encodes a command that loads data from a file handle into a GPU buffer.

```
func load(_ buffer: any MTLBuffer, offset: Int, size: Int, sourceHandle: any MTLIOFileHandle, sourceHandleOffset: Int)
```

## Parameters

`buffer`

A buffer instance the method loads data into.

`offset`

A starting location relative to the beginning of the buffer, in bytes, the method copies data to.

`size`

The number of bytes the method loads from the file into the buffer.

`sourceHandle`

A handle to a source file.

`sourceHandleOffset`

A starting location relative to the beginning of the file, in bytes, the method copies data from.

## Discussion

---

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)