Contents

CVMetalBufferCacheCreateBufferFromImage(_:_:_:_:)

Declaration

func CVMetalBufferCacheCreateBufferFromImage(_ allocator: CFAllocator?, _ bufferCache: CVMetalBufferCache, _ imageBuffer: CVImageBuffer, _ bufferOut: UnsafeMutablePointer<CVMetalBuffer?>) -> CVReturn

Parameters

  • allocator:

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

  • bufferCache:

    The buffer cache object that will manage the buffer.

  • bufferOut:

    The newly created buffer object will be placed here.

Return Value

Returns kCVReturnSuccess on success

Discussion

Creates a CVMetalBuffer object from an existing CVImageBuffer

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.

See Also

Functions