IDXGIFactory2::CreateSwapChainForComposition Method

Creates a swap chain that you can use to send Direct3D content into the DirectComposition API or the Windows.UI.Xaml framework to compose in a window.

Syntax

public:
HRESULT CreateSwapChainForComposition(
         IGraphicsUnknown *pDevice,
         const DXGI_SWAP_CHAIN_DESC1 *pDesc,
         IDXGIOutput *pRestrictToOutput,
         IDXGISwapChain1 **ppSwapChain
)  

Parameters

pDevice
Type: IGraphicsUnknown *

[in] A pointer to the Direct3D device for the swap chain, as IGraphicsUnknown. This parameter cannot be NULL. Software drivers, like D3D_DRIVER_TYPE_REFERENCE, are not supported for composition swap chains.

pDesc
Type: DXGI_SWAP_CHAIN_DESC1 *

[in] A pointer to a DXGI_SWAP_CHAIN_DESC1 structure for the swap-chain description. This parameter cannot be NULL.

You must specify the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL value in the SwapEffect member of DXGI_SWAP_CHAIN_DESC1 because CreateSwapChainForComposition supports only flip presentation model.

You must also specify the DXGI_SCALING_STRETCH value in the Scaling member of DXGI_SWAP_CHAIN_DESC1.

pRestrictToOutput
Type: IDXGIOutput *

[in, optional] A pointer to the IDXGIOutput interface for the output to restrict content to. You must also pass the DXGI_PRESENT_RESTRICT_TO_OUTPUT flag in a IDXGISwapChain1::Present1 call to force the content to appear blacked out on any other output. If you want to restrict the content to a different output, you must create a new swap chain. However, you can conditionally restrict content based on the DXGI_PRESENT_RESTRICT_TO_OUTPUT flag.

Set this parameter to NULL if you don’t want to restrict content to an output target.

ppSwapChain
Type: IDXGISwapChain1 **

[out] A pointer to a variable that receives a pointer to the IDXGISwapChain1 interface for the swap chain that CreateSwapChainForComposition creates.

Return value

Type: HRESULT 

Remarks

Creating a swap chain that utilizes both High Dynamic Range (HDR) and 4k output is fully supported on Xbox One X hardware, but not on Xbox One S. Attempting to create such a swap chain on Xbox One S does not return an error code, but will result in incorrect output. For example, don’t create a swap chain with the following swap chain description on Xbox One S:

C++

// Create swap chain buffer with 4K + HDR
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {};swapChainDesc.Width = 3840; swapChainDesc.Height = 2160;swapChainDesc.Format = DXGI_FORMAT_R10G10B10A2_UNORM;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = 3;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;swapChainDesc.Flags = DXGIX_SWAP_CHAIN_FLAG_COLORIMETRY_;   

Requirements

Header: Declared in d3d11_x.h (dxgi1_2.h on other Windows platforms).

Library: Use d3d11_x.lib (dxgi.lib on other Windows platforms).

See also

IDXGIFactory2

IDXGIFactory2 Members