---
title: "setTextureView(buffer:descriptor:offset:bytesPerRow:index:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtltextureviewpool/settextureview(buffer:descriptor:offset:bytesperrow:index:)"
---

# setTextureView(buffer:descriptor:offset:bytesPerRow:index:)

Creates a new lightweight texture view of a buffer.

## Declaration

```swift
func setTextureView(buffer: any MTLBuffer, descriptor: MTLTextureDescriptor, offset: Int, bytesPerRow: Int, index: Int) -> MTLResourceID
```

## Parameters

- `buffer`: An doc://com.apple.metal/documentation/Metal/MTLBuffer instance for which to create a new texture view.
- `descriptor`: A descriptor specifying properties of the texture view to create.
- `offset`: A byte offset, within the buffer parameter, at which the data for the texture view starts.
- `bytesPerRow`: The number of bytes between adjacent rows of pixels in the source buffer’s memory.
- `index`: An index of a slot in the table into which this method writes the new texture view.

## Return Value

Return Value The MTLResourceID of a new buffer view in this pool.

## Discussion

Discussion This method creates a lightweight texture view over a buffer, according to a descriptor you provide. It then associates the texture view with a slot in this texture view pool at the index you specify.
