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 the Visual
interfaces
- Use
CreateCoreWebView2CompositionController
instead CreateCoreWebView2Controller
or its WithConfig
equivalent.
- Create a WinRT DirectComposition
IContainerVisual
and IVisual
as in the example
- Create a WinRT Direct3D11CaptureFramePool and start the session using `GraphicsC