Export (0) Print
Expand All

DXGI_SWAP_EFFECT enumeration

Options for handling pixels in a display surface after calling IDXGISwapChain1::Present1.

Syntax


typedef enum DXGI_SWAP_EFFECT { 
  DXGI_SWAP_EFFECT_DISCARD          = 0,
  DXGI_SWAP_EFFECT_SEQUENTIAL       = 1,
  DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL  = 3
} DXGI_SWAP_EFFECT;

Constants

DXGI_SWAP_EFFECT_DISCARD

Use this flag to specify the bit-block transfer (bitblt) model and to specify that DXGI discard the contents of the back buffer after you call IDXGISwapChain1::Present1. This flag is valid for a swap chain with more than one back buffer, although, applications only have read and write access to buffer 0. Use this flag to enable the display driver to select the most efficient presentation technique for the swap chain.

DXGI_SWAP_EFFECT_SEQUENTIAL

Use this flag to specify the bitblt model and to specify that DXGI persist the contents of the back buffer after you call IDXGISwapChain1::Present1. Use this option to present the contents of the swap chain in order, from the first buffer (buffer 0) to the last buffer. This flag cannot be used with multisampling.

DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL

Use this flag to specify the flip presentation model and to specify that DXGI persist the contents of the back buffer after you call IDXGISwapChain1::Present1. This flag cannot be used with multisampling.

Direct3D 11:  This enumeration value is supported starting with Windows 8.

Note  Windows Store apps must use DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL.

Remarks

This enumeration is used by the DXGI_SWAP_CHAIN_DESC structure.

This enumeration is also used by the DXGI_SWAP_CHAIN_DESC1 structure.

To use multisampling with DXGI_SWAP_EFFECT_SEQUENTIAL or DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, you must perform the multisampling in a separate render target. For example, create a multisampled texture by calling ID3D11Device::CreateTexture2D with a filled D3D11_TEXTURE2D_DESC structure (BindFlags member set to D3D11_BIND_RENDER_TARGET and SampleDesc member with multisampling parameters). Next call ID3D11Device::CreateRenderTargetView to create a render-target view for the texture, and render your scene into the texture. Finally call ID3D11DeviceContext::ResolveSubresource to resolve the multisampled texture into your non-multisampled swap chain.

The primary difference between presentation models is how back-buffer contents get to the Desktop Window Manager (DWM) for composition. In the bitblt model, which is used with the DXGI_SWAP_EFFECT_DISCARD and DXGI_SWAP_EFFECT_SEQUENTIAL values, contents of the back buffer get copied into the redirection surface on each call to IDXGISwapChain1::Present1. In the flip model, which is used with the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL value, all back buffers are shared with the DWM. Therefore, the DWM can compose straight from those back buffers without any additional copy operations. In general, the flip model is the more efficient model. The flip model also provides more features, such as enhanced present statistics.

When you call IDXGISwapChain1::Present1 on a flip model swap chain (DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL) with 0 specified in the SyncInterval parameter, IDXGISwapChain1::Present1's behavior is the same as the behavior of Direct3D 9Ex's IDirect3DDevice9Ex::PresentEx with D3DSWAPEFFECT_FLIPEX and D3DPRESENT_FORCEIMMEDIATE. That is, the runtime not only presents the next frame instead of any previously queued frames, it also terminates any remaining time left on the previously queued frames.

Regardless of whether the flip model is more efficient, an application still might choose the bitblt model because the bitblt model is the only way to mix GDI and DirectX presentation. In the flip model, the application must create the swap chain with DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE, and then must use GetDC on the back buffer explicitly. After the first successful call to IDXGISwapChain1::Present1 on a flip-model swap chain, GDI no longer works with the HWND that is associated with that swap chain, even after the destruction of the swap chain. This restriction even extends to methods like ScrollWindowEx.

For more info about the flip-model swap chain and optimizing presentation, see Enhancing presentation with the flip model, dirty rectangles, and scrolled areas.

Requirements

Header

DXGI.h

See also

DXGI Enumerations

 

 

Community Additions

ADD
Show:
© 2014 Microsoft