Contents

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

Creates a new lightweight texture view of a buffer.

Declaration

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

Parameters

  • buffer:

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