---
title: "load(_:slice:level:size:sourceBytesPerRow:sourceBytesPerImage:destinationOrigin:sourceHandle:sourceHandleOffset:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtliocommandbuffer/load(_:slice:level:size:sourcebytesperrow:sourcebytesperimage:destinationorigin:sourcehandle:sourcehandleoffset:)"
---

# load(_:slice:level:size:sourceBytesPerRow:sourceBytesPerImage:destinationOrigin:sourceHandle:sourceHandleOffset:)

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

## Declaration

```swift
func load(_ texture: any MTLTexture, slice: Int, level: Int, size: MTLSize, sourceBytesPerRow: Int, sourceBytesPerImage: Int, destinationOrigin: MTLOrigin, sourceHandle: any MTLIOFileHandle, sourceHandleOffset: Int)
```

## Parameters

- `texture`: A texture instance the method loads data into.
- `slice`: A slice within the texture.
- `level`: A level within the texture.
- `size`: The region of the texture the method copies to.
- `sourceBytesPerRow`: The number of bytes in a row of data from the source file.
- `sourceBytesPerImage`: The number of bytes in an image from the source file.
- `destinationOrigin`: A starting location within the texture the method copies data to.
- `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(_:offset:size:sourceHandle:sourceHandleOffset:)](metal/mtliocommandbuffer/load(_:offset:size:sourcehandle:sourcehandleoffset:).md)
- [loadBytes(_:size:sourceHandle:sourceHandleOffset:)](metal/mtliocommandbuffer/loadbytes(_:size:sourcehandle:sourcehandleoffset:).md)
