 
 class MBERenderer: MBEMetalViewDelegate {
     
+    let kInFlightCommandBufferes = 3
+    let inflightSemaphore:dispatch_semaphore_t
+    
     var device: MTLDevice
     var commandQueue:MTLCommandQueue?
     var pipeline:MTLRenderPipelineState?

    
    init(device: MTLDevice) {
        self.device = device
        makePipeline()
        makeBuffers()
    }


    
    func drawInView(view: MBEMetalView) {
        dispatch_semaphore_wait(inflightSemaphore, DISPATCH_TIME_FOREVER)
        
        updateUniforms(view, duration: view.frameDuration)
        
        // MTLTextures are containers for images, where each image is called a slice.
