void LayerManager::initDevices() { ComResult hr; hr = DCompositionCreateDevice2(getCurrentContext().getRenderDevice()->getDevice2(), __uuidof(IDCompositionDesktopDevice), &this->pDevice); hr = this->pDevice->CreateTargetForHwnd(getCurrentContext().getNativePointer(), true, &this->pTarget); }
plx::ComPtr<IDCompositionDesktopDevice> CreateDCoDevice2( plx::ComPtr<ID2D1Device> device2D) { plx::ComPtr<IDCompositionDesktopDevice> device; auto hr = DCompositionCreateDevice2(device2D.Get(), __uuidof(device), reinterpret_cast<void **>(device.GetAddressOf())); if (hr != S_OK) throw plx::ComException(__LINE__, hr); return device; }