| 1 | // Copyright (C) 2014 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_QGRAPHICSAPIFILTER_H |
| 5 | #define QT3DRENDER_QGRAPHICSAPIFILTER_H |
| 6 | |
| 7 | #include <QtCore/QObject> |
| 8 | #include <QtCore/QStringList> |
| 9 | #include <Qt3DRender/qt3drender_global.h> |
| 10 | #include <QtGui/QSurfaceFormat> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | namespace Qt3DRender { |
| 15 | |
| 16 | class QGraphicsApiFilterPrivate; |
| 17 | |
| 18 | class Q_3DRENDERSHARED_EXPORT QGraphicsApiFilter : public QObject |
| 19 | { |
| 20 | Q_OBJECT |
| 21 | Q_PROPERTY(Qt3DRender::QGraphicsApiFilter::Api api READ api WRITE setApi NOTIFY apiChanged) |
| 22 | Q_PROPERTY(Qt3DRender::QGraphicsApiFilter::OpenGLProfile profile READ profile WRITE setProfile NOTIFY profileChanged) |
| 23 | Q_PROPERTY(int minorVersion READ minorVersion WRITE setMinorVersion NOTIFY minorVersionChanged) |
| 24 | Q_PROPERTY(int majorVersion READ majorVersion WRITE setMajorVersion NOTIFY majorVersionChanged) |
| 25 | Q_PROPERTY(QStringList extensions READ extensions WRITE setExtensions NOTIFY extensionsChanged) |
| 26 | Q_PROPERTY(QString vendor READ vendor WRITE setVendor NOTIFY vendorChanged) |
| 27 | |
| 28 | public: |
| 29 | |
| 30 | enum Api { |
| 31 | OpenGLES = QSurfaceFormat::OpenGLES, // 2 |
| 32 | OpenGL = QSurfaceFormat::OpenGL, // 1 |
| 33 | Vulkan = 3, // 3 |
| 34 | DirectX, // 4 |
| 35 | RHI, // 5 |
| 36 | }; |
| 37 | Q_ENUM(Api) // LCOV_EXCL_LINE |
| 38 | |
| 39 | enum OpenGLProfile { |
| 40 | NoProfile = QSurfaceFormat::NoProfile, |
| 41 | CoreProfile = QSurfaceFormat::CoreProfile, |
| 42 | CompatibilityProfile = QSurfaceFormat::CompatibilityProfile |
| 43 | }; |
| 44 | Q_ENUM(OpenGLProfile) // LCOV_EXCL_LINE |
| 45 | |
| 46 | explicit QGraphicsApiFilter(QObject *parent = nullptr); |
| 47 | ~QGraphicsApiFilter(); |
| 48 | |
| 49 | Api api() const; |
| 50 | OpenGLProfile profile() const; |
| 51 | int minorVersion() const; |
| 52 | int majorVersion() const; |
| 53 | QStringList extensions() const; |
| 54 | QString vendor() const; |
| 55 | |
| 56 | public Q_SLOTS: |
| 57 | void setApi(Api api); |
| 58 | void setProfile(OpenGLProfile profile); |
| 59 | void setMinorVersion(int minorVersion); |
| 60 | void setMajorVersion(int majorVersion); |
| 61 | void setExtensions(const QStringList &extensions); |
| 62 | void setVendor(const QString &vendor); |
| 63 | |
| 64 | Q_SIGNALS: |
| 65 | void apiChanged(Qt3DRender::QGraphicsApiFilter::Api api); |
| 66 | void profileChanged(Qt3DRender::QGraphicsApiFilter::OpenGLProfile profile); |
| 67 | void minorVersionChanged(int minorVersion); |
| 68 | void majorVersionChanged(int majorVersion); |
| 69 | void extensionsChanged(const QStringList &extensions); |
| 70 | void vendorChanged(const QString &vendor); |
| 71 | void graphicsApiFilterChanged(); |
| 72 | |
| 73 | private: |
| 74 | Q_DECLARE_PRIVATE(QGraphicsApiFilter) |
| 75 | }; |
| 76 | |
| 77 | Q_AUTOTEST_EXPORT bool operator ==(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample); |
| 78 | Q_AUTOTEST_EXPORT bool operator !=(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample); |
| 79 | |
| 80 | } // namespace Qt3DRender |
| 81 | |
| 82 | QT_END_NAMESPACE |
| 83 | |
| 84 | #endif // QT3DRENDER_QGRAPHICSAPIFILTER_H |
| 85 |
