| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2017 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include <private/qvulkanfunctions_p.h> |
| 41 | |
| 42 | QT_BEGIN_NAMESPACE |
| 43 | |
| 44 | /*! |
| 45 | \class QVulkanFunctions |
| 46 | \since 5.10 |
| 47 | \ingroup painting-3D |
| 48 | \inmodule QtGui |
| 49 | \wrapper |
| 50 | |
| 51 | \brief The QVulkanFunctions class provides cross-platform access to the |
| 52 | instance level core Vulkan 1.0 API. |
| 53 | |
| 54 | Qt and Qt applications do not link to any Vulkan libraries by default. |
| 55 | Instead, all functions are resolved dynamically at run time. Each |
| 56 | QVulkanInstance provides a QVulkanFunctions object retrievable via |
| 57 | QVulkanInstance::functions(). This does not contain device level functions |
| 58 | in order to avoid the potential overhead of an internal dispatching. |
| 59 | Instead, functions that rely on a device, or a dispatchable child object of |
| 60 | a device, are exposed via QVulkanDeviceFunctions and |
| 61 | QVulkanInstance::deviceFunctions(). QVulkanFunctions and |
| 62 | QVulkanDeviceFunctions together provides access to the full core Vulkan |
| 63 | API, excluding any extensions. |
| 64 | |
| 65 | \note QVulkanFunctions instances cannot be constructed directly. |
| 66 | |
| 67 | The typical usage is the following: |
| 68 | |
| 69 | \snippet code/src_gui_vulkan_qvulkanfunctions.cpp 0 |
| 70 | |
| 71 | \note Windowing system interface (WSI) specifics and extensions are |
| 72 | excluded. This class only covers core Vulkan commands, with the exception |
| 73 | of instance creation, destruction, and function resolving, since such |
| 74 | functionality is covered by QVulkanInstance itself. |
| 75 | |
| 76 | To access additional functions, applications can use |
| 77 | QVulkanInstance::getInstanceProcAddr() and vkGetDeviceProcAddr(). |
| 78 | Applications can also decide to link to a Vulkan library directly, as |
| 79 | platforms with an appropriate loader will typically export function symbols |
| 80 | for the core commands. See |
| 81 | \l{https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkGetInstanceProcAddr.html}{the |
| 82 | man page for vkGetInstanceProcAddr} for more information. |
| 83 | |
| 84 | \sa QVulkanInstance, QVulkanDeviceFunctions, QWindow::setVulkanInstance(), QWindow::setSurfaceType() |
| 85 | */ |
| 86 | |
| 87 | /*! |
| 88 | \class QVulkanDeviceFunctions |
| 89 | \since 5.10 |
| 90 | \ingroup painting-3D |
| 91 | \inmodule QtGui |
| 92 | \wrapper |
| 93 | |
| 94 | \brief The QVulkanDeviceFunctions class provides cross-platform access to |
| 95 | the device level core Vulkan 1.0 API. |
| 96 | |
| 97 | Qt and Qt applications do not link to any Vulkan libraries by default. |
| 98 | Instead, all functions are resolved dynamically at run time. Each |
| 99 | QVulkanInstance provides a QVulkanFunctions object retrievable via |
| 100 | QVulkanInstance::functions(). This does not contain device level functions |
| 101 | in order to avoid the potential overhead of an internal dispatching. |
| 102 | Instead, functions that rely on a device, or a dispatchable child object of |
| 103 | a device, are exposed via QVulkanDeviceFunctions and |
| 104 | QVulkanInstance::deviceFunctions(). QVulkanFunctions and |
| 105 | QVulkanDeviceFunctions together provides access to the full core Vulkan |
| 106 | API, excluding any extensions. |
| 107 | |
| 108 | \note QVulkanDeviceFunctions instances cannot be constructed directly. |
| 109 | |
| 110 | The typical usage is the following: |
| 111 | |
| 112 | \snippet code/src_gui_vulkan_qvulkanfunctions.cpp 1 |
| 113 | |
| 114 | The QVulkanDeviceFunctions object specific to the provided VkDevice is |
| 115 | created when QVulkanInstance::deviceFunctions() is first called with the |
| 116 | device in question. The object is then cached internally. |
| 117 | |
| 118 | To access additional functions, applications can use |
| 119 | QVulkanInstance::getInstanceProcAddr() and vkGetDeviceProcAddr(). |
| 120 | Applications can also decide to link to a Vulkan library directly, as many |
| 121 | implementations export function symbols for the core commands. See |
| 122 | \l{https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkGetInstanceProcAddr.html}{the |
| 123 | man page for vkGetInstanceProcAddr} for more information. |
| 124 | |
| 125 | \sa QVulkanInstance, QVulkanFunctions, QWindow::setVulkanInstance(), QWindow::setSurfaceType() |
| 126 | */ |
| 127 | |
| 128 | /* |
| 129 | Constructs a new QVulkanFunctions for \a inst. |
| 130 | \internal |
| 131 | */ |
| 132 | QVulkanFunctions::QVulkanFunctions(QVulkanInstance *inst) |
| 133 | : d_ptr(new QVulkanFunctionsPrivate(inst)) |
| 134 | { |
| 135 | } |
| 136 | |
| 137 | /* |
| 138 | Destructor. |
| 139 | */ |
| 140 | QVulkanFunctions::~QVulkanFunctions() |
| 141 | { |
| 142 | } |
| 143 | |
| 144 | /* |
| 145 | Constructs a new QVulkanDeviceFunctions for \a inst and the given \a device. |
| 146 | \internal |
| 147 | */ |
| 148 | QVulkanDeviceFunctions::QVulkanDeviceFunctions(QVulkanInstance *inst, VkDevice device) |
| 149 | : d_ptr(new QVulkanDeviceFunctionsPrivate(inst, device)) |
| 150 | { |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | Destructor. |
| 155 | */ |
| 156 | QVulkanDeviceFunctions::~QVulkanDeviceFunctions() |
| 157 | { |
| 158 | } |
| 159 | |
| 160 | QT_END_NAMESPACE |
| 161 | |