How To: Create a Swap Chain

This topic show how to create a swap chain that encapsulates two or more buffers that are used for rendering and display. They usually contain a front buffer that is presented to the display device and a back buffer that serves as the render target. After the immediate context is done rendering to the back buffer, the swap chain presents the back buffer by swapping the two buffers.

The swap chain defines several rendering characteristics including:

  • The size of the render area.
  • The display refresh rate.
  • The display mode.
  • The surface format.

Define the characteristics of the swap chain by filling in a DXGI_SWAP_CHAIN_DESC structure and initializing an IDXGISwapChain interface. Initialize a swap chain by calling IDXGIFactory::CreateSwapChain or D3D11CreateDeviceAndSwapChain.

Create a device and a swap chain

To initialize a device and swap chain, use one of the following two functions:

Devices

How to Use Direct3D 11