<!--
{
  "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/loadBytes(_:size:sourceHandle:sourceHandleOffset:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLIOCommandBuffer(im)loadBytes:size:sourceHandle:sourceHandleOffset:"
  },
  "title" : "loadBytes(_:size:sourceHandle:sourceHandleOffset:)"
}
-->

# loadBytes(_:size:sourceHandle:sourceHandleOffset:)

Encodes a command that loads data from a file handle into CPU-accessible memory buffer.

```
func loadBytes(_ pointer: UnsafeMutableRawPointer, size: Int, sourceHandle: any MTLIOFileHandle, sourceHandleOffset: Int)
```

## Parameters

`pointer`

A pointer to memory the method loads data into.

`size`

The number of bytes the method loads from the file.

`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)