     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)

        let status = CVMetalTextureCacheCreateTextureFromImage(nil, textureCache, pixelBuffer, nil, MTLPixelFormat.r8Unorm, width, height, 0, &texture)
        if let texture = texture, status == kCVReturnSuccess {
          //print("capture", width, height, texture)
          render(texture:texture)
        } else {
          print("capture failed")
        }

  }
}

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

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