<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLTextureViewPool/setTextureView(buffer:descriptor:offset:bytesPerRow:index:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLTextureViewPool(im)setTextureViewFromBuffer:descriptor:offset:bytesPerRow:atIndex:"
  },
  "title" : "setTextureView(buffer:descriptor:offset:bytesPerRow:index:)"
}
-->

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

Creates a new lightweight texture view of a buffer.

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

## Parameters

`buffer`

An [`MTLBuffer`](/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

The [`MTLResourceID`](/documentation/Metal/MTLResourceID) of a new buffer view in this pool.

## 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.

---

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)