Game Development Reference
This method is used to re-create a swap chain after a device reset has occurred.
First, the old swap chain is destroyed, and then a new swap chain with the new ren-
der target size is created.
private void ResetSwapChain(SwapChainInstance instance)
if (instance != null)
instance.SwapChain = new SwapChain(_device,
This method is simply used to release the memory associated with a Direct3D
private void DestroySwapChain(SwapChain swapChain)
if (swapChain != null)
This method is very important because it begins the rendering process for a spe-
cific swap chain that is referenced by a unique identifier. Notice the ready flag that
breaks out of rendering if its value is set to false . This flag is used to prevent errors
from occurring if the device is invalid.
public void BeginSwapChainRender(int id)
SwapChainInstance instance = FindSwapChainInstance(id);
if (instance != null && instance.SwapChain != null)
_activeSwapChain = instance;