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
qmultimedia_vulkan_support_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 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#ifndef QMULTIMEDIA_VULKAN_SUPPORT_P_H
5#define QMULTIMEDIA_VULKAN_SUPPORT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtMultimedia/private/qtmultimediaglobal_p.h>
19
20#include <QtGui/qvulkaninstance.h> // defines VK_NO_PROTOTYPES before pulling in vulkan.h
21#include <QtCore/qspan.h>
22#include <QtCore/quuid.h>
23
24static_assert(QT_CONFIG(vulkan));
25
26QT_BEGIN_NAMESPACE
27
28class QDebug;
29
30Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug debug, VkResult result);
31
32namespace QtMultimediaPrivate {
33
34template <typename Func>
35Func resolveVulkanFunction(QVulkanInstance &inst, const char *name)
36{
37 return reinterpret_cast<Func>(inst.getInstanceProcAddr(name));
38}
39
40// Resolves a device-level function, e.g. one of an extension such as VK_KHR_external_memory_fd.
41// Unlike resolveVulkanFunction(), which yields a loader trampoline even when the extension is not
42// enabled on the device (and crashes when called), this returns nullptr if the function is not
43// available on the given device.
44template <typename Func>
45Func resolveVulkanDeviceFunction(QVulkanInstance &inst, VkDevice dev, const char *name)
46{
47 const auto getDeviceProcAddr =
48 resolveVulkanFunction<PFN_vkGetDeviceProcAddr>(inst, "vkGetDeviceProcAddr");
49 return getDeviceProcAddr ? reinterpret_cast<Func>(getDeviceProcAddr(dev, name)) : nullptr;
50}
51
52inline QUuid uuidFromVkUuid(QSpan<const uint8_t, VK_UUID_SIZE> vkUuidBytes)
53{
54 static_assert(VK_UUID_SIZE == 16);
55 return QUuid::fromRfc4122(
56 QByteArrayView(reinterpret_cast<const char *>(vkUuidBytes.data()), VK_UUID_SIZE));
57}
58
59} // namespace QtMultimediaPrivate
60
61QT_END_NAMESPACE
62
63#endif // QMULTIMEDIA_VULKAN_SUPPORT_P_H
Combined button and popup list for selecting options.
QUuid uuidFromVkUuid(QSpan< const uint8_t, VK_UUID_SIZE > vkUuidBytes)
Func resolveVulkanDeviceFunction(QVulkanInstance &inst, VkDevice dev, const char *name)
Func resolveVulkanFunction(QVulkanInstance &inst, const char *name)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2620