Home

swapchain

A swap chain is a collection of buffers used to present rendered images to a display, enabling a separation between rendering and presentation. It allows an application to render frames at its own pace while the display updates at a fixed rate, helping reduce tearing and stutter.

A swap chain typically contains a front buffer, which is currently being displayed, and one or more

Configuration of a swap chain usually includes the image format, dimensions, usage flags, and a present mode

Rendering with a swap chain follows a typical cycle: acquire a back buffer from the swap chain,

Different graphics APIs expose the swap chain concept with variations. In DirectX, an IDXGISwapChain manages the

back
buffers,
which
are
rendered
to.
When
a
frame
is
ready,
the
swap
operation
presents
a
back
buffer
by
swapping
it
with
the
front
buffer
or
by
a
similar
mechanism,
depending
on
the
graphics
API
and
mode.
Modern
graphics
pipelines
commonly
use
double
or
triple
buffering
to
balance
latency
and
throughput.
or
swap
effect
that
determines
how
the
swap
is
performed
and
whether
vertical
synchronization
is
used.
Present
modes
can
favor
immediate
presentation,
wait
for
VSync,
or
use
techniques
like
mailbox
or
FIFO
to
reduce
latency
or
tearing.
render
the
frame
to
that
buffer,
synchronize
to
ensure
rendering
completes,
and
then
present
the
buffer
back
to
the
display.
Proper
synchronization
with
semaphores
or
fences
is
important
to
avoid
overwriting
in-flight
buffers.
If
the
window
or
surface
is
resized,
the
swap
chain
is
often
recreated
with
new
dimensions.
buffers
and
is
presented
via
Present.
In
Vulkan,
a
swap
chain
comprises
VkImages
and
is
presented
with
vkQueuePresentKHR.
In
OpenGL,
glSwapBuffers
swaps
the
front
and
back
buffers
of
the
current
context.