Efficiently copying Swift Array to memory buffer for iOS Metal
问题 I am writing an iOS application using Apple's new Metal framework. I have an array of Matrix4 objects (see Ray Wenderlich's tutorial) that I need to pass in to a shader via the MTLDevice.newBufferWithLength() method. The Matrix4 object is leveraging Apple's GLKit (it contains a GLKMatrix4 object). I'm leveraging instancing with the GPU calls. I will later change this to a struct which includes more data per instance (beyond just the Matrix4 object. How can I efficiently copy the array of