Contents

setBytes(_:length:index:)

Copies data directly to the GPU to populate an entry in the buffer argument table.

Declaration

func setBytes(_ bytes: UnsafeRawPointer, length: Int, index: Int)

Parameters

  • bytes:

    A pointer to where the data to copy starts.

  • length:

    The number of bytes to copy.

  • index:

    The index the data binds to in the argument table.

Discussion

This method allows Metal to copy data efficiently onto the GPU without the need for your own buffer. Binding data directly can improve performance, especially when making many small allocations.

See Also

Binding raw bytes