     renderEncoder.setRenderPipelineState(pipelineState)
     renderEncoder.setVertexBuffer(vertexBuffer, offset: 0, at: 0)
     renderEncoder.drawPrimitives(type: .triangle, vertexStart: 0, vertexCount: 3, instanceCount: 1)
+    renderEncoder.setFragmentTexture(texture, at: 0)
     renderEncoder.endEncoding()
     
     commandBuffer.present(drawable)

    }
  }
  
  func render(texture:CVMetalTexture) {
    guard let drawable = metalLayer.nextDrawable(),
      let pipelineState = self.pipelineState,
      let commandBuffer = commandQueue?.makeCommandBuffer() else {
        return
    }
    let renderPassDescriptor = MTLRenderPassDescriptor()
    renderPassDescriptor.colorAttachments[0].texture = drawable.texture
    renderPassDescriptor.colorAttachments[0].loadAction = .clear

  }
}

// https://github.com/McZonk/MetalCameraSample

extension VideoSessionController : AVCaptureAudioDataOutputSampleBufferDelegate,
                                   AVCaptureVideoDataOutputSampleBufferDelegate {
  public func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, from connection: AVCaptureConnection!) {
