qopenglengineshadermanager.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/opengl/qopenglengineshadermanager.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12class QOpenGLEngineSharedShadersResource : public QOpenGLSharedResource-
13{-
14public:-
15 QOpenGLEngineSharedShadersResource(QOpenGLContext *ctx)-
16 : QOpenGLSharedResource(ctx->shareGroup())-
17 , m_shaders(new QOpenGLEngineSharedShaders(ctx))-
18 {-
19 }
never executed: end of block
0
20-
21 ~QOpenGLEngineSharedShadersResource()-
22 {-
23 delete m_shaders;-
24 }
never executed: end of block
0
25-
26 void invalidateResource() override-
27 {-
28 delete m_shaders;-
29 m_shaders = 0;-
30 }
never executed: end of block
0
31-
32 void freeResource(QOpenGLContext *) override-
33 {-
34 }-
35-
36 QOpenGLEngineSharedShaders *shaders() const { return
never executed: return m_shaders;
m_shaders;
never executed: return m_shaders;
}
0
37-
38private:-
39 QOpenGLEngineSharedShaders *m_shaders;-
40};-
41-
42class QOpenGLShaderStorage-
43{-
44public:-
45 QOpenGLEngineSharedShaders *shadersForThread(QOpenGLContext *context) {-
46 QOpenGLMultiGroupSharedResource *&shaders = m_storage.localData();-
47 if (!shaders
!shadersDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
48 shaders = new QOpenGLMultiGroupSharedResource;
never executed: shaders = new QOpenGLMultiGroupSharedResource;
0
49 QOpenGLEngineSharedShadersResource *resource =-
50 shaders->value<QOpenGLEngineSharedShadersResource>(context);-
51 return
never executed: return resource ? resource->shaders() : 0;
resource ? resource->shaders() : 0;
never executed: return resource ? resource->shaders() : 0;
0
52 }-
53-
54private:-
55 QThreadStorage<QOpenGLMultiGroupSharedResource *> m_storage;-
56};-
57-
58namespace { namespace Q_QGS_qt_shader_storage { typedef QOpenGLShaderStorage Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QOpenGLShaderStorage, Q_QGS_qt_shader_storage::innerFunction, Q_QGS_qt_shader_storage::guard> qt_shader_storage;;
0
59-
60QOpenGLEngineSharedShaders *QOpenGLEngineSharedShaders::shadersForContext(QOpenGLContext *context)-
61{-
62 return
never executed: return qt_shader_storage()->shadersForThread(context);
qt_shader_storage()->shadersForThread(context);
never executed: return qt_shader_storage()->shadersForThread(context);
0
63}-
64-
65const char* QOpenGLEngineSharedShaders::qShaderSnippets[] = {-
66 0,0,0,0,0,0,0,0,0,0,-
67 0,0,0,0,0,0,0,0,0,0,-
68 0,0,0,0,0,0,0,0,0,0,-
69 0,0,0,0,0-
70};-
71-
72QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)-
73 : blitShaderProg(0)-
74 , simpleShaderProg(0)-
75{-
76-
77-
78-
79-
80-
81-
82-
83 static bool snippetsPopulated = false;-
84 if (!snippetsPopulated
!snippetsPopulatedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
85-
86 const char** code = qShaderSnippets;-
87-
88 code[MainVertexShader] = qopenglslMainVertexShader;-
89 code[MainWithTexCoordsVertexShader] = qopenglslMainWithTexCoordsVertexShader;-
90 code[MainWithTexCoordsAndOpacityVertexShader] = qopenglslMainWithTexCoordsAndOpacityVertexShader;-
91-
92 code[UntransformedPositionVertexShader] = qopenglslUntransformedPositionVertexShader;-
93 code[PositionOnlyVertexShader] = qopenglslPositionOnlyVertexShader;-
94 code[ComplexGeometryPositionOnlyVertexShader] = qopenglslComplexGeometryPositionOnlyVertexShader;-
95 code[PositionWithPatternBrushVertexShader] = qopenglslPositionWithPatternBrushVertexShader;-
96 code[PositionWithLinearGradientBrushVertexShader] = qopenglslPositionWithLinearGradientBrushVertexShader;-
97 code[PositionWithConicalGradientBrushVertexShader] = qopenglslPositionWithConicalGradientBrushVertexShader;-
98 code[PositionWithRadialGradientBrushVertexShader] = qopenglslPositionWithRadialGradientBrushVertexShader;-
99 code[PositionWithTextureBrushVertexShader] = qopenglslPositionWithTextureBrushVertexShader;-
100 code[AffinePositionWithPatternBrushVertexShader] = qopenglslAffinePositionWithPatternBrushVertexShader;-
101 code[AffinePositionWithLinearGradientBrushVertexShader] = qopenglslAffinePositionWithLinearGradientBrushVertexShader;-
102 code[AffinePositionWithConicalGradientBrushVertexShader] = qopenglslAffinePositionWithConicalGradientBrushVertexShader;-
103 code[AffinePositionWithRadialGradientBrushVertexShader] = qopenglslAffinePositionWithRadialGradientBrushVertexShader;-
104 code[AffinePositionWithTextureBrushVertexShader] = qopenglslAffinePositionWithTextureBrushVertexShader;-
105-
106 code[MainFragmentShader_CMO] = qopenglslMainFragmentShader_CMO;-
107 code[MainFragmentShader_CM] = qopenglslMainFragmentShader_CM;-
108 code[MainFragmentShader_MO] = qopenglslMainFragmentShader_MO;-
109 code[MainFragmentShader_M] = qopenglslMainFragmentShader_M;-
110 code[MainFragmentShader_CO] = qopenglslMainFragmentShader_CO;-
111 code[MainFragmentShader_C] = qopenglslMainFragmentShader_C;-
112 code[MainFragmentShader_O] = qopenglslMainFragmentShader_O;-
113 code[MainFragmentShader] = qopenglslMainFragmentShader;-
114 code[MainFragmentShader_ImageArrays] = qopenglslMainFragmentShader_ImageArrays;-
115-
116 code[ImageSrcFragmentShader] = qopenglslImageSrcFragmentShader;-
117 code[ImageSrcWithPatternFragmentShader] = qopenglslImageSrcWithPatternFragmentShader;-
118 code[NonPremultipliedImageSrcFragmentShader] = qopenglslNonPremultipliedImageSrcFragmentShader;-
119 code[GrayscaleImageSrcFragmentShader] = qopenglslGrayscaleImageSrcFragmentShader;-
120 code[AlphaImageSrcFragmentShader] = qopenglslAlphaImageSrcFragmentShader;-
121 code[CustomImageSrcFragmentShader] = qopenglslCustomSrcFragmentShader;-
122 code[SolidBrushSrcFragmentShader] = qopenglslSolidBrushSrcFragmentShader;-
123 if (context->isOpenGLES()
context->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
124 code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_ES;
never executed: code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_ES;
0
125 else-
126 code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_desktop;
never executed: code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_desktop;
0
127 code[TextureBrushSrcWithPatternFragmentShader] = qopenglslTextureBrushSrcWithPatternFragmentShader;-
128 code[PatternBrushSrcFragmentShader] = qopenglslPatternBrushSrcFragmentShader;-
129 code[LinearGradientBrushSrcFragmentShader] = qopenglslLinearGradientBrushSrcFragmentShader;-
130 code[RadialGradientBrushSrcFragmentShader] = qopenglslRadialGradientBrushSrcFragmentShader;-
131 code[ConicalGradientBrushSrcFragmentShader] = qopenglslConicalGradientBrushSrcFragmentShader;-
132 code[ShockingPinkSrcFragmentShader] = qopenglslShockingPinkSrcFragmentShader;-
133-
134 code[NoMaskFragmentShader] = "";-
135 code[MaskFragmentShader] = qopenglslMaskFragmentShader;-
136 code[RgbMaskFragmentShaderPass1] = qopenglslRgbMaskFragmentShaderPass1;-
137 code[RgbMaskFragmentShaderPass2] = qopenglslRgbMaskFragmentShaderPass2;-
138 code[RgbMaskWithGammaFragmentShader] = "";-
139-
140 code[NoCompositionModeFragmentShader] = "";-
141 code[MultiplyCompositionModeFragmentShader] = "";-
142 code[ScreenCompositionModeFragmentShader] = "";-
143 code[OverlayCompositionModeFragmentShader] = "";-
144 code[DarkenCompositionModeFragmentShader] = "";-
145 code[LightenCompositionModeFragmentShader] = "";-
146 code[ColorDodgeCompositionModeFragmentShader] = "";-
147 code[ColorBurnCompositionModeFragmentShader] = "";-
148 code[HardLightCompositionModeFragmentShader] = "";-
149 code[SoftLightCompositionModeFragmentShader] = "";-
150 code[DifferenceCompositionModeFragmentShader] = "";-
151 code[ExclusionCompositionModeFragmentShader] = "";-
152-
153-
154-
155 for (int i = 0; i < TotalSnippetCount
i < TotalSnippetCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
156 if (__builtin_expect(!!(!qShaderSnippets[i]), false)
__builtin_expe...ts[i]), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
157 QMessageLogger(__FILE__, 203, __PRETTY_FUNCTION__).fatal("Shader snippet for %s (#%d) is missing!",-
158 snippetNameStr(SnippetName(i)).constData(), i);-
159 }
never executed: end of block
0
160 }
never executed: end of block
0
161-
162 snippetsPopulated = true;-
163 }
never executed: end of block
0
164-
165 QOpenGLShader* fragShader;-
166 QOpenGLShader* vertexShader;-
167 QByteArray vertexSource;-
168 QByteArray fragSource;-
169-
170-
171 vertexSource.append(qShaderSnippets[MainVertexShader]);-
172 vertexSource.append(qShaderSnippets[PositionOnlyVertexShader]);-
173-
174 fragSource.append(qShaderSnippets[MainFragmentShader]);-
175 fragSource.append(qShaderSnippets[ShockingPinkSrcFragmentShader]);-
176-
177 simpleShaderProg = new QOpenGLShaderProgram;-
178-
179 CachedShader simpleShaderCache(fragSource, vertexSource);-
180-
181 bool inCache = simpleShaderCache.load(simpleShaderProg, context);-
182-
183 if (!inCache
!inCacheDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
184 vertexShader = new QOpenGLShader(QOpenGLShader::Vertex);-
185 shaders.append(vertexShader);-
186 if (!vertexShader->compileSourceCode(vertexSource)
!vertexShader-...(vertexSource)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
187 QMessageLogger(__FILE__, 233, __PRETTY_FUNCTION__).warning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile");
never executed: QMessageLogger(__FILE__, 233, __PRETTY_FUNCTION__).warning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile");
0
188-
189 fragShader = new QOpenGLShader(QOpenGLShader::Fragment);-
190 shaders.append(fragShader);-
191 if (!fragShader->compileSourceCode(fragSource)
!fragShader->c...de(fragSource)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
192 QMessageLogger(__FILE__, 238, __PRETTY_FUNCTION__).warning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile");
never executed: QMessageLogger(__FILE__, 238, __PRETTY_FUNCTION__).warning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile");
0
193-
194 simpleShaderProg->addShader(vertexShader);-
195 simpleShaderProg->addShader(fragShader);-
196-
197 simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);-
198 simpleShaderProg->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR);-
199 simpleShaderProg->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR);-
200 simpleShaderProg->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR);-
201 }
never executed: end of block
0
202-
203 simpleShaderProg->link();-
204-
205 if (__builtin_expect(!!(!simpleShaderProg->isLinked()), false)
__builtin_expe...ked()), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
206 QMessageLogger(__FILE__, 252, __PRETTY_FUNCTION__).critical("Errors linking simple shader: %s", QString(simpleShaderProg->log()).toLocal8Bit().constData());-
207 }
never executed: end of block
else {
0
208 if (!inCache
!inCacheDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
209 simpleShaderCache.store(simpleShaderProg, context);
never executed: simpleShaderCache.store(simpleShaderProg, context);
0
210 }
never executed: end of block
0
211-
212-
213 vertexSource.clear();-
214 vertexSource.append(qShaderSnippets[MainWithTexCoordsVertexShader]);-
215 vertexSource.append(qShaderSnippets[UntransformedPositionVertexShader]);-
216-
217 fragSource.clear();-
218 fragSource.append(qShaderSnippets[MainFragmentShader]);-
219 fragSource.append(qShaderSnippets[ImageSrcFragmentShader]);-
220-
221 blitShaderProg = new QOpenGLShaderProgram;-
222-
223 CachedShader blitShaderCache(fragSource, vertexSource);-
224-
225 inCache = blitShaderCache.load(blitShaderProg, context);-
226-
227 if (!inCache
!inCacheDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
228 vertexShader = new QOpenGLShader(QOpenGLShader::Vertex);-
229 shaders.append(vertexShader);-
230 if (!vertexShader->compileSourceCode(vertexSource)
!vertexShader-...(vertexSource)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
231 QMessageLogger(__FILE__, 277, __PRETTY_FUNCTION__).warning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile");
never executed: QMessageLogger(__FILE__, 277, __PRETTY_FUNCTION__).warning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile");
0
232-
233 fragShader = new QOpenGLShader(QOpenGLShader::Fragment);-
234 shaders.append(fragShader);-
235 if (!fragShader->compileSourceCode(fragSource)
!fragShader->c...de(fragSource)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
236 QMessageLogger(__FILE__, 282, __PRETTY_FUNCTION__).warning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile");
never executed: QMessageLogger(__FILE__, 282, __PRETTY_FUNCTION__).warning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile");
0
237-
238 blitShaderProg->addShader(vertexShader);-
239 blitShaderProg->addShader(fragShader);-
240-
241 blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);-
242 blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);-
243 }
never executed: end of block
0
244-
245 blitShaderProg->link();-
246 if (__builtin_expect(!!(!blitShaderProg->isLinked()), false)
__builtin_expe...ked()), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
247 QMessageLogger(__FILE__, 293, __PRETTY_FUNCTION__).critical("Errors linking blit shader: %s", QString(blitShaderProg->log()).toLocal8Bit().constData());-
248 }
never executed: end of block
else {
0
249 if (!inCache
!inCacheDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
250 blitShaderCache.store(blitShaderProg, context);
never executed: blitShaderCache.store(blitShaderProg, context);
0
251 }
never executed: end of block
0
252-
253-
254-
255-
256}-
257-
258QOpenGLEngineSharedShaders::~QOpenGLEngineSharedShaders()-
259{-
260-
261-
262-
263 qDeleteAll(shaders);-
264 shaders.clear();-
265-
266 qDeleteAll(cachedPrograms);-
267 cachedPrograms.clear();-
268-
269 if (blitShaderProg
blitShaderProgDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
270 delete blitShaderProg;-
271 blitShaderProg = 0;-
272 }
never executed: end of block
0
273-
274 if (simpleShaderProg
simpleShaderProgDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
275 delete simpleShaderProg;-
276 simpleShaderProg = 0;-
277 }
never executed: end of block
0
278}
never executed: end of block
0
279-
280-
281QByteArray QOpenGLEngineSharedShaders::snippetNameStr(SnippetName name)-
282{-
283 QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("SnippetName"));-
284 return
never executed: return QByteArray(m.valueToKey(name));
QByteArray(m.valueToKey(name));
never executed: return QByteArray(m.valueToKey(name));
0
285}-
286-
287-
288-
289-
290QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QOpenGLEngineShaderProg &prog)-
291{-
292 for (int i = 0; i < cachedPrograms.size()
i < cachedPrograms.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
293 QOpenGLEngineShaderProg *cachedProg = cachedPrograms[i];-
294 if (*
*cachedProg == progDescription
TRUEnever evaluated
FALSEnever evaluated
cachedProg == prog
*cachedProg == progDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
295-
296 cachedPrograms.move(i, 0);-
297 cachedProg->program->bind();-
298 return
never executed: return cachedProg;
cachedProg;
never executed: return cachedProg;
0
299 }-
300 }
never executed: end of block
0
301-
302 QScopedPointer<QOpenGLEngineShaderProg> newProg;-
303-
304 do {-
305 QByteArray fragSource;-
306-
307-
308 if (prog.srcPixelFragShader == CustomImageSrcFragmentShader
prog.srcPixelF...FragmentShaderDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
309 fragSource.append(prog.customStageSource);
never executed: fragSource.append(prog.customStageSource);
0
310 fragSource.append(qShaderSnippets[prog.mainFragShader]);-
311 fragSource.append(qShaderSnippets[prog.srcPixelFragShader]);-
312 if (prog.compositionFragShader
prog.compositionFragShaderDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
313 fragSource.append(qShaderSnippets[prog.compositionFragShader]);
never executed: fragSource.append(qShaderSnippets[prog.compositionFragShader]);
0
314 if (prog.maskFragShader
prog.maskFragShaderDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
315 fragSource.append(qShaderSnippets[prog.maskFragShader]);
never executed: fragSource.append(qShaderSnippets[prog.maskFragShader]);
0
316-
317 QByteArray vertexSource;-
318 vertexSource.append(qShaderSnippets[prog.mainVertexShader]);-
319 vertexSource.append(qShaderSnippets[prog.positionVertexShader]);-
320-
321 QScopedPointer<QOpenGLShaderProgram> shaderProgram(new QOpenGLShaderProgram);-
322-
323 CachedShader shaderCache(fragSource, vertexSource);-
324 bool inCache = shaderCache.load(shaderProgram.data(), QOpenGLContext::currentContext());-
325-
326 if (!inCache
!inCacheDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
327-
328 QScopedPointer<QOpenGLShader> fragShader(new QOpenGLShader(QOpenGLShader::Fragment));-
329 QByteArray description;-
330-
331-
332 description.append("Fragment shader: main=");-
333 description.append(snippetNameStr(prog.mainFragShader));-
334 description.append(", srcPixel=");-
335 description.append(snippetNameStr(prog.srcPixelFragShader));-
336 if (prog.compositionFragShader
prog.compositionFragShaderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
337 description.append(", composition=");-
338 description.append(snippetNameStr(prog.compositionFragShader));-
339 }
never executed: end of block
0
340 if (prog.maskFragShader
prog.maskFragShaderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
341 description.append(", mask=");-
342 description.append(snippetNameStr(prog.maskFragShader));-
343 }
never executed: end of block
0
344 fragShader->setObjectName(QString::fromLatin1(description));-
345-
346 if (!fragShader->compileSourceCode(fragSource)
!fragShader->c...de(fragSource)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
347 QMessageLogger(__FILE__, 393, __PRETTY_FUNCTION__).warning() << "Warning:" << description << "failed to compile!";-
348 break;
never executed: break;
0
349 }-
350-
351 QScopedPointer<QOpenGLShader> vertexShader(new QOpenGLShader(QOpenGLShader::Vertex));-
352-
353-
354 description.clear();-
355 description.append("Vertex shader: main=");-
356 description.append(snippetNameStr(prog.mainVertexShader));-
357 description.append(", position=");-
358 description.append(snippetNameStr(prog.positionVertexShader));-
359 vertexShader->setObjectName(QString::fromLatin1(description));-
360-
361 if (!vertexShader->compileSourceCode(vertexSource)
!vertexShader-...(vertexSource)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
362 QMessageLogger(__FILE__, 408, __PRETTY_FUNCTION__).warning() << "Warning:" << description << "failed to compile!";-
363 break;
never executed: break;
0
364 }-
365-
366 shaders.append(vertexShader.data());-
367 shaders.append(fragShader.data());-
368 shaderProgram->addShader(vertexShader.take());-
369 shaderProgram->addShader(fragShader.take());-
370-
371-
372 shaderProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);-
373 if (prog.useTextureCoords
prog.useTextureCoordsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
374 shaderProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
never executed: shaderProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
0
375 if (prog.useOpacityAttribute
prog.useOpacityAttributeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
376 shaderProgram->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR);
never executed: shaderProgram->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR);
0
377 if (prog.usePmvMatrixAttribute
prog.usePmvMatrixAttributeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
378 shaderProgram->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR);-
379 shaderProgram->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR);-
380 shaderProgram->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR);-
381 }
never executed: end of block
0
382 }
never executed: end of block
0
383-
384 newProg.reset(new QOpenGLEngineShaderProg(prog));-
385 newProg->program = shaderProgram.take();-
386-
387 newProg->program->link();-
388 if (newProg->program->isLinked()
newProg->program->isLinked()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
389 if (!inCache
!inCacheDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
390 shaderCache.store(newProg->program, QOpenGLContext::currentContext());
never executed: shaderCache.store(newProg->program, QOpenGLContext::currentContext());
0
391 }
never executed: end of block
else {
0
392 QString error;-
393 error = QLatin1String("Shader program failed to link,");-
394-
395 QLatin1String br("\n");-
396 error += QLatin1String("\n Shaders Used:\n");-
397 for (int i = 0; i < newProg->program->shaders().count()
i < newProg->p...ders().count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
398 QOpenGLShader *shader = newProg->program->shaders().at(i);-
399 error += QLatin1String(" ") + shader->objectName() + QLatin1String(": \n")-
400 + QLatin1String(shader->sourceCode()) + br;-
401 }
never executed: end of block
0
402-
403 error += QLatin1String(" Error Log:\n")-
404 + QLatin1String(" ") + newProg->program->log();-
405 QMessageLogger(__FILE__, 451, __PRETTY_FUNCTION__).warning() << error;-
406 break;
never executed: break;
0
407 }-
408-
409 newProg->program->bind();-
410-
411 if (newProg->maskFragShader != QOpenGLEngineSharedShaders::NoMaskFragmentShader
newProg->maskF...FragmentShaderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
412 GLuint location = newProg->program->uniformLocation("maskTexture");-
413 newProg->program->setUniformValue(location, GLuint(1));-
414 }
never executed: end of block
0
415-
416 if (cachedPrograms.count() > 30
cachedPrograms.count() > 30Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
417-
418-
419-
420 for (int i = 0; i < 5
i < 5Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
421 delete cachedPrograms.last();-
422 cachedPrograms.removeLast();-
423 }
never executed: end of block
0
424 }
never executed: end of block
0
425-
426 cachedPrograms.insert(0, newProg.data());-
427 } while (false);-
428-
429 return
never executed: return newProg.take();
newProg.take();
never executed: return newProg.take();
0
430}-
431-
432void QOpenGLEngineSharedShaders::cleanupCustomStage(QOpenGLCustomShaderStage* stage)-
433{-
434 auto hasStageAsCustomShaderSouce = [stage](QOpenGLEngineShaderProg *cachedProg) -> bool {-
435 if (cachedProg->customStageSource == stage->source()
cachedProg->cu...tage->source()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
436 delete cachedProg;-
437 return
never executed: return true;
true;
never executed: return true;
0
438 }-
439 return
never executed: return false;
false;
never executed: return false;
0
440 };-
441 cachedPrograms.erase(std::remove_if(cachedPrograms.begin(), cachedPrograms.end(),-
442 hasStageAsCustomShaderSouce),-
443 cachedPrograms.end());-
444}
never executed: end of block
0
445-
446-
447QOpenGLEngineShaderManager::QOpenGLEngineShaderManager(QOpenGLContext* context)-
448 : ctx(context),-
449 shaderProgNeedsChanging(true),-
450 complexGeometry(false),-
451 srcPixelType(Qt::NoBrush),-
452 opacityMode(NoOpacity),-
453 maskType(NoMask),-
454 compositionMode(QPainter::CompositionMode_SourceOver),-
455 customSrcStage(0),-
456 currentShaderProg(0)-
457{-
458 sharedShaders = QOpenGLEngineSharedShaders::shadersForContext(context);-
459}
never executed: end of block
0
460-
461QOpenGLEngineShaderManager::~QOpenGLEngineShaderManager()-
462{-
463-
464 removeCustomStage();-
465}
never executed: end of block
0
466-
467GLuint QOpenGLEngineShaderManager::getUniformLocation(Uniform id)-
468{-
469 if (!currentShaderProg
!currentShaderProgDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
470 return
never executed: return 0;
0;
never executed: return 0;
0
471-
472 QVector<uint> &uniformLocations = currentShaderProg->uniformLocations;-
473 if (uniformLocations.isEmpty()
uniformLocations.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
474 uniformLocations.fill(GLuint(-1), NumUniforms);
never executed: uniformLocations.fill(GLuint(-1), NumUniforms);
0
475-
476 static const char *const uniformNames[] = {-
477 "imageTexture",-
478 "patternColor",-
479 "globalOpacity",-
480 "depth",-
481 "maskTexture",-
482 "fragmentColor",-
483 "linearData",-
484 "angle",-
485 "halfViewportSize",-
486 "fmp",-
487 "fmp2_m_radius2",-
488 "inverse_2_fmp2_m_radius2",-
489 "sqrfr",-
490 "bradius",-
491 "invertedTextureSize",-
492 "brushTransform",-
493 "brushTexture",-
494 "matrix"-
495 };-
496-
497 if (uniformLocations.at(id) == GLuint(-1)
uniformLocatio... == GLuint(-1)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
498 uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformNames[id]);
never executed: uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformNames[id]);
0
499-
500 return
never executed: return uniformLocations.at(id);
uniformLocations.at(id);
never executed: return uniformLocations.at(id);
0
501}-
502-
503-
504void QOpenGLEngineShaderManager::optimiseForBrushTransform(QTransform::TransformationType transformType)-
505{-
506 (void)transformType;;-
507}
never executed: end of block
0
508-
509void QOpenGLEngineShaderManager::setDirty()-
510{-
511 shaderProgNeedsChanging = true;-
512}
never executed: end of block
0
513-
514void QOpenGLEngineShaderManager::setSrcPixelType(Qt::BrushStyle style)-
515{-
516 ((!(style != Qt::NoBrush)) ? qt_assert("style != Qt::NoBrush",__FILE__,562) : qt_noop());-
517 if (srcPixelType == PixelSrcType(style)
srcPixelType =...SrcType(style)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
518 return;
never executed: return;
0
519-
520 srcPixelType = style;-
521 shaderProgNeedsChanging = true;-
522}
never executed: end of block
0
523-
524void QOpenGLEngineShaderManager::setSrcPixelType(PixelSrcType type)-
525{-
526 if (srcPixelType == type
srcPixelType == typeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
527 return;
never executed: return;
0
528-
529 srcPixelType = type;-
530 shaderProgNeedsChanging = true;-
531}
never executed: end of block
0
532-
533void QOpenGLEngineShaderManager::setOpacityMode(OpacityMode mode)-
534{-
535 if (opacityMode == mode
opacityMode == modeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
536 return;
never executed: return;
0
537-
538 opacityMode = mode;-
539 shaderProgNeedsChanging = true;-
540}
never executed: end of block
0
541-
542void QOpenGLEngineShaderManager::setMaskType(MaskType type)-
543{-
544 if (maskType == type
maskType == typeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
545 return;
never executed: return;
0
546-
547 maskType = type;-
548 shaderProgNeedsChanging = true;-
549}
never executed: end of block
0
550-
551void QOpenGLEngineShaderManager::setCompositionMode(QPainter::CompositionMode mode)-
552{-
553 if (compositionMode == mode
compositionMode == modeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
554 return;
never executed: return;
0
555-
556 compositionMode = mode;-
557 shaderProgNeedsChanging = true;-
558}
never executed: end of block
0
559-
560void QOpenGLEngineShaderManager::setCustomStage(QOpenGLCustomShaderStage* stage)-
561{-
562 if (customSrcStage
customSrcStageDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
563 removeCustomStage();
never executed: removeCustomStage();
0
564 customSrcStage = stage;-
565 shaderProgNeedsChanging = true;-
566}
never executed: end of block
0
567-
568void QOpenGLEngineShaderManager::removeCustomStage()-
569{-
570 if (customSrcStage
customSrcStageDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
571 customSrcStage->setInactive();
never executed: customSrcStage->setInactive();
0
572 customSrcStage = 0;-
573 shaderProgNeedsChanging = true;-
574}
never executed: end of block
0
575-
576QOpenGLShaderProgram* QOpenGLEngineShaderManager::currentProgram()-
577{-
578 if (currentShaderProg
currentShaderProgDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
579 return
never executed: return currentShaderProg->program;
currentShaderProg->program;
never executed: return currentShaderProg->program;
0
580 else-
581 return
never executed: return sharedShaders->simpleProgram();
sharedShaders->simpleProgram();
never executed: return sharedShaders->simpleProgram();
0
582}-
583-
584void QOpenGLEngineShaderManager::useSimpleProgram()-
585{-
586 sharedShaders->simpleProgram()->bind();-
587 QOpenGLContextPrivate* ctx_d = ctx->d_func();-
588 (void)ctx_d;;-
589-
590 QOpenGL2PaintEngineEx *active_engine = static_cast<QOpenGL2PaintEngineEx *>(ctx_d->active_engine);-
591-
592 active_engine->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);-
593 active_engine->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);-
594 active_engine->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);-
595-
596 shaderProgNeedsChanging = true;-
597}
never executed: end of block
0
598-
599void QOpenGLEngineShaderManager::useBlitProgram()-
600{-
601 sharedShaders->blitProgram()->bind();-
602 QOpenGLContextPrivate* ctx_d = ctx->d_func();-
603 QOpenGL2PaintEngineEx *active_engine = static_cast<QOpenGL2PaintEngineEx *>(ctx_d->active_engine);-
604 active_engine->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);-
605 active_engine->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, true);-
606 active_engine->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);-
607 shaderProgNeedsChanging = true;-
608}
never executed: end of block
0
609-
610QOpenGLShaderProgram* QOpenGLEngineShaderManager::simpleProgram()-
611{-
612 return
never executed: return sharedShaders->simpleProgram();
sharedShaders->simpleProgram();
never executed: return sharedShaders->simpleProgram();
0
613}-
614-
615QOpenGLShaderProgram* QOpenGLEngineShaderManager::blitProgram()-
616{-
617 return
never executed: return sharedShaders->blitProgram();
sharedShaders->blitProgram();
never executed: return sharedShaders->blitProgram();
0
618}-
619-
620-
621-
622-
623-
624bool QOpenGLEngineShaderManager::useCorrectShaderProg()-
625{-
626 if (!shaderProgNeedsChanging
!shaderProgNeedsChangingDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
627 return
never executed: return false;
false;
never executed: return false;
0
628-
629 bool useCustomSrc = customSrcStage != 0;-
630 if (useCustomSrc
useCustomSrcDescription
TRUEnever evaluated
FALSEnever evaluated
&& srcPixelType != QOpenGLEngineShaderManager::ImageSrc
srcPixelType !...ager::ImageSrcDescription
TRUEnever evaluated
FALSEnever evaluated
&& srcPixelType != Qt::TexturePattern
srcPixelType !...TexturePatternDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
631 useCustomSrc = false;-
632 QMessageLogger(__FILE__, 678, __PRETTY_FUNCTION__).warning("QOpenGLEngineShaderManager - Ignoring custom shader stage for non image src");-
633 }
never executed: end of block
0
634-
635 QOpenGLEngineShaderProg requiredProgram;-
636-
637 bool texCoords = false;-
638-
639-
640-
641 requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::InvalidSnippetName;-
642 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::InvalidSnippetName;-
643 bool isAffine = brushTransform.isAffine();-
644 if ( (
(srcPixelType ...Dense1Pattern)Description
TRUEnever evaluated
FALSEnever evaluated
srcPixelType >= Qt::Dense1Pattern)
(srcPixelType ...Dense1Pattern)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(srcPixelType ...gCrossPattern)Description
TRUEnever evaluated
FALSEnever evaluated
srcPixelType <= Qt::DiagCrossPattern)
(srcPixelType ...gCrossPattern)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
645 if (isAffine
isAffineDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
646 requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader;
never executed: requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader;
0
647 else-
648 requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionWithPatternBrushVertexShader;
never executed: requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionWithPatternBrushVertexShader;
0
649-
650 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::PatternBrushSrcFragmentShader;-
651 }
never executed: end of block
0
652 else switch (srcPixelType) {-
653 default
never executed: default:
:
never executed: default:
0
654 case
never executed: case Qt::NoBrush:
Qt::NoBrush:
never executed: case Qt::NoBrush:
0
655 QMessageLogger(__FILE__, 701, __PRETTY_FUNCTION__).fatal("QOpenGLEngineShaderManager::useCorrectShaderProg() - Qt::NoBrush style is set");-
656 break;
never executed: break;
0
657 case
never executed: case QOpenGLEngineShaderManager::ImageSrc:
QOpenGLEngineShaderManager::ImageSrc:
never executed: case QOpenGLEngineShaderManager::ImageSrc:
0
658 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::ImageSrcFragmentShader;-
659 requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;-
660 texCoords = true;-
661 break;
never executed: break;
0
662 case
never executed: case QOpenGLEngineShaderManager::NonPremultipliedImageSrc:
QOpenGLEngineShaderManager::NonPremultipliedImageSrc:
never executed: case QOpenGLEngineShaderManager::NonPremultipliedImageSrc:
0
663 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader;-
664 requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;-
665 texCoords = true;-
666 break;
never executed: break;
0
667 case
never executed: case QOpenGLEngineShaderManager::GrayscaleImageSrc:
QOpenGLEngineShaderManager::GrayscaleImageSrc:
never executed: case QOpenGLEngineShaderManager::GrayscaleImageSrc:
0
668 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::GrayscaleImageSrcFragmentShader;-
669 requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;-
670 texCoords = true;-
671 break;
never executed: break;
0
672 case
never executed: case QOpenGLEngineShaderManager::AlphaImageSrc:
QOpenGLEngineShaderManager::AlphaImageSrc:
never executed: case QOpenGLEngineShaderManager::AlphaImageSrc:
0
673 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::AlphaImageSrcFragmentShader;-
674 requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;-
675 texCoords = true;-
676 break;
never executed: break;
0
677 case
never executed: case QOpenGLEngineShaderManager::PatternSrc:
QOpenGLEngineShaderManager::PatternSrc:
never executed: case QOpenGLEngineShaderManager::PatternSrc:
0
678 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::ImageSrcWithPatternFragmentShader;-
679 requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;-
680 texCoords = true;-
681 break;
never executed: break;
0
682 case
never executed: case QOpenGLEngineShaderManager::TextureSrcWithPattern:
QOpenGLEngineShaderManager::TextureSrcWithPattern:
never executed: case QOpenGLEngineShaderManager::TextureSrcWithPattern:
0
683 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader;-
684 requiredProgram.positionVertexShader = isAffine
isAffineDescription
TRUEnever evaluated
FALSEnever evaluated
? QOpenGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader
0
685 : QOpenGLEngineSharedShaders::PositionWithTextureBrushVertexShader;-
686 break;
never executed: break;
0
687 case
never executed: case Qt::SolidPattern:
Qt::SolidPattern:
never executed: case Qt::SolidPattern:
0
688 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::SolidBrushSrcFragmentShader;-
689 requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;-
690 break;
never executed: break;
0
691 case
never executed: case Qt::LinearGradientPattern:
Qt::LinearGradientPattern:
never executed: case Qt::LinearGradientPattern:
0
692 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader;-
693 requiredProgram.positionVertexShader = isAffine
isAffineDescription
TRUEnever evaluated
FALSEnever evaluated
? QOpenGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader
0
694 : QOpenGLEngineSharedShaders::PositionWithLinearGradientBrushVertexShader;-
695 break;
never executed: break;
0
696 case
never executed: case Qt::ConicalGradientPattern:
Qt::ConicalGradientPattern:
never executed: case Qt::ConicalGradientPattern:
0
697 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader;-
698 requiredProgram.positionVertexShader = isAffine
isAffineDescription
TRUEnever evaluated
FALSEnever evaluated
? QOpenGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader
0
699 : QOpenGLEngineSharedShaders::PositionWithConicalGradientBrushVertexShader;-
700 break;
never executed: break;
0
701 case
never executed: case Qt::RadialGradientPattern:
Qt::RadialGradientPattern:
never executed: case Qt::RadialGradientPattern:
0
702 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader;-
703 requiredProgram.positionVertexShader = isAffine
isAffineDescription
TRUEnever evaluated
FALSEnever evaluated
? QOpenGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader
0
704 : QOpenGLEngineSharedShaders::PositionWithRadialGradientBrushVertexShader;-
705 break;
never executed: break;
0
706 case
never executed: case Qt::TexturePattern:
Qt::TexturePattern:
never executed: case Qt::TexturePattern:
0
707 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::TextureBrushSrcFragmentShader;-
708 requiredProgram.positionVertexShader = isAffine
isAffineDescription
TRUEnever evaluated
FALSEnever evaluated
? QOpenGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader
0
709 : QOpenGLEngineSharedShaders::PositionWithTextureBrushVertexShader;-
710 break;
never executed: break;
0
711 };-
712-
713 if (useCustomSrc
useCustomSrcDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
714 requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::CustomImageSrcFragmentShader;-
715 requiredProgram.customStageSource = customSrcStage->source();-
716 }
never executed: end of block
0
717-
718 const bool hasCompose = compositionMode > QPainter::CompositionMode_Plus;-
719 const bool hasMask = maskType != QOpenGLEngineShaderManager::NoMask;-
720-
721-
722 if (opacityMode == AttributeOpacity
opacityMode ==...tributeOpacityDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
723 ((!(!hasCompose && !hasMask)) ? qt_assert("!hasCompose && !hasMask",__FILE__,769) : qt_noop());-
724 requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_ImageArrays;-
725 }
never executed: end of block
else {
0
726 bool useGlobalOpacity = (opacityMode == UniformOpacity);-
727 if (hasCompose
hasComposeDescription
TRUEnever evaluated
FALSEnever evaluated
&& hasMask
hasMaskDescription
TRUEnever evaluated
FALSEnever evaluated
&& useGlobalOpacity
useGlobalOpacityDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
728 requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_CMO;
never executed: requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_CMO;
0
729 if (hasCompose
hasComposeDescription
TRUEnever evaluated
FALSEnever evaluated
&& hasMask
hasMaskDescription
TRUEnever evaluated
FALSEnever evaluated
&& !useGlobalOpacity
!useGlobalOpacityDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
730 requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_CM;
never executed: requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_CM;
0
731 if (!hasCompose
!hasComposeDescription
TRUEnever evaluated
FALSEnever evaluated
&& hasMask
hasMaskDescription
TRUEnever evaluated
FALSEnever evaluated
&& useGlobalOpacity
useGlobalOpacityDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
732 requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_MO;
never executed: requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_MO;
0
733 if (!hasCompose
!hasComposeDescription
TRUEnever evaluated
FALSEnever evaluated
&& hasMask
hasMaskDescription
TRUEnever evaluated
FALSEnever evaluated
&& !useGlobalOpacity
!useGlobalOpacityDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
734 requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_M;
never executed: requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_M;
0
735 if (hasCompose
hasComposeDescription
TRUEnever evaluated
FALSEnever evaluated
&& !hasMask
!hasMaskDescription
TRUEnever evaluated
FALSEnever evaluated
&& useGlobalOpacity
useGlobalOpacityDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
736 requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_CO;
never executed: requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_CO;
0
737 if (hasCompose
hasComposeDescription
TRUEnever evaluated
FALSEnever evaluated
&& !hasMask
!hasMaskDescription
TRUEnever evaluated
FALSEnever evaluated
&& !useGlobalOpacity
!useGlobalOpacityDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
738 requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_C;
never executed: requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_C;
0
739 if (!hasCompose
!hasComposeDescription
TRUEnever evaluated
FALSEnever evaluated
&& !hasMask
!hasMaskDescription
TRUEnever evaluated
FALSEnever evaluated
&& useGlobalOpacity
useGlobalOpacityDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
740 requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_O;
never executed: requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_O;
0
741 if (!hasCompose
!hasComposeDescription
TRUEnever evaluated
FALSEnever evaluated
&& !hasMask
!hasMaskDescription
TRUEnever evaluated
FALSEnever evaluated
&& !useGlobalOpacity
!useGlobalOpacityDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
742 requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader;
never executed: requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader;
0
743 }
never executed: end of block
0
744-
745 if (hasMask
hasMaskDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
746 if (maskType == PixelMask
maskType == PixelMaskDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
747 requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::MaskFragmentShader;-
748 texCoords = true;-
749 }
never executed: end of block
else if (maskType == SubPixelMaskPass1
maskType == SubPixelMaskPass1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
750 requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::RgbMaskFragmentShaderPass1;-
751 texCoords = true;-
752 }
never executed: end of block
else if (maskType == SubPixelMaskPass2
maskType == SubPixelMaskPass2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
753 requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::RgbMaskFragmentShaderPass2;-
754 texCoords = true;-
755 }
never executed: end of block
else if (maskType == SubPixelWithGammaMask
maskType == Su...lWithGammaMaskDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
756 requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::RgbMaskWithGammaFragmentShader;-
757 texCoords = true;-
758 }
never executed: end of block
else {
0
759 QMessageLogger(__FILE__, 805, __PRETTY_FUNCTION__).critical("QOpenGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type");-
760 }
never executed: end of block
0
761 } else {-
762 requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::NoMaskFragmentShader;-
763 }
never executed: end of block
0
764-
765 if (hasCompose
hasComposeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
766 switch (compositionMode) {-
767 case
never executed: case QPainter::CompositionMode_Multiply:
QPainter::CompositionMode_Multiply:
never executed: case QPainter::CompositionMode_Multiply:
0
768 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::MultiplyCompositionModeFragmentShader;-
769 break;
never executed: break;
0
770 case
never executed: case QPainter::CompositionMode_Screen:
QPainter::CompositionMode_Screen:
never executed: case QPainter::CompositionMode_Screen:
0
771 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ScreenCompositionModeFragmentShader;-
772 break;
never executed: break;
0
773 case
never executed: case QPainter::CompositionMode_Overlay:
QPainter::CompositionMode_Overlay:
never executed: case QPainter::CompositionMode_Overlay:
0
774 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::OverlayCompositionModeFragmentShader;-
775 break;
never executed: break;
0
776 case
never executed: case QPainter::CompositionMode_Darken:
QPainter::CompositionMode_Darken:
never executed: case QPainter::CompositionMode_Darken:
0
777 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::DarkenCompositionModeFragmentShader;-
778 break;
never executed: break;
0
779 case
never executed: case QPainter::CompositionMode_Lighten:
QPainter::CompositionMode_Lighten:
never executed: case QPainter::CompositionMode_Lighten:
0
780 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::LightenCompositionModeFragmentShader;-
781 break;
never executed: break;
0
782 case
never executed: case QPainter::CompositionMode_ColorDodge:
QPainter::CompositionMode_ColorDodge:
never executed: case QPainter::CompositionMode_ColorDodge:
0
783 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader;-
784 break;
never executed: break;
0
785 case
never executed: case QPainter::CompositionMode_ColorBurn:
QPainter::CompositionMode_ColorBurn:
never executed: case QPainter::CompositionMode_ColorBurn:
0
786 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader;-
787 break;
never executed: break;
0
788 case
never executed: case QPainter::CompositionMode_HardLight:
QPainter::CompositionMode_HardLight:
never executed: case QPainter::CompositionMode_HardLight:
0
789 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::HardLightCompositionModeFragmentShader;-
790 break;
never executed: break;
0
791 case
never executed: case QPainter::CompositionMode_SoftLight:
QPainter::CompositionMode_SoftLight:
never executed: case QPainter::CompositionMode_SoftLight:
0
792 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::SoftLightCompositionModeFragmentShader;-
793 break;
never executed: break;
0
794 case
never executed: case QPainter::CompositionMode_Difference:
QPainter::CompositionMode_Difference:
never executed: case QPainter::CompositionMode_Difference:
0
795 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::DifferenceCompositionModeFragmentShader;-
796 break;
never executed: break;
0
797 case
never executed: case QPainter::CompositionMode_Exclusion:
QPainter::CompositionMode_Exclusion:
never executed: case QPainter::CompositionMode_Exclusion:
0
798 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ExclusionCompositionModeFragmentShader;-
799 break;
never executed: break;
0
800 default
never executed: default:
:
never executed: default:
0
801 QMessageLogger(__FILE__, 847, __PRETTY_FUNCTION__).warning("QOpenGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode");-
802 }
never executed: end of block
0
803 } else {-
804 requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::NoCompositionModeFragmentShader;-
805 }
never executed: end of block
0
806-
807-
808 if (opacityMode == AttributeOpacity
opacityMode ==...tributeOpacityDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
809 ((!(texCoords)) ? qt_assert("texCoords",__FILE__,855) : qt_noop());-
810 requiredProgram.mainVertexShader = QOpenGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader;-
811 }
never executed: end of block
else if (texCoords
texCoordsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
812 requiredProgram.mainVertexShader = QOpenGLEngineSharedShaders::MainWithTexCoordsVertexShader;-
813 }
never executed: end of block
else {
0
814 requiredProgram.mainVertexShader = QOpenGLEngineSharedShaders::MainVertexShader;-
815 }
never executed: end of block
0
816 requiredProgram.useTextureCoords = texCoords;-
817 requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity);-
818 if (complexGeometry
complexGeometryDescription
TRUEnever evaluated
FALSEnever evaluated
&& srcPixelType == Qt::SolidPattern
srcPixelType =...::SolidPatternDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
819 requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::ComplexGeometryPositionOnlyVertexShader;-
820 requiredProgram.usePmvMatrixAttribute = false;-
821 }
never executed: end of block
else {
0
822 requiredProgram.usePmvMatrixAttribute = true;-
823-
824-
825-
826 complexGeometry = false;-
827 }
never executed: end of block
0
828-
829-
830 currentShaderProg = sharedShaders->findProgramInCache(requiredProgram);-
831-
832 if (currentShaderProg
currentShaderProgDescription
TRUEnever evaluated
FALSEnever evaluated
&& useCustomSrc
useCustomSrcDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
833 customSrcStage->setUniforms(currentShaderProg->program);-
834 }
never executed: end of block
0
835-
836-
837-
838 QOpenGLContextPrivate* ctx_d = ctx->d_func();-
839 QOpenGL2PaintEngineEx *active_engine = static_cast<QOpenGL2PaintEngineEx *>(ctx_d->active_engine);-
840 active_engine->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);-
841 active_engine->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, currentShaderProg && currentShaderProg->useTextureCoords);-
842 active_engine->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, currentShaderProg && currentShaderProg->useOpacityAttribute);-
843-
844 shaderProgNeedsChanging = false;-
845 return
never executed: return true;
true;
never executed: return true;
0
846}-
847-
848-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9