title: Called CAMetalLayer nextDrawable earlier than needed
body: <p>The GPU frame capture is warning:</p>
  
  <pre><code>your application called CAMetalLayer nextDrawable earlier than needed
  </code></pre>
  
  <p>I am calling <code>present(drawable)</code> after all my other GPU calls have been made, directly before committing the command buffer</p>
  
  <pre><code>guard let commandBuffer = commandQueue.makeCommandBuffer(),
  let computeBuffer = commandQueue.makeCommandBuffer(),
  let descriptor = view.currentRenderPassDescriptor else { return }
  
  ...
  
  //First run the compute kernel
  guard let computeEncoder = computeBuffer.makeComputeCommandEncoder() else { return }
  computeEncoder.setComputePipelineState(computePipelineState)
  
  dispatchThreads(particleCount: particleCount)
  
  computeEncoder.endEncoding()
  computeBuffer.commit()
  
  //I need to wait here because I need values from a computed buffer first 
  //and also why I am not just using a single pipeline descriptor
  computeBuffer.waitUntilCompleted() 
  
  //Next render computed particles with vertex shader to a texture
  let renderEncoder = commandBuffer.makeRenderCommandEncoder(descriptor: descriptor0)!
  renderEncoder.setRenderPipelineState(renderPipelineState)
  ...
  renderEncoder.endEncoding()
  
  //Draw texture (created above) using vertex shader:
  let renderTexture = commandBuffer.makeRenderCommandEncoder(descriptor: descriptor)
  renderTexture?.setRenderPipelineState(renderCanvasPipelineState)
  ...
  renderTexture?.endEncoding()
  
  //Finally present drawable and commit command buffer:
  guard let drawable = view.currentDrawable else { return }
  commandBuffer.present(drawable)
  commandBuffer.commit()
  </code></pre>
  
  <p>I don't see how it is possible to request the currentDrawable any later. Am I doing something wrong or sub-optimal?</p>
  
  <p>I started looking into the issue because most frames (basically doing the same thing), the wait for the current drawable is about 3-10ms. Occasionally the wait is 35-45ms.</p>
  
  <p>I see a number of recommendations to use <code>presentDrawable</code> instead of <code>present</code>, but that does not seem to be an option with Swift.</p>
  
  <p>Is there any way to request the current drawable when it is needed and make the warning go away?</p>