Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qvulkanfunctions.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <private/qvulkanfunctions_p.h>
5
6QT_BEGIN_NAMESPACE
7
8/*!
9 \class QVulkanFunctions
10 \since 5.10
11 \ingroup painting-3D
12 \inmodule QtGui
13 \wrapper
14
15 \brief The QVulkanFunctions class provides cross-platform access to the
16 instance level core Vulkan 1.3 API.
17
18 Qt and Qt applications do not link to any Vulkan libraries by default.
19 Instead, all functions are resolved dynamically at run time. Each
20 QVulkanInstance provides a QVulkanFunctions object retrievable via
21 QVulkanInstance::functions(). This does not contain device level functions
22 in order to avoid the potential overhead of an internal dispatching.
23 Instead, functions that rely on a device, or a dispatchable child object of
24 a device, are exposed via QVulkanDeviceFunctions and
25 QVulkanInstance::deviceFunctions(). QVulkanFunctions and
26 QVulkanDeviceFunctions together provides access to the full core Vulkan
27 API, excluding any extensions.
28
29 \note QVulkanFunctions instances cannot be constructed directly.
30
31 The typical usage is the following:
32
33 \snippet code/src_gui_vulkan_qvulkanfunctions.cpp 0
34
35 \note Windowing system interface (WSI) specifics and extensions are
36 excluded. This class only covers core Vulkan commands, with the exception
37 of instance creation, destruction, and function resolving, since such
38 functionality is covered by QVulkanInstance itself.
39
40 To access additional functions, applications can use
41 QVulkanInstance::getInstanceProcAddr() and vkGetDeviceProcAddr().
42 Applications can also decide to link to a Vulkan library directly, as
43 platforms with an appropriate loader will typically export function symbols
44 for the core commands. See
45 \l{https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkGetInstanceProcAddr.html}{the
46 man page for vkGetInstanceProcAddr} for more information.
47
48 \note The member function prototypes for Vulkan 1.1, 1.2, and 1.3 commands
49 are \c ifdefed with the appropriate \c{VK_VERSION_1_x} that is defined by
50 the Vulkan headers. As such, these functions will only be callable by an
51 application when the system's (on which the application is built) Vulkan
52 header is new enough and it contains 1.1, 1.2, or 1.3 Vulkan API
53 definitions. When building Qt from source, this has an additional
54 consequence: the Vulkan headers on the build environment must also be 1.1,
55 1.2, and 1.3 compatible to get a Qt build that supports resolving
56 the 1.1, 1.2, and 1.3 API commands. If neither of these conditions is met,
57 applications will only be able to call the Vulkan 1.0 commands through
58 QVulkanFunctions and QVulkanDeviceFunctions.
59
60 \sa QVulkanInstance, QVulkanDeviceFunctions, QWindow::setVulkanInstance(), QWindow::setSurfaceType()
61*/
62
63/*!
64 \class QVulkanDeviceFunctions
65 \since 5.10
66 \ingroup painting-3D
67 \inmodule QtGui
68 \wrapper
69
70 \brief The QVulkanDeviceFunctions class provides cross-platform access to
71 the device level core Vulkan 1.3 API.
72
73 Qt and Qt applications do not link to any Vulkan libraries by default.
74 Instead, all functions are resolved dynamically at run time. Each
75 QVulkanInstance provides a QVulkanFunctions object retrievable via
76 QVulkanInstance::functions(). This does not contain device level functions
77 in order to avoid the potential overhead of an internal dispatching.
78 Instead, functions that rely on a device, or a dispatchable child object of
79 a device, are exposed via QVulkanDeviceFunctions and
80 QVulkanInstance::deviceFunctions(). QVulkanFunctions and
81 QVulkanDeviceFunctions together provides access to the full core Vulkan
82 API, excluding any extensions.
83
84 \note QVulkanDeviceFunctions instances cannot be constructed directly.
85
86 The typical usage is the following:
87
88 \snippet code/src_gui_vulkan_qvulkanfunctions.cpp 1
89
90 The QVulkanDeviceFunctions object specific to the provided VkDevice is
91 created when QVulkanInstance::deviceFunctions() is first called with the
92 device in question. The object is then cached internally.
93
94 To access additional functions, applications can use
95 QVulkanInstance::getInstanceProcAddr() and vkGetDeviceProcAddr().
96 Applications can also decide to link to a Vulkan library directly, as many
97 implementations export function symbols for the core commands. See
98 \l{https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkGetInstanceProcAddr.html}{the
99 man page for vkGetInstanceProcAddr} for more information.
100
101 \sa QVulkanInstance, QVulkanFunctions, QWindow::setVulkanInstance(), QWindow::setSurfaceType()
102*/
103
104/*
105 Constructs a new QVulkanFunctions for \a inst.
106 \internal
107 */
108QVulkanFunctions::QVulkanFunctions(QVulkanInstance *inst)
109 : d_ptr(new QVulkanFunctionsPrivate(inst))
110{
111}
112
113/*
114 Destructor.
115 */
116QVulkanFunctions::~QVulkanFunctions()
117{
118}
119
120/*
121 Constructs a new QVulkanDeviceFunctions for \a inst and the given \a device.
122 \internal
123 */
124QVulkanDeviceFunctions::QVulkanDeviceFunctions(QVulkanInstance *inst, VkDevice device)
125 : d_ptr(new QVulkanDeviceFunctionsPrivate(inst, device))
126{
127}
128
129/*
130 Destructor.
131 */
132QVulkanDeviceFunctions::~QVulkanDeviceFunctions()
133{
134}
135
136QT_END_NAMESPACE