         }
     }
     
-    func prepareBufferPool(device: MTLDevice, bytecount: Int, options: MTLResourceOptions = .CPUCacheModeDefaultCache, createWith: (Self) -> Buffer) {
+    func prepareBufferPool(device: MTLDevice, bytecount: Int, options: MTLResourceOptions = .CPUCacheModeDefaultCache, createWith: (Self) -> EncodableBuffer) {
         buffersSemaphore = dispatch_semaphore_create(buffersCount)
         for _ in 0...buffersCount-1 {
             let buffer = createBuffer(device, bytecount: self.bytecount, options: options, createWith: createWith)

    var buffersCount:Int
    var buffersIndex:Int = 0
    var buffersSemaphore:dispatch_semaphore_t?
    var buffers: [Buffer] = []
    
    required init(device:MTLDevice, bytecount:Int, buffersCount:Int = 1, options: MTLResourceOptions = .StorageModeManaged) {
        self.bytecount = bytecount
        self.buffersCount = buffersCount
        prepareBuffer(device, options: options)
    }
    
    func prepareBuffer(device:MTLDevice, options:MTLResourceOptions) {
        let singleBuffer = BaseBuffer()
        singleBuffer.bytecount = bytecount
        singleBuffer.prepareBuffer(device, options: options)
        buffers = [singleBuffer]

    var buffersCount:Int { get set }
    var buffersIndex:Int { get set }
    var buffersSemaphore:dispatch_semaphore_t? { get set }
    var buffers: [EncodableBuffer] { get set } // private
    
    // N.B. must deinit resources!
    
    init(device: MTLDevice, bytecount: Int, buffersCount: Int, options: MTLResourceOptions)
    func prepareBufferPool(device: MTLDevice, bytecount: Int, options: MTLResourceOptions)
    func prepareBufferPool(device: MTLDevice, bytecount: Int, options: MTLResourceOptions, createWith: (Self) -> EncodableBuffer)
    func createBuffer(device: MTLDevice, bytecount: Int, options: MTLResourceOptions) -> EncodableBuffer
    func createBuffer(device: MTLDevice, bytecount: Int, options: MTLResourceOptions, createWith: (Self) -> EncodableBuffer) -> EncodableBuffer
    func releaseBuffer(numBuffers:Int)
    
    func getBuffer() -> EncodableBuffer
}

extension BufferPool {
