Using Edge WebView2 is really straightforward, but using the Composition controller is poorly documented and only discussed on few issues in the WebView2 repo.
The browser itself is rendered on a separate process using DirectComposition API wich does not directly interoperate with DirectX, but can be readed using GraphicsCaptureItem WinRT apis. This means that a capture session must be setup into the host visual root, and it will provide accelerated GPU texture capture of the browser (with transparency)
There are few extra steps to setup this pipeline under win32 apps, apart of usual WebView2 setup:
- A
DispatcherQueueController
need to be created in the hosting thread in order to be able to use theVisual
interfaces - Use
CreateCoreWebView2CompositionController
insteadCreateCoreWebView2Controller
or itsWithConfig
equivalent. - Create a WinRT DirectComposition
IContainerVisual
andIVisual
as in the example - Create a WinRT Direct3D11CaptureFramePool and start the session using `GraphicsC