The documentation CVMetalTextureCacheCreateTextureFromImage has the following "Important" note:
This function increments the use count of the image buffer, but not the IOSurface buffer. The Core Video Metal texture owns this IOSurface buffer. Therefore, you must maintain a strong reference to either the image buffer or the Metal texture until the Metal rendering completes. Consider using the MTLCommandBufferHandler for this purpose.
However, when using CFGetRetainCount on the CVPixelBufferRef the count remains the same.
Furthermore, the MTLTexture aquired from the returned CVMetalTextureRef has a strong reference to the IOSurfaceRef, so unless when using commandBufferWithUnretainedReferences there should be no risk that the backing storage will be discarded before the command buffer completes.
So what does this note mean? Am I responsible for decrementing the use count of the passed CVPixelBufferRef? Do I even need to do something with the underlying IOSurfaceRef?