     var bytecount:Int { get set }
     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!

    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()
    
    func getBuffer() -> EncodableBuffer
}

//TODO: must dispatch_semaphore_signal from view render() !!!

extension BufferPool {
    //    var bytecount:Int
    //    var availableBuffersIndex:Int = 0
    //    var availableBuffersSemaphore:dispatch_semaphore_t?
    //    internal var buffers: [Buffer] = []
    //    private var inflightBuffersCount:Int
    
    func prepareBufferPool(device: MTLDevice, bytecount: Int, options: MTLResourceOptions = .CPUCacheModeDefaultCache) {
        buffersSemaphore = dispatch_semaphore_create(buffersCount)
        for _ in 0...buffersCount-1 {
            let buffer = createBuffer(device, bytecount: self.bytecount, options: options)
            buffers.append(buffer)

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