Skip to main content

Module swapchain

Module swapchain 

Source
Expand description

Swap chain implementation for double-buffered rendering.

A swap chain manages two framebuffers (front and back) and coordinates DMA transfers to eliminate visual tearing and improve performance.

§Architecture

  • Back buffer: The CPU renders into this buffer at all times.
  • Front buffer: Owned by either an in-flight DMA transfer or the swap chain itself while idle.
  • Swap: When rendering completes, present() recovers the front buffer (waiting for any in-flight DMA), swaps it with the back buffer, and hands the new front to the backend to start the next transfer.

§Safety

The front framebuffer is moved into the DmaTransfer token returned by the backend. The compiler enforces that nobody can write to it until DmaTransfer::wait returns it, eliminating the data race that a borrow-based API cannot prevent.

Structs§

SwapChain
Double-buffered swap chain for tear-free rendering.

Type Aliases§

StandardSwapChain
Type alias for SwapChain backed by EndianCorrectedBuffer.