3 ms·
> My understanding (and I would be very happy for any clarifications/corrections!) is that you must use Metal Buffers (MTLBuffer) with the Apple Silicon GPU. If
by fathyb 4y ago
> My understanding (and I would be very happy for any clarifications/corrections!) is that you must use Metal Buffers (MTLBuffer) with the Apple Silicon GPU. If your data isn't already in a Metal Buffer (why would it be?), you have to do a copy into a buffer (but it will be extremely fast).
You have to use Metal Buffers, but you don't have to copy, as long as it is properly page aligned [0]. The YUV data from both camera is for example.
> PS - the very basic ARM Neon stuff that the M1 supports is insanely fast and gets even better when you use multiple threads.
It is, these chips have so much to give!
[0]: https://developer.apple.com/documentation/metal/mtldevice/1433382-newbufferwithbytesnocopy https://developer.apple.com/documentation/metal/mtldevice/14...
- Kon-Peki 4y agoI have just been nerd sniped. EDIT - any hints on how to get a plain-old Swift array to be allocated in a conforming alignment (4096 bytes on Apple Silicon)?
- saagarjha 4y agoIt's not supported, unfortunately. But you can call posix_memalign and work with it as an UnsafeBufferPointer with a similar API.