27 D3D_FEATURE_LEVEL
level;
29 D3D_DRIVER_TYPE typeAttempts[] = {
30 D3D_DRIVER_TYPE_HARDWARE,
33 const int ntypes = int(
sizeof(typeAttempts) /
sizeof(typeAttempts[0]));
35 for (
int i = 0;
i < ntypes;
i++) {
36 hr = D3D11CreateDevice(
nullptr,
39 D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_BGRA_SUPPORT,
52 qWarning(
"%s: Could not create Direct3D Device: %#lx", __FUNCTION__, hr);
56 ComPtr<IDXGIDevice1> dxgiDevice;
57 ComPtr<IDXGIAdapter> dxgiAdapter;
61 qWarning(
"%s: DXGI Device interface query failed on D3D Device: %#lx", __FUNCTION__, hr);
66 dxgiDevice->SetMaximumFrameLatency(1);
68 hr = dxgiDevice->GetAdapter(&dxgiAdapter);
70 qWarning(
"%s: Failed to probe DXGI Device for parent DXGI Adapter: %#lx", __FUNCTION__, hr);
74 hr = dxgiAdapter->GetParent(IID_PPV_ARGS(&
dxgiFactory));
76 qWarning(
"%s: Failed to probe DXGI Adapter for parent DXGI Factory: %#lx", __FUNCTION__, hr);
80 D2D1_FACTORY_OPTIONS options = {};
82#ifdef QT_D2D_DEBUG_OUTPUT
83 qDebug(
"Turning on Direct2D debugging messages");
84 options.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION;
87 hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, options,
d2dFactory.GetAddressOf());
89 qWarning(
"%s: Could not create Direct2D Factory: %#lx", __FUNCTION__, hr);
95 qWarning(
"%s: Could not create D2D Device: %#lx", __FUNCTION__, hr);
99 hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory),
102 qWarning(
"%s: Could not create DirectWrite factory: %#lx", __FUNCTION__, hr);
108 qWarning(
"%s: Could not create DirectWrite GDI Interop: %#lx", __FUNCTION__, hr);