Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | #ifndef QQUICKOPENGLSHADEREFFECTNODE_P_H | - |
41 | #define QQUICKOPENGLSHADEREFFECTNODE_P_H | - |
42 | | - |
43 | | - |
44 | | - |
45 | | - |
46 | | - |
47 | | - |
48 | | - |
49 | | - |
50 | | - |
51 | | - |
52 | | - |
53 | | - |
54 | #include <private/qtquickglobal_p.h> | - |
55 | | - |
56 | QT_REQUIRE_CONFIG(quick_shadereffect); | - |
57 | | - |
58 | #include <QtQuick/qsgnode.h> | - |
59 | #include <QtQuick/qsgmaterial.h> | - |
60 | #include <QtQuick/qsgtextureprovider.h> | - |
61 | #include <QtQuick/qquickitem.h> | - |
62 | #include <private/qtquickglobal_p.h> | - |
63 | #include <private/qquickshadereffect_p.h> | - |
64 | | - |
65 | #include <QtCore/qsharedpointer.h> | - |
66 | #include <QtCore/qpointer.h> | - |
67 | | - |
68 | QT_BEGIN_NAMESPACE | - |
69 | | - |
70 | struct QQuickOpenGLShaderEffectMaterialKey { | - |
71 | enum ShaderType | - |
72 | { | - |
73 | VertexShader, | - |
74 | FragmentShader, | - |
75 | ShaderTypeCount | - |
76 | }; | - |
77 | | - |
78 | QByteArray sourceCode[ShaderTypeCount]; | - |
79 | | - |
80 | bool operator == (const QQuickOpenGLShaderEffectMaterialKey &other) const; | - |
81 | bool operator != (const QQuickOpenGLShaderEffectMaterialKey &other) const; | - |
82 | }; | - |
83 | | - |
84 | uint qHash(const QQuickOpenGLShaderEffectMaterialKey &key); | - |
85 | | - |
86 | class QQuickCustomMaterialShader; | - |
87 | class QQuickOpenGLShaderEffectNode; | - |
88 | class Q_QUICK_PRIVATE_EXPORT QQuickOpenGLShaderEffectMaterial : public QSGMaterial | - |
89 | { | - |
90 | public: | - |
91 | struct UniformData | - |
92 | { | - |
93 | enum SpecialType { None, Sampler, SamplerExternal, SubRect, Opacity, Matrix }; | - |
94 | | - |
95 | QByteArray name; | - |
96 | QVariant value; | - |
97 | int propertyIndex = -1; | - |
98 | SpecialType specialType; | - |
99 | | - |
100 | bool operator == (const UniformData &other) const; | - |
101 | | - |
102 | void setValueFromProperty(QObject *item, const QMetaObject *itemMetaObject) | - |
103 | { | - |
104 | if (propertyIndex == -1) {TRUE | evaluated 46 times by 5 testsEvaluated by:- tst_examples
- tst_qquickborderimage
- tst_qquickcustomparticle
- tst_qquickitemlayer
- tst_qquickshadereffect
| FALSE | evaluated 94 times by 3 testsEvaluated by:- tst_examples
- tst_qquickitemlayer
- tst_qquickshadereffect
|
| 46-94 |
105 | value = item->property(name); | - |
106 | } else {executed 46 times by 5 tests: end of block Executed by:- tst_examples
- tst_qquickborderimage
- tst_qquickcustomparticle
- tst_qquickitemlayer
- tst_qquickshadereffect
| 46 |
107 | value = itemMetaObject->property(propertyIndex).read(item); | - |
108 | }executed 94 times by 3 tests: end of block Executed by:- tst_examples
- tst_qquickitemlayer
- tst_qquickshadereffect
| 94 |
109 | } | - |
110 | }; | - |
111 | | - |
112 | explicit QQuickOpenGLShaderEffectMaterial(QQuickOpenGLShaderEffectNode *node = nullptr); | - |
113 | QSGMaterialType *type() const override; | - |
114 | QSGMaterialShader *createShader() const override; | - |
115 | int compare(const QSGMaterial *other) const override; | - |
116 | | - |
117 | QVector<QByteArray> attributes; | - |
118 | QVector<UniformData> uniforms[QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount]; | - |
119 | QVector<QSGTextureProvider *> textureProviders; | - |
120 | QQuickShaderEffect::CullMode cullMode; | - |
121 | bool geometryUsesTextureSubRect; | - |
122 | | - |
123 | void setProgramSource(const QQuickOpenGLShaderEffectMaterialKey &source); | - |
124 | void updateTextures() const; | - |
125 | void invalidateTextureProvider(QSGTextureProvider *provider); | - |
126 | | - |
127 | static void cleanupMaterialCache(); | - |
128 | | - |
129 | protected: | - |
130 | friend class QQuickCustomMaterialShader; | - |
131 | | - |
132 | | - |
133 | | - |
134 | | - |
135 | | - |
136 | | - |
137 | QSGMaterialType *m_type; | - |
138 | QQuickOpenGLShaderEffectMaterialKey m_source; | - |
139 | | - |
140 | QQuickOpenGLShaderEffectNode *m_node; | - |
141 | bool m_emittedLogChanged; | - |
142 | }; | - |
143 | | - |
144 | | - |
145 | class QSGShaderEffectMesh; | - |
146 | | - |
147 | class Q_QUICK_PRIVATE_EXPORT QQuickOpenGLShaderEffectNode : public QObject, public QSGGeometryNode | - |
148 | { | - |
149 | Q_OBJECT | - |
150 | public: | - |
151 | QQuickOpenGLShaderEffectNode(); | - |
152 | ~QQuickOpenGLShaderEffectNode() override; | - |
153 | | - |
154 | void preprocess() override; | - |
155 | | - |
156 | Q_SIGNALS: | - |
157 | void logAndStatusChanged(const QString &, int status); | - |
158 | void dirtyTexture(); | - |
159 | | - |
160 | private Q_SLOTS: | - |
161 | void markDirtyTexture(); | - |
162 | void textureProviderDestroyed(QObject *object); | - |
163 | }; | - |
164 | | - |
165 | QT_END_NAMESPACE | - |
166 | | - |
167 | #endif // QQUICKOPENGLSHADEREFFECTNODE_P_H | - |
| | |