setMeshBytes(_:length:index:)
Creates a buffer from bytes and assigns it to an entry in the mesh shader argument table.
Declaration
func setMeshBytes(_ bytes: UnsafeRawPointer, length: Int, index: Int)Parameters
- bytes:
A pointer to argument data the method copies to an Mtlbuffer and assigns to an entry in the mesh shader argument table for buffers.
- length:
The number of bytes the method copies from the
bytespointer. - index:
An integer that represents the entry in the mesh shader argument table for buffers that stores a record of the Mtlbuffer the method creates from
bytes.
Discussion
The method is equivalent to creating an MTLBuffer instance that contains the same data as bytes and calling the setMeshBuffer(_:offset:index:) method. However, this method avoids the overhead of creating a buffer to store your data; instead, Metal manages the data.
For data that’s more than 4 KB, create an MTLBuffer instance and pass it to setMeshBufferOffset(_:index:).