I'm trying to get the C++ D3D1211On12 example working using windows-rs, but I can't get the call to D3D11On12CreateDevice to return a valid ID3D11Device.
The code I'm using is:
fn create_d11_device(pdevice: &ID3D12Device) -> Result<Option<*mut Option<windows::Win32::Graphics::Direct3D11::ID3D11Device>>> {
unsafe {
let ppdevice:Option<*mut Option<ID3D11Device>> = None;
let ppimmediatecontext: Option<*mut Option<ID3D11DeviceContext>> = None;
D3D11On12CreateDevice(pdevice, D3D11_CREATE_DEVICE_BGRA_SUPPORT.0, None, None, 0,
ppdevice, ppimmediatecontext, None )?;
Ok(ppdevice)
}
}
Has anybody managed to this this call working?
The correct way to write this function is like this: