[Interest] Qt/D3D integration through ANGLE PBuffer

Agocs Laszlo laszlo.agocs at theqtcompany.com
Thu Sep 24 14:37:56 CEST 2015


Yes, doing something like

void *shareHandle;

eglQuerySurfacePointerANGLE(display, surface, EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, &shareHandle)

gives you a D3D share handle which can then be passed to CreateTexture or OpenSharedResource.

QOffscreenSurface is not backed by an EGL pbuffer surface on Windows at the moment. Instead it is a hidden QWindow and thus an ordinary window surface. That might work too actually, the bigger problem is that there's no easy way to pull out the underlying surface handle. So you may want to create a pbuffer manually instead.

The Qt Multimedia example is at http://code.qt.io/cgit/qt/qtmultimedia.git/tree/src/plugins/wmf/evrd3dpresentengine.cpp#n437
The use case there is probably different from yours (since there the goal is to get an OpenGL texture wrapping the D3D-rendered content, instead of exposing the Qt-based rendering to D3D), but the first half is the same anyway.

As for Qt Quick, yes, try QQuickRenderControl. Hopefully it will be as simple as making the pbuffer surface current before calling render().

Best regards,

From: interest-bounces+laszlo.agocs=theqtcompany.com at qt-project.org <interest-bounces+laszlo.agocs=theqtcompany.com at qt-project.org> on behalf of Thomas Sevaldrud <thomas at silentwings.no>
Sent: Thursday, September 24, 2015 2:11 PM
To: Interest at qt-project.org
Subject: [Interest] Qt/D3D integration through ANGLE PBuffer


I have earlier made an implementation of Qt/D3D integration by hacking into the ANGLE D3D SwapChain and extracting the D3DSurface directly there.

However, this is a bit flakey, and I have had to change this code several times when new versions of Qt and ANGLE are released.

So, now I want to do this the supported way through the EGL_ANGLE_surface_d3d_texture_2d_share_handle extension. If I understand this correctly I can set up a PBuffer-based render target which I can query for a D3D texture sharing handle using the eglQuerySurfacePointerANGLE extension.

Now, before I start coding, I wonder if anyone has an example of using this extension for rendering to a D3D Texture? Someone mentioned on the list earlier that there should be an example of this in QtMultimedia, but I haven't been able to find it.

Also, for the PBuffer implementation, should I create a PBuffer directly through EGL, or can I use QOffsceenSurface? If I understand correctly, QOffscreenSurface will be implemented with a PBuffer on Windows?

To complicate matters even more I want to include a Quick scene graph in this as well, but I suppose I can use the new QQuickRenderControl class for this when I have the PBuffer render target sorted out?

Best regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150924/4f4839ec/attachment.html>

More information about the Interest mailing list