newBuffer(from:data:type:)
Creates a new buffer containing the specified data in the specified zone.
Declaration
func newBuffer(from zone: (any MDLMeshBufferZone)?, data: Data, type: MDLMeshBufferType) -> (any MDLMeshBuffer)?Parameters
- zone:
A pool of memory for related allocations, as returned by the Newzone(_:) method.
- data:
The initial data to store in the buffer. Implementations of this protocol typically copy this data.
- type:
Use Vertex to create a buffer for a mesh’s vertex attribute data, or Index to create a buffer for a submesh’s index data.
Return Value
A new memory buffer for mesh data.
Discussion
Use this method when making multiple related allocations that should share the same memory pool.