1 | // Copyright (C) 2017 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_QSHADERFORMAT_P_H |
5 | #define QT3DRENDER_QSHADERFORMAT_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 <Qt3DRender/private/qt3drender_global_p.h> |
19 | |
20 | #include <QtCore/qstringlist.h> |
21 | #include <QtCore/qversionnumber.h> |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | namespace Qt3DRender |
25 | { |
26 | class QShaderFormat |
27 | { |
28 | public: |
29 | enum Api : int { |
30 | NoApi, |
31 | OpenGLNoProfile, |
32 | OpenGLCoreProfile, |
33 | OpenGLCompatibilityProfile, |
34 | OpenGLES, |
35 | VulkanFlavoredGLSL, |
36 | RHI |
37 | }; |
38 | |
39 | enum ShaderType : int { |
40 | Vertex = 0, |
41 | TessellationControl, |
42 | TessellationEvaluation, |
43 | Geometry, |
44 | Fragment, |
45 | Compute |
46 | }; |
47 | |
48 | Q_3DRENDERSHARED_PRIVATE_EXPORT QShaderFormat() noexcept; |
49 | |
50 | Q_3DRENDERSHARED_PRIVATE_EXPORT Api api() const noexcept; |
51 | Q_3DRENDERSHARED_PRIVATE_EXPORT void setApi(Api api) noexcept; |
52 | |
53 | Q_3DRENDERSHARED_PRIVATE_EXPORT QVersionNumber version() const noexcept; |
54 | Q_3DRENDERSHARED_PRIVATE_EXPORT void setVersion(const QVersionNumber &version) noexcept; |
55 | |
56 | Q_3DRENDERSHARED_PRIVATE_EXPORT QStringList extensions() const noexcept; |
57 | Q_3DRENDERSHARED_PRIVATE_EXPORT void setExtensions(const QStringList &extensions) noexcept; |
58 | |
59 | Q_3DRENDERSHARED_PRIVATE_EXPORT QString vendor() const noexcept; |
60 | Q_3DRENDERSHARED_PRIVATE_EXPORT void setVendor(const QString &vendor) noexcept; |
61 | |
62 | Q_3DRENDERSHARED_PRIVATE_EXPORT bool isValid() const noexcept; |
63 | Q_3DRENDERSHARED_PRIVATE_EXPORT bool supports(const QShaderFormat &other) const noexcept; |
64 | |
65 | Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderType shaderType() const noexcept; |
66 | Q_3DRENDERSHARED_PRIVATE_EXPORT void setShaderType(ShaderType shaderType) noexcept; |
67 | |
68 | private: |
69 | Api m_api; |
70 | QVersionNumber m_version; |
71 | QStringList m_extensions; |
72 | QString m_vendor; |
73 | ShaderType m_shaderType; |
74 | }; |
75 | |
76 | Q_3DRENDERSHARED_PRIVATE_EXPORT bool operator==(const QShaderFormat &lhs, const QShaderFormat &rhs) noexcept; |
77 | |
78 | inline bool operator!=(const QShaderFormat &lhs, const QShaderFormat &rhs) noexcept |
79 | { |
80 | return !(lhs == rhs); |
81 | } |
82 | |
83 | |
84 | } |
85 | Q_DECLARE_TYPEINFO(Qt3DRender::QShaderFormat, Q_RELOCATABLE_TYPE); |
86 | QT_END_NAMESPACE |
87 | |
88 | Q_DECLARE_METATYPE(Qt3DRender::QShaderFormat) |
89 | |
90 | #endif // QT3DRENDER_QSHADERFORMAT_P_H |
91 | |