Creates a swap chain for a window handle.
public:
HRESULT CreateSwapChainForHwnd(
IGraphicsUnknown *pDevice,
HWND hWnd,
const DXGI_SWAP_CHAIN_DESC1 *pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pFullscreenDesc,
IDXGIOutput *pRestrictToOutput,
IDXGISwapChain1 **ppSwapChain
)
pDevice
Type: IGraphicsUnknown *
[in] The device, as a pointer to IGraphicsUnknown.
hWnd
Type: HWND
[in] The window handle.
pDesc
Type: DXGI_SWAP_CHAIN_DESC1 *
[in] The description of the swap chain, as a pointer to DXGI_SWAP_CHAIN_DESC1.
pFullscreenDesc
Type: DXGI_SWAP_CHAIN_FULLSCREEN_DESC *
[in, optional] The description of the swap chain fullscreen, as a pointer to DXGI_SWAP_CHAIN_FULLSCREEN_DESC.
pRestrictToOutput
Type: IDXGIOutput *
[in, optional] The output, if restricting to output, as a pointer to IDXGIOutput.
ppSwapChain
Type: IDXGISwapChain1 **
[out] The swap chain, as a pointer to pointer to IDXGISwapChain1.
Type: HRESULT
A DXGI_ERROR return code. S_OK indicates that the interface is supported, otherwise DXGI_ERROR_UNSUPPORTED is returned.
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_;
Header: Declared in d3d11_x.h (dxgi1_2.h on other Windows platforms).
Library: Use d3d11_x.lib (dxgi.lib on other Windows platforms).