1// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
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 QT3DRENDER_QRENDERCAPABILITIES_H
5#define QT3DRENDER_QRENDERCAPABILITIES_H
6
7#include <QtCore/qobject.h>
8#include <QtGui/qsurfaceformat.h>
9#include <Qt3DRender/qt3drender_global.h>
10
11QT_BEGIN_NAMESPACE
12
13namespace Qt3DRender {
14
15class QRenderCapabilitiesPrivate;
16
17class Q_3DRENDERSHARED_EXPORT QRenderCapabilities : public QObject
18{
19 Q_OBJECT
20 Q_PROPERTY(bool valid READ isValid CONSTANT)
21 Q_PROPERTY(API api READ api CONSTANT)
22 Q_PROPERTY(Profile profile READ profile CONSTANT)
23 Q_PROPERTY(int majorVersion READ majorVersion CONSTANT)
24 Q_PROPERTY(int minorVersion READ minorVersion CONSTANT)
25 Q_PROPERTY(QStringList extensions READ extensions CONSTANT)
26 Q_PROPERTY(QString vendor READ vendor CONSTANT)
27 Q_PROPERTY(QString renderer READ renderer CONSTANT)
28 Q_PROPERTY(QString driverVersion READ driverVersion CONSTANT)
29 Q_PROPERTY(QString glslVersion READ glslVersion CONSTANT)
30 Q_PROPERTY(int maxSamples READ maxSamples CONSTANT)
31 Q_PROPERTY(int maxTextureSize READ maxTextureSize CONSTANT)
32 Q_PROPERTY(int maxTextureUnits READ maxTextureUnits CONSTANT)
33 Q_PROPERTY(int maxTextureLayers READ maxTextureLayers CONSTANT)
34 Q_PROPERTY(bool supportsUBO READ supportsUBO CONSTANT)
35 Q_PROPERTY(int maxUBOSize READ maxUBOSize CONSTANT)
36 Q_PROPERTY(int maxUBOBindings READ maxUBOBindings CONSTANT)
37 Q_PROPERTY(bool supportsSSBO READ supportsSSBO CONSTANT)
38 Q_PROPERTY(int maxSSBOSize READ maxSSBOSize CONSTANT)
39 Q_PROPERTY(int maxSSBOBindings READ maxSSBOBindings CONSTANT)
40 Q_PROPERTY(bool supportsImageStore READ supportsImageStore CONSTANT)
41 Q_PROPERTY(int maxImageUnits READ maxImageUnits CONSTANT)
42 Q_PROPERTY(bool supportsCompute READ supportsCompute CONSTANT)
43 Q_PROPERTY(int maxWorkGroupCountX READ maxWorkGroupCountX CONSTANT)
44 Q_PROPERTY(int maxWorkGroupCountY READ maxWorkGroupCountY CONSTANT)
45 Q_PROPERTY(int maxWorkGroupCountZ READ maxWorkGroupCountZ CONSTANT)
46 Q_PROPERTY(int maxWorkGroupSizeX READ maxWorkGroupSizeX CONSTANT)
47 Q_PROPERTY(int maxWorkGroupSizeY READ maxWorkGroupSizeY CONSTANT)
48 Q_PROPERTY(int maxWorkGroupSizeZ READ maxWorkGroupSizeZ CONSTANT)
49 Q_PROPERTY(int maxComputeInvocations READ maxComputeInvocations CONSTANT)
50 Q_PROPERTY(int maxComputeSharedMemorySize READ maxComputeSharedMemorySize CONSTANT)
51public:
52 enum API {
53 OpenGL = QSurfaceFormat::OpenGL, // 1
54 OpenGLES = QSurfaceFormat::OpenGLES, // 2
55 Vulkan = 3, // 3
56 DirectX, // 4
57 RHI, // 5
58 };
59 Q_ENUM(API)
60
61 enum Profile {
62 NoProfile = QSurfaceFormat::NoProfile,
63 CoreProfile = QSurfaceFormat::CoreProfile,
64 CompatibilityProfile = QSurfaceFormat::CompatibilityProfile
65 };
66 Q_ENUM(Profile)
67
68 explicit QRenderCapabilities(QObject *parent = nullptr);
69 ~QRenderCapabilities();
70
71 bool isValid() const;
72 API api() const;
73 Profile profile() const;
74 int majorVersion() const;
75 int minorVersion() const;
76 QStringList extensions() const;
77 QString vendor() const;
78 QString renderer() const;
79 QString driverVersion() const;
80 QString glslVersion() const;
81 int maxSamples() const;
82 int maxTextureSize() const;
83 int maxTextureUnits() const;
84 int maxTextureLayers() const;
85 bool supportsUBO() const;
86 int maxUBOSize() const;
87 int maxUBOBindings() const;
88 bool supportsSSBO() const;
89 int maxSSBOSize() const;
90 int maxSSBOBindings() const;
91 bool supportsImageStore() const;
92 int maxImageUnits() const;
93 bool supportsCompute() const;
94 int maxWorkGroupCountX() const;
95 int maxWorkGroupCountY() const;
96 int maxWorkGroupCountZ() const;
97 int maxWorkGroupSizeX() const;
98 int maxWorkGroupSizeY() const;
99 int maxWorkGroupSizeZ() const;
100 int maxComputeInvocations() const;
101 int maxComputeSharedMemorySize() const;
102
103protected:
104 Q_DECLARE_PRIVATE(QRenderCapabilities)
105};
106
107} // namespace Qt3Drender
108
109QT_END_NAMESPACE
110
111#endif // QT3DRENDER_QRENDERCAPABILITIES_H
112

source code of qt3d/src/render/frontend/qrendercapabilities.h