我想在我的 Direct2D 应用程序中实现 NVIDIA Reflex。我有一个 ID2D11Device,但 NvAPI_D3D_SetSleepMode 需要 Direct3DDevice。
我知道Direct2D是基于Direct3D的。所以,我认为我可以从 Direct2D Device 获取 Direct3D Device。但是,我找不到任何解决方案。
如何从Direct2D设备获取Direct3D设备?如果我误解了概念,请让我知道正确的概念。谢谢。
当您创建
ID2D1Device
时,您必须从 Direct3D 设备开始。使用那个。
// 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
)
);