---
title: "load(_:offset:size:sourceHandle:sourceHandleOffset:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtliocommandbuffer/load(_:offset:size:sourcehandle:sourcehandleoffset:)"
---

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

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

## Declaration

```swift
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.

## See Also

### Loading assets

- [load(_:slice:level:size:sourceBytesPerRow:sourceBytesPerImage:destinationOrigin:sourceHandle:sourceHandleOffset:)](metal/mtliocommandbuffer/load(_:slice:level:size:sourcebytesperrow:sourcebytesperimage:destinationorigin:sourcehandle:sourcehandleoffset:).md)
- [loadBytes(_:size:sourceHandle:sourceHandleOffset:)](metal/mtliocommandbuffer/loadbytes(_:size:sourcehandle:sourcehandleoffset:).md)
