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_PRIVATE_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 };
42
43 QAtomicInt ref;
44 Type type = Type::Null;
45
46 struct Adapter {
47 quint32 luidLow;
48 qint32 luidHigh;
49 int featureLevel;
50 };
51
52 struct DeviceAndContext {
53 void *device;
54 void *context;
55 };
56
57 struct DeviceAndCommandQueue {
58 void *device;
59 void *cmdQueue;
60 };
61
62 struct PhysicalDevice {
63 void *physicalDevice;
64 };
65
66 struct DeviceObjects {
67 void *physicalDevice;
68 void *device;
69 int queueFamilyIndex;
70 int queueIndex;
71 };
72
73 union {
74 QOpenGLContext *context;
75 Adapter adapter;
76 DeviceAndContext deviceAndContext;
77 DeviceAndCommandQueue deviceAndCommandQueue;
78 PhysicalDevice physicalDevice;
79 DeviceObjects deviceObjects;
80 QRhi *rhi;
81 } u;
82};
83
84QT_END_NAMESPACE
85
86#endif // QQUICKGRAPHICSDEVICE_P_H
87

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