10

I have a Qt application that draws using Open GL. At some point I'm using a QQuickWindow associated to a QQuickRenderControl to draw a QML scene into a texture to later compose it in the final image.

Now, I'm considering porting OpenGL to Vulkan and I'm not sure if it is possible to do the same with this QML layer.

Reading Qt docs I found that

QQuickWindow uses a scene graph on top of OpenGL to render.

Do you think it is possible to port it to Vulkan? Perhaps overriding QQuickWindow and QQuickRenderControl? I'm not a Qt expert so perhaps someone can give me a better insight of the problem.

BaCaRoZzo
  • 7,502
  • 6
  • 51
  • 82
gabocalero
  • 473
  • 6
  • 15
  • 2
    As of Qt 5.7, Quick is tightly coupled with GL. This is going to change soon with the release of Qt 5.8 (see [this blog post](http://blog.qt.io/blog/2016/08/15/the-qt-quick-graphics-stack-in-qt-5-8/). Supporting Vulkan is something that is likely to come in the near future but it is not just a matter of overriding two classes... – BaCaRoZzo Jan 13 '17 at 16:55
  • @BaCaRoZzo, do you know anything about progress of porting scene graph to Vulkan? Also, will the resource sharing work (like the very handy texture sharing with the OpenGL implementation)? – Velkan Jan 18 '17 at 07:48
  • Unfortunately that's a detail which is out of my knowledge, sorry. AFAIU the first step will be getting CX12 back-end out of TP, possibly in 5.9 because that can greatly improve the experience on windows systems. As for metal and Vulkan there's no (public) roadmap, none that I'm aware of at least. I've found however an old discussion in which is clearly stated that it "will not be rushed" (see [here](http://lists.qt-project.org/pipermail/development/2016-April/025590.html)). So I was probably too optimistic on the first comment. My bad. – BaCaRoZzo Jan 18 '17 at 08:53
  • To the OP, look to [this blogpost](https://blog.qt.io/blog/2016/01/28/qt-and-direct3d-12-first-encounter/). Here they integrated DX12 with current OpenGL back-end. That's different for the approach you want but it should work. – BaCaRoZzo Jan 18 '17 at 08:56
  • 2
    Since the answers are quite old.. is there any update on this? What about Metal support? My understanding is that if I write a custom QQuickItem it will render with OpenGL, WebGL and that's it? Note exactly cross platform IMHO... – Nils Nov 24 '18 at 20:30

1 Answers1

3

As of June 2019 and Qt 5.13, Qt Quick 2 supports the following backends:

  1. OpenGL 2.0
  2. OpenGL ES 2.0
  3. Direct3D 12 (support is still experimental)
  4. OpenVG
  5. Software rendering

However, only OpenGL and OpenGL ES are fully functional. For instance some effects (like particles) do not work with the other banckends.

For more information about how to select a backend and what are the limitations of each backend I suggest to read the documentation: https://doc.qt.io/qt-5/qtquick-visualcanvas-adaptations.html

Regarding Vulkan specifically, Qt has added support to it since Qt 5.10. However, the support is still very limited and does not cover Qt Quick.

Change will come in the future; quoting an email from Qt development mailing list:

A very early preview of Qt Quick for Vulkan, Metal, and D3D11 may come already in Qt 5.14, then evolve in 5.15 and beyond, with 6.0 as its final destination.

So rendering Qt Quick with Vulkan should be possible when Qt 6 will be out. The planned release date for Qt 6 is currently November 2020. In the mean time technical previews might be available starting with Qt 5.14.

I would not be too optimistic for anything before Qt 6 as (1) it will just be technical previews and (2) as far as I know, current official Qt binaries are not linked with Vulkan at all and you need to build Qt from source if you want to use Vulkan.

Benjamin T
  • 8,120
  • 20
  • 37