1// Copyright (C) 2020 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 QQUICKGRAPHICSDEVICE_H
5#define QQUICKGRAPHICSDEVICE_H
6
7#include <QtQuick/qtquickglobal.h>
8
9#if QT_CONFIG(vulkan)
10#include <QtGui/qvulkaninstance.h>
11#endif
12
13#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_QDOC)
14Q_FORWARD_DECLARE_OBJC_CLASS(MTLDevice);
15Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandQueue);
16#endif
17
18QT_BEGIN_NAMESPACE
19
20class QQuickGraphicsDevicePrivate;
21class QOpenGLContext;
22class QRhi;
23
24class Q_QUICK_EXPORT QQuickGraphicsDevice
25{
26public:
27 QQuickGraphicsDevice();
28 ~QQuickGraphicsDevice();
29 QQuickGraphicsDevice(const QQuickGraphicsDevice &other);
30 QQuickGraphicsDevice &operator=(const QQuickGraphicsDevice &other);
31
32 bool isNull() const;
33
34#if QT_CONFIG(opengl) || defined(Q_QDOC)
35 static QQuickGraphicsDevice fromOpenGLContext(QOpenGLContext *context);
36#endif
37
38#if defined(Q_OS_WIN) || defined(Q_QDOC)
39 static QQuickGraphicsDevice fromAdapter(quint32 adapterLuidLow, qint32 adapterLuidHigh, int featureLevel = 0);
40 static QQuickGraphicsDevice fromDeviceAndContext(void *device, void *context);
41#endif
42
43#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_QDOC)
44 static QQuickGraphicsDevice fromDeviceAndCommandQueue(MTLDevice *device, MTLCommandQueue *commandQueue);
45#endif
46
47#if QT_CONFIG(vulkan) || defined(Q_QDOC)
48 static QQuickGraphicsDevice fromPhysicalDevice(VkPhysicalDevice physicalDevice);
49 static QQuickGraphicsDevice fromDeviceObjects(VkPhysicalDevice physicalDevice, VkDevice device, int queueFamilyIndex, int queueIndex = 0);
50#endif
51
52 static QQuickGraphicsDevice fromRhi(QRhi *rhi);
53
54private:
55 void detach();
56 QQuickGraphicsDevicePrivate *d;
57 friend class QQuickGraphicsDevicePrivate;
58};
59
60QT_END_NAMESPACE
61
62#endif // QQUICKGRAPHICSDEVICE_H
63

source code of qtdeclarative/src/quick/items/qquickgraphicsdevice.h