ISwapChainPanelNative::SetSwapChain method (windows.ui.xaml.media.dxinterop.h)

Sets the DirectX swap chain for SwapChainPanel.

Syntax

HRESULT SetSwapChain(
  [in] [opt] IDXGISwapChain *swapChain
);

Parameters

[in] [opt] swapChain

A configured IDXGISwapChain.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This method has to be called on the UI thread the parent SwapChainPanel belongs to. If called on another thread, it will return 0x8001010E (RPC_E_WRONG_THREAD, "The application called an interface that was marshaled for a different thread").

When called, this method will increment the reference count for the input IDXGISwapChain that is passed as input. This will in turn cause the reference count to the target graphics device in use (eg. an ID3D12Device) to be incremented as well. In order to ensure these references are released immediately when the panel is no longer needed, you can call SetSwapChain again passing a null pointer. This will ensure that all additional references to the object graph starting from the input IDXGISwapChain that had been added by the SwapChainPanel instance will be removed. This is especially important to ensure the device in use can properly be released, for instance to recover from device lost scenarios.

Requirements

Requirement Value
Minimum supported client Windows 8.1 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 R2 [desktop apps | UWP apps]
Target Platform Windows
Header windows.ui.xaml.media.dxinterop.h
DLL Windows.UI.Xaml.dll

See also

ISwapChainPanelNative