interop::CreateDirect3D11DeviceFromDXGIDevice function (windows.graphics.directx.direct3d11.interop.h)

Creates an instance of IDirect3DDevice from an IDXGIDevice.

Syntax

HRESULT CreateDirect3D11DeviceFromDXGIDevice(
  [in]  IDXGIDevice  *dxgiDevice,
  [out] IInspectable **graphicsDevice
);

Parameters

[in] dxgiDevice

Type: IDXGIDevice*

The IDXGIDevice to create the Direct3DDevice from.

[out] graphicsDevice

Type: IInspectable**

A Direct3DDevice instance that wraps the DXGIDevice.

Return value

Type: HRESULT

If the function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

While we recommend C++/WinRT, if you're using C++/CX then you should call CreateDirect3DDevice instead of CreateDirect3D11DeviceFromDXGIDevice. If you're using WRL then CreateDirect3D11DeviceFromDXGIDevice can be used as shown in this code example.

using namespace Microsoft::WRL;
ComPtr<ABI::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice> device;
ComPtr<IInspectable> inspectableSurface;
If (SUCCEEDED(CreateDirect3D11DeviceFromDXGIDevice(dxgiDevice, &inspectableSurface))
{
    hr = inspectableSurface.As(&device);
}

Requirements

Requirement Value
Target Platform Windows
Header windows.graphics.directx.direct3d11.interop.h
Library D3D11.lib
DLL D3D11.dll

See also

Core functions