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_P_H
5#define QQUICKGRAPHICSDEVICE_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 <QtQuick/private/qtquickglobal_p.h>
19#include <QAtomicInt>
20#include "qquickgraphicsdevice.h"
21
22QT_BEGIN_NAMESPACE
23
24class Q_QUICK_EXPORT QQuickGraphicsDevicePrivate
25{
26public:
27 static QQuickGraphicsDevicePrivate *get(QQuickGraphicsDevice *p) { return p->d; }
28 static const QQuickGraphicsDevicePrivate *get(const QQuickGraphicsDevice *p) { return p->d; }
29 QQuickGraphicsDevicePrivate();
30 QQuickGraphicsDevicePrivate(const QQuickGraphicsDevicePrivate &other);
31
32 enum class Type {
33 Null,
34 OpenGLContext,
35 Adapter,
36 DeviceAndContext,
37 DeviceAndCommandQueue,
38 PhysicalDevice,
39 DeviceObjects,
40 Rhi,
41 RhiAdapter
42 };
43
44 QAtomicInt ref;
45 Type type = Type::Null;
46
47 struct Adapter {
48 quint32 luidLow;
49 qint32 luidHigh;
50 int featureLevel;
51 };
52
53 struct DeviceAndContext {
54 void *device;
55 void *context;
56 };
57
58 struct DeviceAndCommandQueue {
59 void *device;
60 void *cmdQueue;
61 };
62
63 struct PhysicalDevice {
64 void *physicalDevice;
65 };
66
67 struct DeviceObjects {
68 void *physicalDevice;
69 void *device;
70 int queueFamilyIndex;
71 int queueIndex;
72 };
73
74 union {
75 QOpenGLContext *context;
76 Adapter adapter;
77 DeviceAndContext deviceAndContext;
78 DeviceAndCommandQueue deviceAndCommandQueue;
79 PhysicalDevice physicalDevice;
80 DeviceObjects deviceObjects;
81 QRhi *rhi;
82 QRhiAdapter *rhiAdapter;
83 } u;
84};
85
86QT_END_NAMESPACE
87
88#endif // QQUICKGRAPHICSDEVICE_P_H
89

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