SwapChain is a special render buffer, which is used as a final rendering target to output to display. Each time a frame has been completed in Buffer1, it becomes Buffer2 to be displayed on the output. The previous Buffer2 becomes Buffer1 to create the next frame. This constant change between back and front buffer is called swapping or flipping.
You can find the SwapChain Class in DXGI. The buffer generation is simple:
'SwapChain ' Private _SwapChain As DXGI.SwapChain ... _SwapChain = New DXGI.SwapChain(Factory, Device, _SwapChainDescription) ...
Default Swapchain Description
This function creates a default description for the SwapChain buffer. This should be easy to create a SwapChain on each device.
'Default SwapChain Description ' Public Shared Function GetDefaultSwapChainDescrition(C As System.Windows.Forms.Control) As DXGI.SwapChainDescription Dim SwapChainDesc As New DXGI.SwapChainDescription Dim ModeDesc As New DXGI.ModeDescription Dim SampleDesc As New DXGI.SampleDescription With ModeDesc .Format = DXGI.Format.R8G8B8A8_UNorm .RefreshRate = New Rational(60, 1) .Scaling = DXGI.DisplayModeScaling.Unspecified .ScanlineOrdering = DXGI.DisplayModeScanlineOrdering.Unspecified .Width = C.Height .Height = C.Width End With With SampleDesc .Count = 1 .Quality = 0 End With With SwapChainDesc .ModeDescription = ModeDesc .SampleDescription = SampleDesc .BufferCount = 1 .Flags = DXGI.SwapChainFlags.None .IsWindowed = True .OutputHandle = C.Handle .SwapEffect = DXGI.SwapEffect.Discard .Usage = DXGI.Usage.RenderTargetOutput End With Return SwapChainDesc End Function
If you want to render on more then one Control, you need to create several SwapChain buffers. It should be noted that all SwapChains are using the same Factory and Device.
Multiple Swapchain Rendering