1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB). |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt3D module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QT3DRENDER_QRENDERCAPABILITIES_H |
41 | #define QT3DRENDER_QRENDERCAPABILITIES_H |
42 | |
43 | #include <QtCore/qobject.h> |
44 | #include <QtGui/qsurfaceformat.h> |
45 | #include <Qt3DRender/qt3drender_global.h> |
46 | |
47 | QT_BEGIN_NAMESPACE |
48 | |
49 | namespace Qt3DRender { |
50 | |
51 | class QRenderCapabilitiesPrivate; |
52 | |
53 | class Q_3DRENDERSHARED_EXPORT QRenderCapabilities : public QObject |
54 | { |
55 | Q_OBJECT |
56 | Q_PROPERTY(bool valid READ isValid CONSTANT) |
57 | Q_PROPERTY(API api READ api CONSTANT) |
58 | Q_PROPERTY(Profile profile READ profile CONSTANT) |
59 | Q_PROPERTY(int majorVersion READ majorVersion CONSTANT) |
60 | Q_PROPERTY(int minorVersion READ minorVersion CONSTANT) |
61 | Q_PROPERTY(QStringList extensions READ extensions CONSTANT) |
62 | Q_PROPERTY(QString vendor READ vendor CONSTANT) |
63 | Q_PROPERTY(QString renderer READ renderer CONSTANT) |
64 | Q_PROPERTY(QString driverVersion READ driverVersion CONSTANT) |
65 | Q_PROPERTY(QString glslVersion READ glslVersion CONSTANT) |
66 | Q_PROPERTY(int maxSamples READ maxSamples CONSTANT) |
67 | Q_PROPERTY(int maxTextureSize READ maxTextureSize CONSTANT) |
68 | Q_PROPERTY(int maxTextureUnits READ maxTextureUnits CONSTANT) |
69 | Q_PROPERTY(int maxTextureLayers READ maxTextureLayers CONSTANT) |
70 | Q_PROPERTY(bool supportsUBO READ supportsUBO CONSTANT) |
71 | Q_PROPERTY(int maxUBOSize READ maxUBOSize CONSTANT) |
72 | Q_PROPERTY(int maxUBOBindings READ maxUBOBindings CONSTANT) |
73 | Q_PROPERTY(bool supportsSSBO READ supportsSSBO CONSTANT) |
74 | Q_PROPERTY(int maxSSBOSize READ maxSSBOSize CONSTANT) |
75 | Q_PROPERTY(int maxSSBOBindings READ maxSSBOBindings CONSTANT) |
76 | Q_PROPERTY(bool supportsImageStore READ supportsImageStore CONSTANT) |
77 | Q_PROPERTY(int maxImageUnits READ maxImageUnits CONSTANT) |
78 | Q_PROPERTY(bool supportsCompute READ supportsCompute CONSTANT) |
79 | Q_PROPERTY(int maxWorkGroupCountX READ maxWorkGroupCountX CONSTANT) |
80 | Q_PROPERTY(int maxWorkGroupCountY READ maxWorkGroupCountY CONSTANT) |
81 | Q_PROPERTY(int maxWorkGroupCountZ READ maxWorkGroupCountZ CONSTANT) |
82 | Q_PROPERTY(int maxWorkGroupSizeX READ maxWorkGroupSizeX CONSTANT) |
83 | Q_PROPERTY(int maxWorkGroupSizeY READ maxWorkGroupSizeY CONSTANT) |
84 | Q_PROPERTY(int maxWorkGroupSizeZ READ maxWorkGroupSizeZ CONSTANT) |
85 | Q_PROPERTY(int maxComputeInvocations READ maxComputeInvocations CONSTANT) |
86 | Q_PROPERTY(int maxComputeSharedMemorySize READ maxComputeSharedMemorySize CONSTANT) |
87 | public: |
88 | enum API { |
89 | OpenGL = QSurfaceFormat::OpenGL, // 1 |
90 | OpenGLES = QSurfaceFormat::OpenGLES, // 2 |
91 | Vulkan = 3, // 3 |
92 | DirectX, // 4 |
93 | RHI, // 5 |
94 | }; |
95 | Q_ENUM(API) |
96 | |
97 | enum Profile { |
98 | NoProfile = QSurfaceFormat::NoProfile, |
99 | CoreProfile = QSurfaceFormat::CoreProfile, |
100 | CompatibilityProfile = QSurfaceFormat::CompatibilityProfile |
101 | }; |
102 | Q_ENUM(Profile) |
103 | |
104 | explicit QRenderCapabilities(QObject *parent = nullptr); |
105 | ~QRenderCapabilities(); |
106 | |
107 | bool isValid() const; |
108 | API api() const; |
109 | Profile profile() const; |
110 | int majorVersion() const; |
111 | int minorVersion() const; |
112 | QStringList extensions() const; |
113 | QString vendor() const; |
114 | QString renderer() const; |
115 | QString driverVersion() const; |
116 | QString glslVersion() const; |
117 | int maxSamples() const; |
118 | int maxTextureSize() const; |
119 | int maxTextureUnits() const; |
120 | int maxTextureLayers() const; |
121 | bool supportsUBO() const; |
122 | int maxUBOSize() const; |
123 | int maxUBOBindings() const; |
124 | bool supportsSSBO() const; |
125 | int maxSSBOSize() const; |
126 | int maxSSBOBindings() const; |
127 | bool supportsImageStore() const; |
128 | int maxImageUnits() const; |
129 | bool supportsCompute() const; |
130 | int maxWorkGroupCountX() const; |
131 | int maxWorkGroupCountY() const; |
132 | int maxWorkGroupCountZ() const; |
133 | int maxWorkGroupSizeX() const; |
134 | int maxWorkGroupSizeY() const; |
135 | int maxWorkGroupSizeZ() const; |
136 | int maxComputeInvocations() const; |
137 | int maxComputeSharedMemorySize() const; |
138 | |
139 | protected: |
140 | Q_DECLARE_PRIVATE(QRenderCapabilities) |
141 | }; |
142 | |
143 | } // namespace Qt3Drender |
144 | |
145 | QT_END_NAMESPACE |
146 | |
147 | #endif // QT3DRENDER_QRENDERCAPABILITIES_H |
148 | |