Function CVMetalBufferCacheCreateBufferFromImage

Source
pub unsafe extern "C-unwind" fn CVMetalBufferCacheCreateBufferFromImage(
    allocator: Option<&CFAllocator>,
    buffer_cache: &CVMetalBufferCache,
    image_buffer: &CVImageBuffer,
    buffer_out: NonNull<*mut CVMetalBuffer>,
) -> CVReturn
Available on crate features CVBuffer and CVImageBuffer and CVMetalBuffer and CVReturn and CVMetalBufferCache only.
Expand description

Creates a CVMetalBuffer object from an existing CVImageBuffer

Parameter allocator: The CFAllocatorRef to use for allocating the CVMetalBuffer object. May be NULL.

Parameter bufferCache: The buffer cache object that will manage the buffer.

Parameter buffer: The CVImageBuffer that you want to create a CVMetalBuffer from.

Parameter bufferOut: The newly created buffer object will be placed here.

Returns: Returns kCVReturnSuccess on success

Creates or returns a cached CVMetalBuffer object mapped to the CVImageBuffer. This creates a live binding between the CVImageBuffer and underlying CVMetalBuffer buffer object.

IMPORTANT NOTE: Clients should retain CVMetalBuffer objects until they are done using the images in them. Retaining a CVMetalBuffer is your way to indicate that you’re still using the image in the buffer, and that it should not be recycled yet.