[Development] Vulkan

Agocs Laszlo laszlo.agocs at theqtcompany.com
Sat Apr 9 18:45:39 CEST 2016


Hi,

Sean's summary is perfect. If you are after integrating your Vulkan renderer into a non-Quick app, use a QWindow and QWidget::createWindowContainer, like the D3D12 samples did. All you need is a native window handle (e.g. a HWND on Windows which is exactly what QWindow::winId() will give you; on other platforms there are backend-specific means to acquire the native window via QPlatformNativeInterface).

Integrating Vulkan rendering into an OpenGL-based Qt Quick scene can be more complicated, so at first I would rather look at the (unfortunately vendor-specific) GL_NV_draw_vulkan_image extension. This, in combination with GL_KHR_vulkan_glsl, is likely the easiest way to get started and combine the two worlds.

Right now Qt Quick is undergoing certain changes to make it more modular, focusing on OpenGL, D3D, and the QPainter-based 2D Renderer for the time being. This will allow multiple backends in the future, instead of being tied to OpenGL (or the current iteration of the separate, somewhat hackish 2D renderer). There are a number of issues to be investigated still, but we expect most of the work to become available in Qt 5.8 and beyond.

However, it is important to note that a full-blown Vulkan (or Metal for that matter) backend for Qt Quick is not something that will be rushed, so I wouldn't expect much on that front short-term. The benefits of the new low-level APIs are expected to be fairly limited for the workloads typical user interfaces generate. (this naturally does not apply to Qt 3D)

Best regards,
Laszlo
________________________________________
From: Development <development-bounces+laszlo.agocs=theqtcompany.com at qt-project.org> on behalf of Sean Harmer <sean.harmer at kdab.com>
Sent: Saturday, April 9, 2016 11:06:23 AM
To: development at qt-project.org
Cc: Tom Kulaga
Subject: Re: [Development] Vulkan

On Saturday 09 April 2016 01:57:24 Tom Kulaga wrote:
> Hi All,
>
> Is anyone actively working on vulkan integration? Or even a QVulkanWidget?
> I saw that d3d12 had a preview widget so thought it was reasonable to ask.
>
> If anyone isn't I'm keen to have a crack. In terms of implementation, is it
> as naively simple as creating a new widget similar to the QOpenGLWidget
> one, just to get a drawable canvas up and running? I believe that on Linux
> a xcb_window_t is used for vulkan samples and deep in the QPA I saw it too.
>
> I was wondering if for a novice like me this would be feasible to actually
> do?
>
> Does the whole rendering stack need to transfer over to vulkan?

It all depends what level of integration you are after. Using a QWindow and
using Vulkan with it doesn't require much. Making something equivalent to
QOpenGLWidget is much more work as you have to worry about compositing
QPainter content into the window too.

Making a Vulkan backend for Qt Quick 2 is also more work, considerably more
work than much of the other low hanging fruits that could be used to improve
performance there on the existing OpenGL backend. Although, like the D3D12
backend it might give better results on windows (for Vulkan capable hardware).

Putting a Vulkan backend on Qt 3D is a very real possibility and one where
Vulkan could potentially make a big impact. This is something I want to
investigate later after we have done a stable release or two of Qt 3D. The
good thing is that Qt 3D's architecture maps very well to Vulkan (by design).

Some IHV's provide drivers that have OpenGL/Vulkan interop in that you can use
both Vulkan and OpenGL on the same surface which would be another interesting
option if this support becomes widespread.

If you want to have a go, then certainly nobody is going to stop you and you
may well get some help. We have some early proof of concept stuff we can look
to tidy up and publish along these lines.

Cheers,

Sean
--
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. UK +44 (0)1625 809908, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
_______________________________________________
Development mailing list
Development at qt-project.org
http://lists.qt-project.org/mailman/listinfo/development



More information about the Development mailing list