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