QtQuick 2.0 scene on top of Direct3D scene

I tried to find a solution in order to have a QtQuick 2.0 scene along with a Direct3D scene for quite some time, but I didn’t really succeed. My goal is to have a Direct3D engine with reasonable speed (60 FPS?), Along with the QML UI on top. Both things do a great job with the 150-200 FPS. But when they are forced to cooperate with each other in one window, everything just comes from bananas. I have explored several approaches, but none of them are sufficient:

Solution A: Rendering a Direct3D scene into a texture, rendering with QImage and QQuickPaintedItem

  • this solution works quite well, and it seems to be preferred by other people on the Internet. However TERRIBLY slowly. I could not get more than 18-20 FPS in full HD. The bottleneck was clearly in the texture transfer chain from the GPU (D3D) to the CPU (QImage) and back to the GPU (QML rendering) for each frame. In particular, processing CPU-> GPUs on the QML side was too slow!

Solution B: rendering a QtQuick scene in FBO, then using a Direct3D texture

  • This is basically the previous solution in a different way. The speed is slightly better when the user interface does not require updating. As soon as it begins to revive, everything again falls to 18-20 FPS. QOpenGLFramebufferObject :: toImage () obviously takes its time. Implementing double texture buffering / FBO on both sides to reduce kiosks really does not help.

Solution C: QQuickView with transparency enabled on top of QWidget with Direct3D scene

  • also no luck with this approach. It seems that transparency only works when QQuickView is in its own window. As soon as I put it on top of my D3D QWidget in the same window, it immediately stopped working and became completely opaque. Someone was trying to do something like this: http://qt-project.org/forums/viewthread/5484 , but I had no luck with this solution. It is possible that saving two fully separated windows (the main D3D window + frameless transparent QML window) on top of each other will do the trick all the time, but it just sounds silly.

Solution X: Change the ANGLE library and try to extract and share the D3D device context with my Direct3D renderer

  • havent tried this, avoiding any modifications to the library for as long as possible. Would that even be a smart option?

My obvious questions are: Am I doing something wrong? What is the preferred solution? A, B, C, X, or maybe something completely different? Can someone point me in the right direction?

TL DR: What is the fastest way to render a QML scene on top of a Direct3D scene?

+6
source share
1 answer

It sounds like you ideally need the ridiculous Solution X solution and write yourself the DirectX QPA plugin.

http://qt-project.org/wiki/Qt-Platform-Abstraction

I would promise that you will make many friends if you open such efforts!

+1
source

All Articles