wgpu: How to avoid Timeout errors

My tutorial will occasionally encounter a SwapChainError::Timeout during normal execution. Currently I’m just kidding the error out, but I was wondering is there a way to avoid this error? Is there someway to sync the simulation with the refresh rate of the screen?

This is related to an issue in my tutorial: https://github.com/sotrh/learn-wgpu/issues/195

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 17 (6 by maintainers)

Most upvoted comments

Running from the latest master (e5142b3c) eliminates the OOM errors, so setting PresentMode::Mailbox or PresentMode::Immediate runs without error. PresentMode::Fifo is the same as before with timeout errors but no OOM errors.

I can try more things locally if that’d be helpful.

The timeout could happen if our back-pressue doesn’t work as expected. I.e. get_current_frame doesn’t actually make CPU wait for GPU to process the old frame.