C++ How to call CreateDeviceContext for ID2D1Device3

  c++, direct2d, directx, game-engine, graphics

I have a graphics engine using ID2D1Device1, but I cant seem to alter it to use ID2D1Device3.
Does anyone know of an example anywhere?
Here is my core code:

Microsoft::WRL::ComPtr<ID2D1Device1> dev2d;
Microsoft::WRL::ComPtr<ID2D1DeviceContext3> devCon3;
Microsoft::WRL::ComPtr<ID3D11Device> dev;               // the actual Direct3D device
Microsoft::WRL::ComPtr<ID3D11DeviceContext> devCon;     // device context
Microsoft::WRL::ComPtr<IDXGIDevice> dxgiDevice;// to get the DXGI factory
Microsoft::WRL::ComPtr<IDXGIAdapter> dxgiAdapter;// to get the DXGI factory
Microsoft::WRL::ComPtr<IDXGIFactory> dxgiFactory;// to get the DXGI factory
Microsoft::WRL::ComPtr<IDXGISwapChain> swapChain;       // the swap chain
    D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, 0, createDeviceFlags, NULL, 0, D3D11_SDK_VERSION, &dev, &featureLevel, &devCon);
    Hres = dev.As(&dxgiDevice);
    Hres = dxgiDevice->GetAdapter(dxgiAdapter.GetAddressOf());
    Hres = dxgiAdapter->GetParent(__uuidof(IDXGIFactory), &dxgiFactory);
    Hres = dxgiFactory->CreateSwapChain(dev.Get(), &scd, swapChain.GetAddressOf());
    Hres = (D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, __uuidof(ID2D1Factory3), &options, &factory));
    Hres = (dev.Get()->QueryInterface(__uuidof(IDXGIDevice), &dxgiDevice));
    Hres = factory->CreateDevice(dxgiDevice.Get(), &dev2d);
    Hres = dev2d->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS, &devCon3);

last line I get the error "C++ no instance of overloaded function matches the argument list"
I cant figure out how to call this function with ID2D1Device3 .
I’ve tried changing createdevice (previous line) to create a device3 pointer, but then that complains with same error.

Source: Windows Questions C++

LEAVE A COMMENT