Using ANGLE with an existing DirectX device (concurrently)

499 views
Skip to first unread message

Matthew Leibowitz

unread,
Aug 26, 2016, 4:43:43 PM8/26/16
to angleproject
Hi ANGLE Experts,

I was wondering if it was at all possible to hook up an existing DX system with a new GL context?

What I am actually doing is trying to use a 2D drawing library (Skia) with DirectX on UWP.
Skia provides all the bits to use the ANGLE library, and I have got a basic demo going with DirectX using the ANGLE library to create and initialize all the bits. ie: eglInitialize, eglCreateWindowSurface, eglCreateContext

My final result is that I want to be able to, for example, render a spinning cube using pure DX on a background that was rendered using Skia with ANGLE. The reason that I may want to do this is to render some animated 2D graphic in-line with the rendering of the 3D.

Am I reaching too far here, or are you guys really that good? If this is not a good idea, are there any things that you suggest I look at as alternatives, such as a separate context or something?

Austin Kinross

unread,
Aug 26, 2016, 5:02:56 PM8/26/16
to angleproject
Hi Matthew,

You can achieve this in a UWP app in multiple ways. 

The easiest solution is probably to create a basic XAML app with two overlapping SwapChainPanels. Skia/ANGLE can be configured to render onto one of the SwapChainPanels, and your D3D content can be configured to render onto the other one. The Windows compositor will then combine the results and render them onto your screen. There are some Visual Studio templates that demonstrate how to set up ANGLE to render onto a SwapChainPanel, and the stock 'DirectX 11 and XAML App' Universal template in VS2015 shows how to configure D3D11 to render onto a SwapChainPanel. Your work here would be to combine the templates into one app (which shouldn't be too bad).

An alternate approach would be to share a texture between your D3D11 code and ANGLE code using some ANGLE/GL extensions. ANGLE could then render onto the texture, and when it's finished you can use the texture in your D3D11 rendering code. A rough overview of how to do this is available here.

Austin (Microsoft)
Reply all
Reply to author
Forward
0 new messages