简体   繁体   中英

Convert ID2D1Device1 to ID3D11Device

I want to implement NVIDIA Reflex to My Direct2D application. I have a ID2D11Device, but NvAPI_D3D_SetSleepMode requires Direct3DDevice.

I know that Direct2D is based on Direct3D. So, I think that I can acquire Direct3D Device from Direct2D Device. But, I can't find any solution.

How to get Direct3D device from Direct2D device? If I misunderstand conceptions, please let me make know a right concepts. Thanks.

When you created the ID2D1Device , you had to start with a Direct3D device. Use that one.

// Obtain the underlying DXGI device of the Direct3D11.1 device.
    DX::ThrowIfFailed(
        m_d3dDevice.As(&dxgiDevice)
        );

    // Obtain the Direct2D device for 2-D rendering.
    DX::ThrowIfFailed(
        m_d2dFactory->CreateDevice(dxgiDevice.Get(), &m_d2dDevice)
        );

    // And get its corresponding device context object.
    DX::ThrowIfFailed(
        m_d2dDevice->CreateDeviceContext(
            D2D1_DEVICE_CONTEXT_OPTIONS_NONE,
            &m_d2dContext
            )
        );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM