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#ifndef QPLATFORMVULKANINSTANCE_H
5#define QPLATFORMVULKANINSTANCE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the QPA API and is not meant to be used
12// in applications. Usage of this API may make your code
13// source and binary incompatible with future versions of Qt.
14//
15
16#include <QtGui/qtguiglobal.h>
17
18#if QT_CONFIG(vulkan) || defined(Q_QDOC)
19
20#include <qvulkaninstance.h>
21
22QT_BEGIN_NAMESPACE
23
24class QPlatformVulkanInstancePrivate;
25
26class Q_GUI_EXPORT QPlatformVulkanInstance
27{
28 Q_DECLARE_PRIVATE(QPlatformVulkanInstance)
29
30public:
31 QPlatformVulkanInstance();
32 virtual ~QPlatformVulkanInstance();
33
34 virtual QVulkanInfoVector<QVulkanLayer> supportedLayers() const = 0;
35 virtual QVulkanInfoVector<QVulkanExtension> supportedExtensions() const = 0;
36 virtual QVersionNumber supportedApiVersion() const = 0;
37 virtual void createOrAdoptInstance() = 0;
38 virtual bool isValid() const = 0;
39 virtual VkResult errorCode() const = 0;
40 virtual VkInstance vkInstance() const = 0;
41 virtual QByteArrayList enabledLayers() const = 0;
42 virtual QByteArrayList enabledExtensions() const = 0;
43 virtual PFN_vkVoidFunction getInstanceProcAddr(const char *name) = 0;
44 virtual bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) = 0;
45 virtual void presentAboutToBeQueued(QWindow *window);
46 virtual void presentQueued(QWindow *window);
47 virtual void setDebugFilters(const QList<QVulkanInstance::DebugFilter> &filters);
48 virtual void setDebugUtilsFilters(const QList<QVulkanInstance::DebugUtilsFilter> &filters);
49 virtual void beginFrame(QWindow *window);
50 virtual void endFrame(QWindow *window);
51
52private:
53 QScopedPointer<QPlatformVulkanInstancePrivate> d_ptr;
54 Q_DISABLE_COPY(QPlatformVulkanInstance)
55};
56
57QT_END_NAMESPACE
58
59#endif // QT_CONFIG(vulkan)
60
61#if defined(Q_QDOC)
62/*
63 The following include file did not exist for clang-qdoc running
64 in macOS, but the classes are documented in qvulkanfunctions.cpp.
65 clang-qdoc must parse the class declarations in an include file,
66 or else it can't find a place to put the documentation for the
67 classes. Apparently these classes are created at build time if
68 Vulkan is present.
69 */
70#ifndef QVULKANFUNCTIONS_H
71#define QVULKANFUNCTIONS_H
72
73#include <QtGui/qtguiglobal.h>
74
75#if QT_CONFIG(vulkan) || defined(Q_QDOC)
76
77#ifndef VK_NO_PROTOTYPES
78#define VK_NO_PROTOTYPES
79#endif
80#include <vulkan/vulkan.h>
81
82#include <QtCore/qscopedpointer.h>
83
84QT_BEGIN_NAMESPACE
85
86class QVulkanInstance;
87class QVulkanFunctionsPrivate;
88class QVulkanDeviceFunctionsPrivate;
89
90class Q_GUI_EXPORT QVulkanFunctions
91{
92public:
93 ~QVulkanFunctions();
94
95private:
96 Q_DISABLE_COPY(QVulkanFunctions)
97 QVulkanFunctions(QVulkanInstance *inst);
98
99 QScopedPointer<QVulkanFunctionsPrivate> d_ptr;
100 friend class QVulkanInstance;
101};
102
103class Q_GUI_EXPORT QVulkanDeviceFunctions
104{
105public:
106 ~QVulkanDeviceFunctions();
107
108private:
109 Q_DISABLE_COPY(QVulkanDeviceFunctions)
110 QVulkanDeviceFunctions(QVulkanInstance *inst, VkDevice device);
111
112 QScopedPointer<QVulkanDeviceFunctionsPrivate> d_ptr;
113 friend class QVulkanInstance;
114};
115
116QT_END_NAMESPACE
117
118#endif // QT_CONFIG(vulkan) || defined(Q_QDOC)
119#endif // QVULKANFUNCTIONS_H;
120#endif // Q_QDOC
121
122#endif // QPLATFORMVULKANINSTANCE_H
123

source code of qtbase/src/gui/vulkan/qplatformvulkaninstance.h