gl2paintengineex/qglengineshadermanager.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtOpenGL module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qglengineshadermanager_p.h" -
43#include "qglengineshadersource_p.h" -
44#include "qpaintengineex_opengl2_p.h" -
45#include "qglshadercache_p.h" -
46 -
47#include <QtGui/private/qopenglcontext_p.h> -
48 -
49#if defined(QT_DEBUG) -
50#include <QMetaEnum> -
51#endif -
52 -
53// #define QT_GL_SHARED_SHADER_DEBUG -
54 -
55QT_BEGIN_NAMESPACE -
56 -
57class QGLEngineSharedShadersResource : public QOpenGLSharedResource -
58{ -
59public: -
60 QGLEngineSharedShadersResource(QOpenGLContext *ctx) -
61 : QOpenGLSharedResource(ctx->shareGroup()) -
62 , m_shaders(new QGLEngineSharedShaders(QGLContext::fromOpenGLContext(ctx))) -
63 { -
64 }
never executed: }
0
65 -
66 ~QGLEngineSharedShadersResource() -
67 { -
68 delete m_shaders;
never executed (the execution status of this line is deduced): delete m_shaders;
-
69 }
never executed: }
0
70 -
71 void invalidateResource() -
72 { -
73 delete m_shaders;
never executed (the execution status of this line is deduced): delete m_shaders;
-
74 m_shaders = 0;
never executed (the execution status of this line is deduced): m_shaders = 0;
-
75 }
never executed: }
0
76 -
77 void freeResource(QOpenGLContext *) -
78 { -
79 } -
80 -
81 QGLEngineSharedShaders *shaders() const { return m_shaders; }
never executed: return m_shaders;
0
82 -
83private: -
84 QGLEngineSharedShaders *m_shaders; -
85}; -
86 -
87class QGLShaderStorage -
88{ -
89public: -
90 QGLEngineSharedShaders *shadersForThread(const QGLContext *context) { -
91 QOpenGLMultiGroupSharedResource *&shaders = m_storage.localData();
never executed (the execution status of this line is deduced): QOpenGLMultiGroupSharedResource *&shaders = m_storage.localData();
-
92 if (!shaders)
never evaluated: !shaders
0
93 shaders = new QOpenGLMultiGroupSharedResource;
never executed: shaders = new QOpenGLMultiGroupSharedResource;
0
94 QGLEngineSharedShadersResource *resource =
never executed (the execution status of this line is deduced): QGLEngineSharedShadersResource *resource =
-
95 shaders->value<QGLEngineSharedShadersResource>(context->contextHandle());
never executed (the execution status of this line is deduced): shaders->value<QGLEngineSharedShadersResource>(context->contextHandle());
-
96 return resource ? resource->shaders() : 0;
never executed: return resource ? resource->shaders() : 0;
0
97 } -
98 -
99private: -
100 QThreadStorage<QOpenGLMultiGroupSharedResource *> m_storage; -
101}; -
102 -
103Q_GLOBAL_STATIC(QGLShaderStorage, qt_shader_storage);
never executed: delete x;
never executed: return thisGlobalStatic.pointer.load();
never evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
never evaluated: !thisGlobalStatic.pointer.load()
never evaluated: !thisGlobalStatic.destroyed
0
104 -
105QGLEngineSharedShaders *QGLEngineSharedShaders::shadersForContext(const QGLContext *context) -
106{ -
107 return qt_shader_storage()->shadersForThread(context);
never executed: return qt_shader_storage()->shadersForThread(context);
0
108} -
109 -
110const char* QGLEngineSharedShaders::qShaderSnippets[] = { -
111 0,0,0,0,0,0,0,0,0,0, -
112 0,0,0,0,0,0,0,0,0,0, -
113 0,0,0,0,0,0,0,0,0,0, -
114 0,0,0,0,0 -
115}; -
116 -
117QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) -
118 : blitShaderProg(0) -
119 , simpleShaderProg(0) -
120{ -
121 -
122/* -
123 Rather than having the shader source array statically initialised, it is initialised -
124 here instead. This is to allow new shader names to be inserted or existing names moved -
125 around without having to change the order of the glsl strings. It is hoped this will -
126 make future hard-to-find runtime bugs more obvious and generally give more solid code. -
127*/ -
128 static bool snippetsPopulated = false; -
129 if (!snippetsPopulated) {
never evaluated: !snippetsPopulated
0
130 -
131 const char** code = qShaderSnippets; // shortcut
never executed (the execution status of this line is deduced): const char** code = qShaderSnippets;
-
132 -
133 code[MainVertexShader] = qglslMainVertexShader;
never executed (the execution status of this line is deduced): code[MainVertexShader] = qglslMainVertexShader;
-
134 code[MainWithTexCoordsVertexShader] = qglslMainWithTexCoordsVertexShader;
never executed (the execution status of this line is deduced): code[MainWithTexCoordsVertexShader] = qglslMainWithTexCoordsVertexShader;
-
135 code[MainWithTexCoordsAndOpacityVertexShader] = qglslMainWithTexCoordsAndOpacityVertexShader;
never executed (the execution status of this line is deduced): code[MainWithTexCoordsAndOpacityVertexShader] = qglslMainWithTexCoordsAndOpacityVertexShader;
-
136 -
137 code[UntransformedPositionVertexShader] = qglslUntransformedPositionVertexShader;
never executed (the execution status of this line is deduced): code[UntransformedPositionVertexShader] = qglslUntransformedPositionVertexShader;
-
138 code[PositionOnlyVertexShader] = qglslPositionOnlyVertexShader;
never executed (the execution status of this line is deduced): code[PositionOnlyVertexShader] = qglslPositionOnlyVertexShader;
-
139 code[ComplexGeometryPositionOnlyVertexShader] = qglslComplexGeometryPositionOnlyVertexShader;
never executed (the execution status of this line is deduced): code[ComplexGeometryPositionOnlyVertexShader] = qglslComplexGeometryPositionOnlyVertexShader;
-
140 code[PositionWithPatternBrushVertexShader] = qglslPositionWithPatternBrushVertexShader;
never executed (the execution status of this line is deduced): code[PositionWithPatternBrushVertexShader] = qglslPositionWithPatternBrushVertexShader;
-
141 code[PositionWithLinearGradientBrushVertexShader] = qglslPositionWithLinearGradientBrushVertexShader;
never executed (the execution status of this line is deduced): code[PositionWithLinearGradientBrushVertexShader] = qglslPositionWithLinearGradientBrushVertexShader;
-
142 code[PositionWithConicalGradientBrushVertexShader] = qglslPositionWithConicalGradientBrushVertexShader;
never executed (the execution status of this line is deduced): code[PositionWithConicalGradientBrushVertexShader] = qglslPositionWithConicalGradientBrushVertexShader;
-
143 code[PositionWithRadialGradientBrushVertexShader] = qglslPositionWithRadialGradientBrushVertexShader;
never executed (the execution status of this line is deduced): code[PositionWithRadialGradientBrushVertexShader] = qglslPositionWithRadialGradientBrushVertexShader;
-
144 code[PositionWithTextureBrushVertexShader] = qglslPositionWithTextureBrushVertexShader;
never executed (the execution status of this line is deduced): code[PositionWithTextureBrushVertexShader] = qglslPositionWithTextureBrushVertexShader;
-
145 code[AffinePositionWithPatternBrushVertexShader] = qglslAffinePositionWithPatternBrushVertexShader;
never executed (the execution status of this line is deduced): code[AffinePositionWithPatternBrushVertexShader] = qglslAffinePositionWithPatternBrushVertexShader;
-
146 code[AffinePositionWithLinearGradientBrushVertexShader] = qglslAffinePositionWithLinearGradientBrushVertexShader;
never executed (the execution status of this line is deduced): code[AffinePositionWithLinearGradientBrushVertexShader] = qglslAffinePositionWithLinearGradientBrushVertexShader;
-
147 code[AffinePositionWithConicalGradientBrushVertexShader] = qglslAffinePositionWithConicalGradientBrushVertexShader;
never executed (the execution status of this line is deduced): code[AffinePositionWithConicalGradientBrushVertexShader] = qglslAffinePositionWithConicalGradientBrushVertexShader;
-
148 code[AffinePositionWithRadialGradientBrushVertexShader] = qglslAffinePositionWithRadialGradientBrushVertexShader;
never executed (the execution status of this line is deduced): code[AffinePositionWithRadialGradientBrushVertexShader] = qglslAffinePositionWithRadialGradientBrushVertexShader;
-
149 code[AffinePositionWithTextureBrushVertexShader] = qglslAffinePositionWithTextureBrushVertexShader;
never executed (the execution status of this line is deduced): code[AffinePositionWithTextureBrushVertexShader] = qglslAffinePositionWithTextureBrushVertexShader;
-
150 -
151 code[MainFragmentShader_CMO] = qglslMainFragmentShader_CMO;
never executed (the execution status of this line is deduced): code[MainFragmentShader_CMO] = qglslMainFragmentShader_CMO;
-
152 code[MainFragmentShader_CM] = qglslMainFragmentShader_CM;
never executed (the execution status of this line is deduced): code[MainFragmentShader_CM] = qglslMainFragmentShader_CM;
-
153 code[MainFragmentShader_MO] = qglslMainFragmentShader_MO;
never executed (the execution status of this line is deduced): code[MainFragmentShader_MO] = qglslMainFragmentShader_MO;
-
154 code[MainFragmentShader_M] = qglslMainFragmentShader_M;
never executed (the execution status of this line is deduced): code[MainFragmentShader_M] = qglslMainFragmentShader_M;
-
155 code[MainFragmentShader_CO] = qglslMainFragmentShader_CO;
never executed (the execution status of this line is deduced): code[MainFragmentShader_CO] = qglslMainFragmentShader_CO;
-
156 code[MainFragmentShader_C] = qglslMainFragmentShader_C;
never executed (the execution status of this line is deduced): code[MainFragmentShader_C] = qglslMainFragmentShader_C;
-
157 code[MainFragmentShader_O] = qglslMainFragmentShader_O;
never executed (the execution status of this line is deduced): code[MainFragmentShader_O] = qglslMainFragmentShader_O;
-
158 code[MainFragmentShader] = qglslMainFragmentShader;
never executed (the execution status of this line is deduced): code[MainFragmentShader] = qglslMainFragmentShader;
-
159 code[MainFragmentShader_ImageArrays] = qglslMainFragmentShader_ImageArrays;
never executed (the execution status of this line is deduced): code[MainFragmentShader_ImageArrays] = qglslMainFragmentShader_ImageArrays;
-
160 -
161 code[ImageSrcFragmentShader] = qglslImageSrcFragmentShader;
never executed (the execution status of this line is deduced): code[ImageSrcFragmentShader] = qglslImageSrcFragmentShader;
-
162 code[ImageSrcWithPatternFragmentShader] = qglslImageSrcWithPatternFragmentShader;
never executed (the execution status of this line is deduced): code[ImageSrcWithPatternFragmentShader] = qglslImageSrcWithPatternFragmentShader;
-
163 code[NonPremultipliedImageSrcFragmentShader] = qglslNonPremultipliedImageSrcFragmentShader;
never executed (the execution status of this line is deduced): code[NonPremultipliedImageSrcFragmentShader] = qglslNonPremultipliedImageSrcFragmentShader;
-
164 code[CustomImageSrcFragmentShader] = qglslCustomSrcFragmentShader; // Calls "customShader", which must be appended
never executed (the execution status of this line is deduced): code[CustomImageSrcFragmentShader] = qglslCustomSrcFragmentShader;
-
165 code[SolidBrushSrcFragmentShader] = qglslSolidBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): code[SolidBrushSrcFragmentShader] = qglslSolidBrushSrcFragmentShader;
-
166 code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader;
-
167 code[TextureBrushSrcWithPatternFragmentShader] = qglslTextureBrushSrcWithPatternFragmentShader;
never executed (the execution status of this line is deduced): code[TextureBrushSrcWithPatternFragmentShader] = qglslTextureBrushSrcWithPatternFragmentShader;
-
168 code[PatternBrushSrcFragmentShader] = qglslPatternBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): code[PatternBrushSrcFragmentShader] = qglslPatternBrushSrcFragmentShader;
-
169 code[LinearGradientBrushSrcFragmentShader] = qglslLinearGradientBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): code[LinearGradientBrushSrcFragmentShader] = qglslLinearGradientBrushSrcFragmentShader;
-
170 code[RadialGradientBrushSrcFragmentShader] = qglslRadialGradientBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): code[RadialGradientBrushSrcFragmentShader] = qglslRadialGradientBrushSrcFragmentShader;
-
171 code[ConicalGradientBrushSrcFragmentShader] = qglslConicalGradientBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): code[ConicalGradientBrushSrcFragmentShader] = qglslConicalGradientBrushSrcFragmentShader;
-
172 code[ShockingPinkSrcFragmentShader] = qglslShockingPinkSrcFragmentShader;
never executed (the execution status of this line is deduced): code[ShockingPinkSrcFragmentShader] = qglslShockingPinkSrcFragmentShader;
-
173 -
174 code[NoMaskFragmentShader] = "";
never executed (the execution status of this line is deduced): code[NoMaskFragmentShader] = "";
-
175 code[MaskFragmentShader] = qglslMaskFragmentShader;
never executed (the execution status of this line is deduced): code[MaskFragmentShader] = qglslMaskFragmentShader;
-
176 code[RgbMaskFragmentShaderPass1] = qglslRgbMaskFragmentShaderPass1;
never executed (the execution status of this line is deduced): code[RgbMaskFragmentShaderPass1] = qglslRgbMaskFragmentShaderPass1;
-
177 code[RgbMaskFragmentShaderPass2] = qglslRgbMaskFragmentShaderPass2;
never executed (the execution status of this line is deduced): code[RgbMaskFragmentShaderPass2] = qglslRgbMaskFragmentShaderPass2;
-
178 code[RgbMaskWithGammaFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[RgbMaskWithGammaFragmentShader] = "";
-
179 -
180 code[NoCompositionModeFragmentShader] = "";
never executed (the execution status of this line is deduced): code[NoCompositionModeFragmentShader] = "";
-
181 code[MultiplyCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[MultiplyCompositionModeFragmentShader] = "";
-
182 code[ScreenCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[ScreenCompositionModeFragmentShader] = "";
-
183 code[OverlayCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[OverlayCompositionModeFragmentShader] = "";
-
184 code[DarkenCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[DarkenCompositionModeFragmentShader] = "";
-
185 code[LightenCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[LightenCompositionModeFragmentShader] = "";
-
186 code[ColorDodgeCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[ColorDodgeCompositionModeFragmentShader] = "";
-
187 code[ColorBurnCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[ColorBurnCompositionModeFragmentShader] = "";
-
188 code[HardLightCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[HardLightCompositionModeFragmentShader] = "";
-
189 code[SoftLightCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[SoftLightCompositionModeFragmentShader] = "";
-
190 code[DifferenceCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[DifferenceCompositionModeFragmentShader] = "";
-
191 code[ExclusionCompositionModeFragmentShader] = ""; //###
never executed (the execution status of this line is deduced): code[ExclusionCompositionModeFragmentShader] = "";
-
192 -
193#if defined(QT_DEBUG) -
194 // Check that all the elements have been filled: -
195 for (int i = 0; i < TotalSnippetCount; ++i) { -
196 if (qShaderSnippets[i] == 0) { -
197 qFatal("Shader snippet for %s (#%d) is missing!", -
198 snippetNameStr(SnippetName(i)).constData(), i); -
199 } -
200 } -
201#endif -
202 snippetsPopulated = true;
never executed (the execution status of this line is deduced): snippetsPopulated = true;
-
203 }
never executed: }
0
204 -
205 QGLShader* fragShader;
never executed (the execution status of this line is deduced): QGLShader* fragShader;
-
206 QGLShader* vertexShader;
never executed (the execution status of this line is deduced): QGLShader* vertexShader;
-
207 QByteArray vertexSource;
never executed (the execution status of this line is deduced): QByteArray vertexSource;
-
208 QByteArray fragSource;
never executed (the execution status of this line is deduced): QByteArray fragSource;
-
209 -
210 // Compile up the simple shader: -
211 vertexSource.append(qShaderSnippets[MainVertexShader]);
never executed (the execution status of this line is deduced): vertexSource.append(qShaderSnippets[MainVertexShader]);
-
212 vertexSource.append(qShaderSnippets[PositionOnlyVertexShader]);
never executed (the execution status of this line is deduced): vertexSource.append(qShaderSnippets[PositionOnlyVertexShader]);
-
213 -
214 fragSource.append(qShaderSnippets[MainFragmentShader]);
never executed (the execution status of this line is deduced): fragSource.append(qShaderSnippets[MainFragmentShader]);
-
215 fragSource.append(qShaderSnippets[ShockingPinkSrcFragmentShader]);
never executed (the execution status of this line is deduced): fragSource.append(qShaderSnippets[ShockingPinkSrcFragmentShader]);
-
216 -
217 simpleShaderProg = new QGLShaderProgram(context, 0);
never executed (the execution status of this line is deduced): simpleShaderProg = new QGLShaderProgram(context, 0);
-
218 -
219 CachedShader simpleShaderCache(fragSource, vertexSource);
never executed (the execution status of this line is deduced): CachedShader simpleShaderCache(fragSource, vertexSource);
-
220 -
221 bool inCache = simpleShaderCache.load(simpleShaderProg, context);
never executed (the execution status of this line is deduced): bool inCache = simpleShaderCache.load(simpleShaderProg, context);
-
222 -
223 if (!inCache) {
never evaluated: !inCache
0
224 vertexShader = new QGLShader(QGLShader::Vertex, context, 0);
never executed (the execution status of this line is deduced): vertexShader = new QGLShader(QGLShader::Vertex, context, 0);
-
225 shaders.append(vertexShader);
never executed (the execution status of this line is deduced): shaders.append(vertexShader);
-
226 if (!vertexShader->compileSourceCode(vertexSource))
never evaluated: !vertexShader->compileSourceCode(vertexSource)
0
227 qWarning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile");
never executed: QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 227, __PRETTY_FUNCTION__).warning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile");
0
228 -
229 fragShader = new QGLShader(QGLShader::Fragment, context, 0);
never executed (the execution status of this line is deduced): fragShader = new QGLShader(QGLShader::Fragment, context, 0);
-
230 shaders.append(fragShader);
never executed (the execution status of this line is deduced): shaders.append(fragShader);
-
231 if (!fragShader->compileSourceCode(fragSource))
never evaluated: !fragShader->compileSourceCode(fragSource)
0
232 qWarning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile");
never executed: QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 232, __PRETTY_FUNCTION__).warning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile");
0
233 -
234 simpleShaderProg->addShader(vertexShader);
never executed (the execution status of this line is deduced): simpleShaderProg->addShader(vertexShader);
-
235 simpleShaderProg->addShader(fragShader);
never executed (the execution status of this line is deduced): simpleShaderProg->addShader(fragShader);
-
236 -
237 simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
never executed (the execution status of this line is deduced): simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
-
238 simpleShaderProg->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR);
never executed (the execution status of this line is deduced): simpleShaderProg->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR);
-
239 simpleShaderProg->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR);
never executed (the execution status of this line is deduced): simpleShaderProg->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR);
-
240 simpleShaderProg->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR);
never executed (the execution status of this line is deduced): simpleShaderProg->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR);
-
241 }
never executed: }
0
242 -
243 simpleShaderProg->link();
never executed (the execution status of this line is deduced): simpleShaderProg->link();
-
244 -
245 if (simpleShaderProg->isLinked()) {
never evaluated: simpleShaderProg->isLinked()
0
246 if (!inCache)
never evaluated: !inCache
0
247 simpleShaderCache.store(simpleShaderProg, context);
never executed: simpleShaderCache.store(simpleShaderProg, context);
0
248 } else {
never executed: }
0
249 qCritical("Errors linking simple shader: %s", qPrintable(simpleShaderProg->log()));
never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 249, __PRETTY_FUNCTION__).critical("Errors linking simple shader: %s", QString(simpleShaderProg->log()).toLocal8Bit().constData());
-
250 }
never executed: }
0
251 -
252 // Compile the blit shader: -
253 vertexSource.clear();
never executed (the execution status of this line is deduced): vertexSource.clear();
-
254 vertexSource.append(qShaderSnippets[MainWithTexCoordsVertexShader]);
never executed (the execution status of this line is deduced): vertexSource.append(qShaderSnippets[MainWithTexCoordsVertexShader]);
-
255 vertexSource.append(qShaderSnippets[UntransformedPositionVertexShader]);
never executed (the execution status of this line is deduced): vertexSource.append(qShaderSnippets[UntransformedPositionVertexShader]);
-
256 -
257 fragSource.clear();
never executed (the execution status of this line is deduced): fragSource.clear();
-
258 fragSource.append(qShaderSnippets[MainFragmentShader]);
never executed (the execution status of this line is deduced): fragSource.append(qShaderSnippets[MainFragmentShader]);
-
259 fragSource.append(qShaderSnippets[ImageSrcFragmentShader]);
never executed (the execution status of this line is deduced): fragSource.append(qShaderSnippets[ImageSrcFragmentShader]);
-
260 -
261 blitShaderProg = new QGLShaderProgram(context, 0);
never executed (the execution status of this line is deduced): blitShaderProg = new QGLShaderProgram(context, 0);
-
262 -
263 CachedShader blitShaderCache(fragSource, vertexSource);
never executed (the execution status of this line is deduced): CachedShader blitShaderCache(fragSource, vertexSource);
-
264 -
265 inCache = blitShaderCache.load(blitShaderProg, context);
never executed (the execution status of this line is deduced): inCache = blitShaderCache.load(blitShaderProg, context);
-
266 -
267 if (!inCache) {
never evaluated: !inCache
0
268 vertexShader = new QGLShader(QGLShader::Vertex, context, 0);
never executed (the execution status of this line is deduced): vertexShader = new QGLShader(QGLShader::Vertex, context, 0);
-
269 shaders.append(vertexShader);
never executed (the execution status of this line is deduced): shaders.append(vertexShader);
-
270 if (!vertexShader->compileSourceCode(vertexSource))
never evaluated: !vertexShader->compileSourceCode(vertexSource)
0
271 qWarning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile");
never executed: QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 271, __PRETTY_FUNCTION__).warning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile");
0
272 -
273 fragShader = new QGLShader(QGLShader::Fragment, context, 0);
never executed (the execution status of this line is deduced): fragShader = new QGLShader(QGLShader::Fragment, context, 0);
-
274 shaders.append(fragShader);
never executed (the execution status of this line is deduced): shaders.append(fragShader);
-
275 if (!fragShader->compileSourceCode(fragSource))
never evaluated: !fragShader->compileSourceCode(fragSource)
0
276 qWarning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile");
never executed: QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 276, __PRETTY_FUNCTION__).warning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile");
0
277 -
278 blitShaderProg->addShader(vertexShader);
never executed (the execution status of this line is deduced): blitShaderProg->addShader(vertexShader);
-
279 blitShaderProg->addShader(fragShader);
never executed (the execution status of this line is deduced): blitShaderProg->addShader(fragShader);
-
280 -
281 blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
never executed (the execution status of this line is deduced): blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
-
282 blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
never executed (the execution status of this line is deduced): blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
-
283 }
never executed: }
0
284 -
285 blitShaderProg->link();
never executed (the execution status of this line is deduced): blitShaderProg->link();
-
286 if (blitShaderProg->isLinked()) {
never evaluated: blitShaderProg->isLinked()
0
287 if (!inCache)
never evaluated: !inCache
0
288 blitShaderCache.store(blitShaderProg, context);
never executed: blitShaderCache.store(blitShaderProg, context);
0
289 } else {
never executed: }
0
290 qCritical("Errors linking blit shader: %s", qPrintable(blitShaderProg->log()));
never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 290, __PRETTY_FUNCTION__).critical("Errors linking blit shader: %s", QString(blitShaderProg->log()).toLocal8Bit().constData());
-
291 }
never executed: }
0
292 -
293#ifdef QT_GL_SHARED_SHADER_DEBUG -
294 qDebug(" -> QGLEngineSharedShaders() %p for thread %p.", this, QThread::currentThread()); -
295#endif -
296} -
297 -
298QGLEngineSharedShaders::~QGLEngineSharedShaders() -
299{ -
300#ifdef QT_GL_SHARED_SHADER_DEBUG -
301 qDebug(" -> ~QGLEngineSharedShaders() %p for thread %p.", this, QThread::currentThread()); -
302#endif -
303 qDeleteAll(shaders);
never executed (the execution status of this line is deduced): qDeleteAll(shaders);
-
304 shaders.clear();
never executed (the execution status of this line is deduced): shaders.clear();
-
305 -
306 qDeleteAll(cachedPrograms);
never executed (the execution status of this line is deduced): qDeleteAll(cachedPrograms);
-
307 cachedPrograms.clear();
never executed (the execution status of this line is deduced): cachedPrograms.clear();
-
308 -
309 if (blitShaderProg) {
never evaluated: blitShaderProg
0
310 delete blitShaderProg;
never executed (the execution status of this line is deduced): delete blitShaderProg;
-
311 blitShaderProg = 0;
never executed (the execution status of this line is deduced): blitShaderProg = 0;
-
312 }
never executed: }
0
313 -
314 if (simpleShaderProg) {
never evaluated: simpleShaderProg
0
315 delete simpleShaderProg;
never executed (the execution status of this line is deduced): delete simpleShaderProg;
-
316 simpleShaderProg = 0;
never executed (the execution status of this line is deduced): simpleShaderProg = 0;
-
317 }
never executed: }
0
318}
never executed: }
0
319 -
320#if defined (QT_DEBUG) -
321QByteArray QGLEngineSharedShaders::snippetNameStr(SnippetName name) -
322{ -
323 QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("SnippetName")); -
324 return QByteArray(m.valueToKey(name)); -
325} -
326#endif -
327 -
328// The address returned here will only be valid until next time this function is called. -
329// The program is return bound. -
330QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineShaderProg &prog) -
331{ -
332 for (int i = 0; i < cachedPrograms.size(); ++i) {
never evaluated: i < cachedPrograms.size()
0
333 QGLEngineShaderProg *cachedProg = cachedPrograms[i];
never executed (the execution status of this line is deduced): QGLEngineShaderProg *cachedProg = cachedPrograms[i];
-
334 if (*cachedProg == prog) {
never evaluated: *cachedProg == prog
0
335 // Move the program to the top of the list as a poor-man's cache algo -
336 cachedPrograms.move(i, 0);
never executed (the execution status of this line is deduced): cachedPrograms.move(i, 0);
-
337 cachedProg->program->bind();
never executed (the execution status of this line is deduced): cachedProg->program->bind();
-
338 return cachedProg;
never executed: return cachedProg;
0
339 } -
340 }
never executed: }
0
341 -
342 QScopedPointer<QGLEngineShaderProg> newProg;
never executed (the execution status of this line is deduced): QScopedPointer<QGLEngineShaderProg> newProg;
-
343 -
344 do { -
345 QByteArray fragSource;
never executed (the execution status of this line is deduced): QByteArray fragSource;
-
346 // Insert the custom stage before the srcPixel shader to work around an ATI driver bug -
347 // where you cannot forward declare a function that takes a sampler as argument. -
348 if (prog.srcPixelFragShader == CustomImageSrcFragmentShader)
never evaluated: prog.srcPixelFragShader == CustomImageSrcFragmentShader
0
349 fragSource.append(prog.customStageSource);
never executed: fragSource.append(prog.customStageSource);
0
350 fragSource.append(qShaderSnippets[prog.mainFragShader]);
never executed (the execution status of this line is deduced): fragSource.append(qShaderSnippets[prog.mainFragShader]);
-
351 fragSource.append(qShaderSnippets[prog.srcPixelFragShader]);
never executed (the execution status of this line is deduced): fragSource.append(qShaderSnippets[prog.srcPixelFragShader]);
-
352 if (prog.compositionFragShader)
never evaluated: prog.compositionFragShader
0
353 fragSource.append(qShaderSnippets[prog.compositionFragShader]);
never executed: fragSource.append(qShaderSnippets[prog.compositionFragShader]);
0
354 if (prog.maskFragShader)
never evaluated: prog.maskFragShader
0
355 fragSource.append(qShaderSnippets[prog.maskFragShader]);
never executed: fragSource.append(qShaderSnippets[prog.maskFragShader]);
0
356 -
357 QByteArray vertexSource;
never executed (the execution status of this line is deduced): QByteArray vertexSource;
-
358 vertexSource.append(qShaderSnippets[prog.mainVertexShader]);
never executed (the execution status of this line is deduced): vertexSource.append(qShaderSnippets[prog.mainVertexShader]);
-
359 vertexSource.append(qShaderSnippets[prog.positionVertexShader]);
never executed (the execution status of this line is deduced): vertexSource.append(qShaderSnippets[prog.positionVertexShader]);
-
360 -
361 QScopedPointer<QGLShaderProgram> shaderProgram(new QGLShaderProgram);
never executed (the execution status of this line is deduced): QScopedPointer<QGLShaderProgram> shaderProgram(new QGLShaderProgram);
-
362 -
363 CachedShader shaderCache(fragSource, vertexSource);
never executed (the execution status of this line is deduced): CachedShader shaderCache(fragSource, vertexSource);
-
364 bool inCache = shaderCache.load(shaderProgram.data(), QGLContext::currentContext());
never executed (the execution status of this line is deduced): bool inCache = shaderCache.load(shaderProgram.data(), QGLContext::currentContext());
-
365 -
366 if (!inCache) {
never evaluated: !inCache
0
367 -
368 QScopedPointer<QGLShader> fragShader(new QGLShader(QGLShader::Fragment));
never executed (the execution status of this line is deduced): QScopedPointer<QGLShader> fragShader(new QGLShader(QGLShader::Fragment));
-
369 QByteArray description;
never executed (the execution status of this line is deduced): QByteArray description;
-
370#if defined(QT_DEBUG) -
371 // Name the shader for easier debugging -
372 description.append("Fragment shader: main="); -
373 description.append(snippetNameStr(prog.mainFragShader)); -
374 description.append(", srcPixel="); -
375 description.append(snippetNameStr(prog.srcPixelFragShader)); -
376 if (prog.compositionFragShader) { -
377 description.append(", composition="); -
378 description.append(snippetNameStr(prog.compositionFragShader)); -
379 } -
380 if (prog.maskFragShader) { -
381 description.append(", mask="); -
382 description.append(snippetNameStr(prog.maskFragShader)); -
383 } -
384 fragShader->setObjectName(QString::fromLatin1(description)); -
385#endif -
386 if (!fragShader->compileSourceCode(fragSource)) {
never evaluated: !fragShader->compileSourceCode(fragSource)
0
387 qWarning() << "Warning:" << description << "failed to compile!";
never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 387, __PRETTY_FUNCTION__).warning() << "Warning:" << description << "failed to compile!";
-
388 break;
never executed: break;
0
389 } -
390 -
391 QScopedPointer<QGLShader> vertexShader(new QGLShader(QGLShader::Vertex));
never executed (the execution status of this line is deduced): QScopedPointer<QGLShader> vertexShader(new QGLShader(QGLShader::Vertex));
-
392#if defined(QT_DEBUG) -
393 // Name the shader for easier debugging -
394 description.clear(); -
395 description.append("Vertex shader: main="); -
396 description.append(snippetNameStr(prog.mainVertexShader)); -
397 description.append(", position="); -
398 description.append(snippetNameStr(prog.positionVertexShader)); -
399 vertexShader->setObjectName(QString::fromLatin1(description)); -
400#endif -
401 if (!vertexShader->compileSourceCode(vertexSource)) {
never evaluated: !vertexShader->compileSourceCode(vertexSource)
0
402 qWarning() << "Warning:" << description << "failed to compile!";
never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 402, __PRETTY_FUNCTION__).warning() << "Warning:" << description << "failed to compile!";
-
403 break;
never executed: break;
0
404 } -
405 -
406 shaders.append(vertexShader.data());
never executed (the execution status of this line is deduced): shaders.append(vertexShader.data());
-
407 shaders.append(fragShader.data());
never executed (the execution status of this line is deduced): shaders.append(fragShader.data());
-
408 shaderProgram->addShader(vertexShader.take());
never executed (the execution status of this line is deduced): shaderProgram->addShader(vertexShader.take());
-
409 shaderProgram->addShader(fragShader.take());
never executed (the execution status of this line is deduced): shaderProgram->addShader(fragShader.take());
-
410 -
411 // We have to bind the vertex attribute names before the program is linked: -
412 shaderProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
never executed (the execution status of this line is deduced): shaderProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
-
413 if (prog.useTextureCoords)
never evaluated: prog.useTextureCoords
0
414 shaderProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
never executed: shaderProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
0
415 if (prog.useOpacityAttribute)
never evaluated: prog.useOpacityAttribute
0
416 shaderProgram->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR);
never executed: shaderProgram->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR);
0
417 if (prog.usePmvMatrixAttribute) {
never evaluated: prog.usePmvMatrixAttribute
0
418 shaderProgram->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR);
never executed (the execution status of this line is deduced): shaderProgram->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR);
-
419 shaderProgram->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR);
never executed (the execution status of this line is deduced): shaderProgram->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR);
-
420 shaderProgram->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR);
never executed (the execution status of this line is deduced): shaderProgram->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR);
-
421 }
never executed: }
0
422 }
never executed: }
0
423 -
424 newProg.reset(new QGLEngineShaderProg(prog));
never executed (the execution status of this line is deduced): newProg.reset(new QGLEngineShaderProg(prog));
-
425 newProg->program = shaderProgram.take();
never executed (the execution status of this line is deduced): newProg->program = shaderProgram.take();
-
426 -
427 newProg->program->link();
never executed (the execution status of this line is deduced): newProg->program->link();
-
428 if (newProg->program->isLinked()) {
never evaluated: newProg->program->isLinked()
0
429 if (!inCache)
never evaluated: !inCache
0
430 shaderCache.store(newProg->program, QGLContext::currentContext());
never executed: shaderCache.store(newProg->program, QGLContext::currentContext());
0
431 } else {
never executed: }
0
432 QLatin1String none("none");
never executed (the execution status of this line is deduced): QLatin1String none("none");
-
433 QLatin1String br("\n");
never executed (the execution status of this line is deduced): QLatin1String br("\n");
-
434 QString error;
never executed (the execution status of this line is deduced): QString error;
-
435 error = QLatin1String("Shader program failed to link,");
never executed (the execution status of this line is deduced): error = QLatin1String("Shader program failed to link,");
-
436#if defined(QT_DEBUG) -
437 error += QLatin1String("\n Shaders Used:\n"); -
438 for (int i = 0; i < newProg->program->shaders().count(); ++i) { -
439 QGLShader *shader = newProg->program->shaders().at(i); -
440 error += QLatin1String(" ") + shader->objectName() + QLatin1String(": \n") -
441 + QLatin1String(shader->sourceCode()) + br; -
442 } -
443#endif -
444 error += QLatin1String(" Error Log:\n")
never executed (the execution status of this line is deduced): error += QLatin1String(" Error Log:\n")
-
445 + QLatin1String(" ") + newProg->program->log();
never executed (the execution status of this line is deduced): + QLatin1String(" ") + newProg->program->log();
-
446 qWarning() << error;
never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 446, __PRETTY_FUNCTION__).warning() << error;
-
447 break;
never executed: break;
0
448 } -
449 -
450 newProg->program->bind();
never executed (the execution status of this line is deduced): newProg->program->bind();
-
451 -
452 if (newProg->maskFragShader != QGLEngineSharedShaders::NoMaskFragmentShader) {
never evaluated: newProg->maskFragShader != QGLEngineSharedShaders::NoMaskFragmentShader
0
453 GLuint location = newProg->program->uniformLocation("maskTexture");
never executed (the execution status of this line is deduced): GLuint location = newProg->program->uniformLocation("maskTexture");
-
454 newProg->program->setUniformValue(location, QT_MASK_TEXTURE_UNIT);
never executed (the execution status of this line is deduced): newProg->program->setUniformValue(location, GLuint(1));
-
455 }
never executed: }
0
456 -
457 if (cachedPrograms.count() > 30) {
never evaluated: cachedPrograms.count() > 30
0
458 // The cache is full, so delete the last 5 programs in the list. -
459 // These programs will be least used, as a program us bumped to -
460 // the top of the list when it's used. -
461 for (int i = 0; i < 5; ++i) {
never evaluated: i < 5
0
462 delete cachedPrograms.last();
never executed (the execution status of this line is deduced): delete cachedPrograms.last();
-
463 cachedPrograms.removeLast();
never executed (the execution status of this line is deduced): cachedPrograms.removeLast();
-
464 }
never executed: }
0
465 }
never executed: }
0
466 -
467 cachedPrograms.insert(0, newProg.data());
never executed (the execution status of this line is deduced): cachedPrograms.insert(0, newProg.data());
-
468 } while (false);
never executed: }
never evaluated: false
0
469 -
470 return newProg.take();
never executed: return newProg.take();
0
471} -
472 -
473void QGLEngineSharedShaders::cleanupCustomStage(QGLCustomShaderStage* stage) -
474{ -
475 // Remove any shader programs which has this as the custom shader src: -
476 for (int i = 0; i < cachedPrograms.size(); ++i) {
never evaluated: i < cachedPrograms.size()
0
477 QGLEngineShaderProg *cachedProg = cachedPrograms[i];
never executed (the execution status of this line is deduced): QGLEngineShaderProg *cachedProg = cachedPrograms[i];
-
478 if (cachedProg->customStageSource == stage->source()) {
never evaluated: cachedProg->customStageSource == stage->source()
0
479 delete cachedProg;
never executed (the execution status of this line is deduced): delete cachedProg;
-
480 cachedPrograms.removeAt(i);
never executed (the execution status of this line is deduced): cachedPrograms.removeAt(i);
-
481 i--;
never executed (the execution status of this line is deduced): i--;
-
482 }
never executed: }
0
483 }
never executed: }
0
484}
never executed: }
0
485 -
486 -
487QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) -
488 : ctx(context), -
489 shaderProgNeedsChanging(true), -
490 complexGeometry(false), -
491 srcPixelType(Qt::NoBrush), -
492 opacityMode(NoOpacity), -
493 maskType(NoMask), -
494 compositionMode(QPainter::CompositionMode_SourceOver), -
495 customSrcStage(0), -
496 currentShaderProg(0) -
497{ -
498 sharedShaders = QGLEngineSharedShaders::shadersForContext(context);
never executed (the execution status of this line is deduced): sharedShaders = QGLEngineSharedShaders::shadersForContext(context);
-
499}
never executed: }
0
500 -
501QGLEngineShaderManager::~QGLEngineShaderManager() -
502{ -
503 //### -
504 removeCustomStage();
never executed (the execution status of this line is deduced): removeCustomStage();
-
505}
never executed: }
0
506 -
507GLuint QGLEngineShaderManager::getUniformLocation(Uniform id) -
508{ -
509 if (!currentShaderProg)
never evaluated: !currentShaderProg
0
510 return 0;
never executed: return 0;
0
511 -
512 QVector<uint> &uniformLocations = currentShaderProg->uniformLocations;
never executed (the execution status of this line is deduced): QVector<uint> &uniformLocations = currentShaderProg->uniformLocations;
-
513 if (uniformLocations.isEmpty())
never evaluated: uniformLocations.isEmpty()
0
514 uniformLocations.fill(GLuint(-1), NumUniforms);
never executed: uniformLocations.fill(GLuint(-1), NumUniforms);
0
515 -
516 static const char *uniformNames[] = { -
517 "imageTexture", -
518 "patternColor", -
519 "globalOpacity", -
520 "depth", -
521 "maskTexture", -
522 "fragmentColor", -
523 "linearData", -
524 "angle", -
525 "halfViewportSize", -
526 "fmp", -
527 "fmp2_m_radius2", -
528 "inverse_2_fmp2_m_radius2", -
529 "sqrfr", -
530 "bradius", -
531 "invertedTextureSize", -
532 "brushTransform", -
533 "brushTexture", -
534 "matrix" -
535 }; -
536 -
537 if (uniformLocations.at(id) == GLuint(-1))
never evaluated: uniformLocations.at(id) == GLuint(-1)
0
538 uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformNames[id]);
never executed: uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformNames[id]);
0
539 -
540 return uniformLocations.at(id);
never executed: return uniformLocations.at(id);
0
541} -
542 -
543 -
544void QGLEngineShaderManager::optimiseForBrushTransform(QTransform::TransformationType transformType) -
545{ -
546 Q_UNUSED(transformType); // Currently ignored
never executed (the execution status of this line is deduced): (void)transformType;;
-
547}
never executed: }
0
548 -
549void QGLEngineShaderManager::setDirty() -
550{ -
551 shaderProgNeedsChanging = true;
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = true;
-
552}
never executed: }
0
553 -
554void QGLEngineShaderManager::setSrcPixelType(Qt::BrushStyle style) -
555{ -
556 Q_ASSERT(style != Qt::NoBrush);
never executed (the execution status of this line is deduced): qt_noop();
-
557 if (srcPixelType == PixelSrcType(style))
never evaluated: srcPixelType == PixelSrcType(style)
0
558 return;
never executed: return;
0
559 -
560 srcPixelType = style;
never executed (the execution status of this line is deduced): srcPixelType = style;
-
561 shaderProgNeedsChanging = true; //###
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = true;
-
562}
never executed: }
0
563 -
564void QGLEngineShaderManager::setSrcPixelType(PixelSrcType type) -
565{ -
566 if (srcPixelType == type)
never evaluated: srcPixelType == type
0
567 return;
never executed: return;
0
568 -
569 srcPixelType = type;
never executed (the execution status of this line is deduced): srcPixelType = type;
-
570 shaderProgNeedsChanging = true; //###
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = true;
-
571}
never executed: }
0
572 -
573void QGLEngineShaderManager::setOpacityMode(OpacityMode mode) -
574{ -
575 if (opacityMode == mode)
never evaluated: opacityMode == mode
0
576 return;
never executed: return;
0
577 -
578 opacityMode = mode;
never executed (the execution status of this line is deduced): opacityMode = mode;
-
579 shaderProgNeedsChanging = true; //###
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = true;
-
580}
never executed: }
0
581 -
582void QGLEngineShaderManager::setMaskType(MaskType type) -
583{ -
584 if (maskType == type)
never evaluated: maskType == type
0
585 return;
never executed: return;
0
586 -
587 maskType = type;
never executed (the execution status of this line is deduced): maskType = type;
-
588 shaderProgNeedsChanging = true; //###
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = true;
-
589}
never executed: }
0
590 -
591void QGLEngineShaderManager::setCompositionMode(QPainter::CompositionMode mode) -
592{ -
593 if (compositionMode == mode)
never evaluated: compositionMode == mode
0
594 return;
never executed: return;
0
595 -
596 compositionMode = mode;
never executed (the execution status of this line is deduced): compositionMode = mode;
-
597 shaderProgNeedsChanging = true; //###
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = true;
-
598}
never executed: }
0
599 -
600void QGLEngineShaderManager::setCustomStage(QGLCustomShaderStage* stage) -
601{ -
602 if (customSrcStage)
never evaluated: customSrcStage
0
603 removeCustomStage();
never executed: removeCustomStage();
0
604 customSrcStage = stage;
never executed (the execution status of this line is deduced): customSrcStage = stage;
-
605 shaderProgNeedsChanging = true;
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = true;
-
606}
never executed: }
0
607 -
608void QGLEngineShaderManager::removeCustomStage() -
609{ -
610 if (customSrcStage)
never evaluated: customSrcStage
0
611 customSrcStage->setInactive();
never executed: customSrcStage->setInactive();
0
612 customSrcStage = 0;
never executed (the execution status of this line is deduced): customSrcStage = 0;
-
613 shaderProgNeedsChanging = true;
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = true;
-
614}
never executed: }
0
615 -
616QGLShaderProgram* QGLEngineShaderManager::currentProgram() -
617{ -
618 if (currentShaderProg)
never evaluated: currentShaderProg
0
619 return currentShaderProg->program;
never executed: return currentShaderProg->program;
0
620 else -
621 return sharedShaders->simpleProgram();
never executed: return sharedShaders->simpleProgram();
0
622} -
623 -
624void QGLEngineShaderManager::useSimpleProgram() -
625{ -
626 sharedShaders->simpleProgram()->bind();
never executed (the execution status of this line is deduced): sharedShaders->simpleProgram()->bind();
-
627 QGLContextPrivate* ctx_d = ctx->d_func();
never executed (the execution status of this line is deduced): QGLContextPrivate* ctx_d = ctx->d_func();
-
628 ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
never executed (the execution status of this line is deduced): ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
-
629 ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
never executed (the execution status of this line is deduced): ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
-
630 ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
never executed (the execution status of this line is deduced): ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
-
631 shaderProgNeedsChanging = true;
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = true;
-
632}
never executed: }
0
633 -
634void QGLEngineShaderManager::useBlitProgram() -
635{ -
636 sharedShaders->blitProgram()->bind();
never executed (the execution status of this line is deduced): sharedShaders->blitProgram()->bind();
-
637 QGLContextPrivate* ctx_d = ctx->d_func();
never executed (the execution status of this line is deduced): QGLContextPrivate* ctx_d = ctx->d_func();
-
638 ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
never executed (the execution status of this line is deduced): ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
-
639 ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, true);
never executed (the execution status of this line is deduced): ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, true);
-
640 ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
never executed (the execution status of this line is deduced): ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
-
641 shaderProgNeedsChanging = true;
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = true;
-
642}
never executed: }
0
643 -
644QGLShaderProgram* QGLEngineShaderManager::simpleProgram() -
645{ -
646 return sharedShaders->simpleProgram();
never executed: return sharedShaders->simpleProgram();
0
647} -
648 -
649QGLShaderProgram* QGLEngineShaderManager::blitProgram() -
650{ -
651 return sharedShaders->blitProgram();
never executed: return sharedShaders->blitProgram();
0
652} -
653 -
654 -
655 -
656// Select & use the correct shader program using the current state. -
657// Returns true if program needed changing. -
658bool QGLEngineShaderManager::useCorrectShaderProg() -
659{ -
660 if (!shaderProgNeedsChanging)
never evaluated: !shaderProgNeedsChanging
0
661 return false;
never executed: return false;
0
662 -
663 bool useCustomSrc = customSrcStage != 0;
never executed (the execution status of this line is deduced): bool useCustomSrc = customSrcStage != 0;
-
664 if (useCustomSrc && srcPixelType != QGLEngineShaderManager::ImageSrc && srcPixelType != Qt::TexturePattern) {
never evaluated: useCustomSrc
never evaluated: srcPixelType != QGLEngineShaderManager::ImageSrc
never evaluated: srcPixelType != Qt::TexturePattern
0
665 useCustomSrc = false;
never executed (the execution status of this line is deduced): useCustomSrc = false;
-
666 qWarning("QGLEngineShaderManager - Ignoring custom shader stage for non image src");
never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 666, __PRETTY_FUNCTION__).warning("QGLEngineShaderManager - Ignoring custom shader stage for non image src");
-
667 }
never executed: }
0
668 -
669 QGLEngineShaderProg requiredProgram;
never executed (the execution status of this line is deduced): QGLEngineShaderProg requiredProgram;
-
670 -
671 bool texCoords = false;
never executed (the execution status of this line is deduced): bool texCoords = false;
-
672 -
673 // Choose vertex shader shader position function (which typically also sets -
674 // varyings) and the source pixel (srcPixel) fragment shader function: -
675 requiredProgram.positionVertexShader = QGLEngineSharedShaders::InvalidSnippetName;
never executed (the execution status of this line is deduced): requiredProgram.positionVertexShader = QGLEngineSharedShaders::InvalidSnippetName;
-
676 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::InvalidSnippetName;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::InvalidSnippetName;
-
677 bool isAffine = brushTransform.isAffine();
never executed (the execution status of this line is deduced): bool isAffine = brushTransform.isAffine();
-
678 if ( (srcPixelType >= Qt::Dense1Pattern) && (srcPixelType <= Qt::DiagCrossPattern) ) {
never evaluated: (srcPixelType >= Qt::Dense1Pattern)
never evaluated: (srcPixelType <= Qt::DiagCrossPattern)
0
679 if (isAffine)
never evaluated: isAffine
0
680 requiredProgram.positionVertexShader = QGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader;
never executed: requiredProgram.positionVertexShader = QGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader;
0
681 else -
682 requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionWithPatternBrushVertexShader;
never executed: requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionWithPatternBrushVertexShader;
0
683 -
684 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::PatternBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::PatternBrushSrcFragmentShader;
-
685 }
never executed: }
0
686 else switch (srcPixelType) { -
687 default: -
688 case Qt::NoBrush: -
689 qFatal("QGLEngineShaderManager::useCorrectShaderProg() - Qt::NoBrush style is set");
never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 689, __PRETTY_FUNCTION__).fatal("QGLEngineShaderManager::useCorrectShaderProg() - Qt::NoBrush style is set");
-
690 break;
never executed: break;
0
691 case QGLEngineShaderManager::ImageSrc: -
692 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ImageSrcFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ImageSrcFragmentShader;
-
693 requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader;
never executed (the execution status of this line is deduced): requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader;
-
694 texCoords = true;
never executed (the execution status of this line is deduced): texCoords = true;
-
695 break;
never executed: break;
0
696 case QGLEngineShaderManager::NonPremultipliedImageSrc: -
697 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader;
-
698 requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader;
never executed (the execution status of this line is deduced): requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader;
-
699 texCoords = true;
never executed (the execution status of this line is deduced): texCoords = true;
-
700 break;
never executed: break;
0
701 case QGLEngineShaderManager::PatternSrc: -
702 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ImageSrcWithPatternFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ImageSrcWithPatternFragmentShader;
-
703 requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader;
never executed (the execution status of this line is deduced): requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader;
-
704 texCoords = true;
never executed (the execution status of this line is deduced): texCoords = true;
-
705 break;
never executed: break;
0
706 case QGLEngineShaderManager::TextureSrcWithPattern: -
707 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader;
-
708 requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader
never evaluated: isAffine
0
709 : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader;
never executed (the execution status of this line is deduced): : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader;
-
710 break;
never executed: break;
0
711 case Qt::SolidPattern: -
712 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::SolidBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::SolidBrushSrcFragmentShader;
-
713 requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader;
never executed (the execution status of this line is deduced): requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader;
-
714 break;
never executed: break;
0
715 case Qt::LinearGradientPattern: -
716 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader;
-
717 requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader
never evaluated: isAffine
0
718 : QGLEngineSharedShaders::PositionWithLinearGradientBrushVertexShader;
never executed (the execution status of this line is deduced): : QGLEngineSharedShaders::PositionWithLinearGradientBrushVertexShader;
-
719 break;
never executed: break;
0
720 case Qt::ConicalGradientPattern: -
721 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader;
-
722 requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader
never evaluated: isAffine
0
723 : QGLEngineSharedShaders::PositionWithConicalGradientBrushVertexShader;
never executed (the execution status of this line is deduced): : QGLEngineSharedShaders::PositionWithConicalGradientBrushVertexShader;
-
724 break;
never executed: break;
0
725 case Qt::RadialGradientPattern: -
726 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader;
-
727 requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader
never evaluated: isAffine
0
728 : QGLEngineSharedShaders::PositionWithRadialGradientBrushVertexShader;
never executed (the execution status of this line is deduced): : QGLEngineSharedShaders::PositionWithRadialGradientBrushVertexShader;
-
729 break;
never executed: break;
0
730 case Qt::TexturePattern: -
731 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::TextureBrushSrcFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::TextureBrushSrcFragmentShader;
-
732 requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader
never evaluated: isAffine
0
733 : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader;
never executed (the execution status of this line is deduced): : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader;
-
734 break;
never executed: break;
0
735 };
never executed: }
0
736 -
737 if (useCustomSrc) {
never evaluated: useCustomSrc
0
738 requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::CustomImageSrcFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::CustomImageSrcFragmentShader;
-
739 requiredProgram.customStageSource = customSrcStage->source();
never executed (the execution status of this line is deduced): requiredProgram.customStageSource = customSrcStage->source();
-
740 }
never executed: }
0
741 -
742 const bool hasCompose = compositionMode > QPainter::CompositionMode_Plus;
never executed (the execution status of this line is deduced): const bool hasCompose = compositionMode > QPainter::CompositionMode_Plus;
-
743 const bool hasMask = maskType != QGLEngineShaderManager::NoMask;
never executed (the execution status of this line is deduced): const bool hasMask = maskType != QGLEngineShaderManager::NoMask;
-
744 -
745 // Choose fragment shader main function: -
746 if (opacityMode == AttributeOpacity) {
never evaluated: opacityMode == AttributeOpacity
0
747 Q_ASSERT(!hasCompose && !hasMask);
never executed (the execution status of this line is deduced): qt_noop();
-
748 requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_ImageArrays;
never executed (the execution status of this line is deduced): requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_ImageArrays;
-
749 } else {
never executed: }
0
750 bool useGlobalOpacity = (opacityMode == UniformOpacity);
never executed (the execution status of this line is deduced): bool useGlobalOpacity = (opacityMode == UniformOpacity);
-
751 if (hasCompose && hasMask && useGlobalOpacity)
never evaluated: hasCompose
never evaluated: hasMask
never evaluated: useGlobalOpacity
0
752 requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CMO;
never executed: requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CMO;
0
753 if (hasCompose && hasMask && !useGlobalOpacity)
never evaluated: hasCompose
never evaluated: hasMask
never evaluated: !useGlobalOpacity
0
754 requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CM;
never executed: requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CM;
0
755 if (!hasCompose && hasMask && useGlobalOpacity)
never evaluated: !hasCompose
never evaluated: hasMask
never evaluated: useGlobalOpacity
0
756 requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_MO;
never executed: requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_MO;
0
757 if (!hasCompose && hasMask && !useGlobalOpacity)
never evaluated: !hasCompose
never evaluated: hasMask
never evaluated: !useGlobalOpacity
0
758 requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_M;
never executed: requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_M;
0
759 if (hasCompose && !hasMask && useGlobalOpacity)
never evaluated: hasCompose
never evaluated: !hasMask
never evaluated: useGlobalOpacity
0
760 requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CO;
never executed: requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CO;
0
761 if (hasCompose && !hasMask && !useGlobalOpacity)
never evaluated: hasCompose
never evaluated: !hasMask
never evaluated: !useGlobalOpacity
0
762 requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_C;
never executed: requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_C;
0
763 if (!hasCompose && !hasMask && useGlobalOpacity)
never evaluated: !hasCompose
never evaluated: !hasMask
never evaluated: useGlobalOpacity
0
764 requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_O;
never executed: requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_O;
0
765 if (!hasCompose && !hasMask && !useGlobalOpacity)
never evaluated: !hasCompose
never evaluated: !hasMask
never evaluated: !useGlobalOpacity
0
766 requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader;
never executed: requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader;
0
767 }
never executed: }
0
768 -
769 if (hasMask) {
never evaluated: hasMask
0
770 if (maskType == PixelMask) {
never evaluated: maskType == PixelMask
0
771 requiredProgram.maskFragShader = QGLEngineSharedShaders::MaskFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.maskFragShader = QGLEngineSharedShaders::MaskFragmentShader;
-
772 texCoords = true;
never executed (the execution status of this line is deduced): texCoords = true;
-
773 } else if (maskType == SubPixelMaskPass1) {
never executed: }
never evaluated: maskType == SubPixelMaskPass1
0
774 requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskFragmentShaderPass1;
never executed (the execution status of this line is deduced): requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskFragmentShaderPass1;
-
775 texCoords = true;
never executed (the execution status of this line is deduced): texCoords = true;
-
776 } else if (maskType == SubPixelMaskPass2) {
never executed: }
never evaluated: maskType == SubPixelMaskPass2
0
777 requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskFragmentShaderPass2;
never executed (the execution status of this line is deduced): requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskFragmentShaderPass2;
-
778 texCoords = true;
never executed (the execution status of this line is deduced): texCoords = true;
-
779 } else if (maskType == SubPixelWithGammaMask) {
never executed: }
never evaluated: maskType == SubPixelWithGammaMask
0
780 requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskWithGammaFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskWithGammaFragmentShader;
-
781 texCoords = true;
never executed (the execution status of this line is deduced): texCoords = true;
-
782 } else {
never executed: }
0
783 qCritical("QGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type");
never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 783, __PRETTY_FUNCTION__).critical("QGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type");
-
784 }
never executed: }
0
785 } else { -
786 requiredProgram.maskFragShader = QGLEngineSharedShaders::NoMaskFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.maskFragShader = QGLEngineSharedShaders::NoMaskFragmentShader;
-
787 }
never executed: }
0
788 -
789 if (hasCompose) {
never evaluated: hasCompose
0
790 switch (compositionMode) { -
791 case QPainter::CompositionMode_Multiply: -
792 requiredProgram.compositionFragShader = QGLEngineSharedShaders::MultiplyCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::MultiplyCompositionModeFragmentShader;
-
793 break;
never executed: break;
0
794 case QPainter::CompositionMode_Screen: -
795 requiredProgram.compositionFragShader = QGLEngineSharedShaders::ScreenCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::ScreenCompositionModeFragmentShader;
-
796 break;
never executed: break;
0
797 case QPainter::CompositionMode_Overlay: -
798 requiredProgram.compositionFragShader = QGLEngineSharedShaders::OverlayCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::OverlayCompositionModeFragmentShader;
-
799 break;
never executed: break;
0
800 case QPainter::CompositionMode_Darken: -
801 requiredProgram.compositionFragShader = QGLEngineSharedShaders::DarkenCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::DarkenCompositionModeFragmentShader;
-
802 break;
never executed: break;
0
803 case QPainter::CompositionMode_Lighten: -
804 requiredProgram.compositionFragShader = QGLEngineSharedShaders::LightenCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::LightenCompositionModeFragmentShader;
-
805 break;
never executed: break;
0
806 case QPainter::CompositionMode_ColorDodge: -
807 requiredProgram.compositionFragShader = QGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader;
-
808 break;
never executed: break;
0
809 case QPainter::CompositionMode_ColorBurn: -
810 requiredProgram.compositionFragShader = QGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader;
-
811 break;
never executed: break;
0
812 case QPainter::CompositionMode_HardLight: -
813 requiredProgram.compositionFragShader = QGLEngineSharedShaders::HardLightCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::HardLightCompositionModeFragmentShader;
-
814 break;
never executed: break;
0
815 case QPainter::CompositionMode_SoftLight: -
816 requiredProgram.compositionFragShader = QGLEngineSharedShaders::SoftLightCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::SoftLightCompositionModeFragmentShader;
-
817 break;
never executed: break;
0
818 case QPainter::CompositionMode_Difference: -
819 requiredProgram.compositionFragShader = QGLEngineSharedShaders::DifferenceCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::DifferenceCompositionModeFragmentShader;
-
820 break;
never executed: break;
0
821 case QPainter::CompositionMode_Exclusion: -
822 requiredProgram.compositionFragShader = QGLEngineSharedShaders::ExclusionCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::ExclusionCompositionModeFragmentShader;
-
823 break;
never executed: break;
0
824 default: -
825 qWarning("QGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode");
never executed (the execution status of this line is deduced): QMessageLogger("gl2paintengineex/qglengineshadermanager.cpp", 825, __PRETTY_FUNCTION__).warning("QGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode");
-
826 }
never executed: }
0
827 } else {
never executed: }
0
828 requiredProgram.compositionFragShader = QGLEngineSharedShaders::NoCompositionModeFragmentShader;
never executed (the execution status of this line is deduced): requiredProgram.compositionFragShader = QGLEngineSharedShaders::NoCompositionModeFragmentShader;
-
829 }
never executed: }
0
830 -
831 // Choose vertex shader main function -
832 if (opacityMode == AttributeOpacity) {
never evaluated: opacityMode == AttributeOpacity
0
833 Q_ASSERT(texCoords);
never executed (the execution status of this line is deduced): qt_noop();
-
834 requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader;
never executed (the execution status of this line is deduced): requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader;
-
835 } else if (texCoords) {
never executed: }
never evaluated: texCoords
0
836 requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainWithTexCoordsVertexShader;
never executed (the execution status of this line is deduced): requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainWithTexCoordsVertexShader;
-
837 } else {
never executed: }
0
838 requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainVertexShader;
never executed (the execution status of this line is deduced): requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainVertexShader;
-
839 }
never executed: }
0
840 requiredProgram.useTextureCoords = texCoords;
never executed (the execution status of this line is deduced): requiredProgram.useTextureCoords = texCoords;
-
841 requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity);
never executed (the execution status of this line is deduced): requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity);
-
842 if (complexGeometry && srcPixelType == Qt::SolidPattern) {
never evaluated: complexGeometry
never evaluated: srcPixelType == Qt::SolidPattern
0
843 requiredProgram.positionVertexShader = QGLEngineSharedShaders::ComplexGeometryPositionOnlyVertexShader;
never executed (the execution status of this line is deduced): requiredProgram.positionVertexShader = QGLEngineSharedShaders::ComplexGeometryPositionOnlyVertexShader;
-
844 requiredProgram.usePmvMatrixAttribute = false;
never executed (the execution status of this line is deduced): requiredProgram.usePmvMatrixAttribute = false;
-
845 } else {
never executed: }
0
846 requiredProgram.usePmvMatrixAttribute = true;
never executed (the execution status of this line is deduced): requiredProgram.usePmvMatrixAttribute = true;
-
847 -
848 // Force complexGeometry off, since we currently don't support that mode for -
849 // non-solid brushes -
850 complexGeometry = false;
never executed (the execution status of this line is deduced): complexGeometry = false;
-
851 }
never executed: }
0
852 -
853 // At this point, requiredProgram is fully populated so try to find the program in the cache -
854 currentShaderProg = sharedShaders->findProgramInCache(requiredProgram);
never executed (the execution status of this line is deduced): currentShaderProg = sharedShaders->findProgramInCache(requiredProgram);
-
855 -
856 if (currentShaderProg && useCustomSrc) {
never evaluated: currentShaderProg
never evaluated: useCustomSrc
0
857 customSrcStage->setUniforms(currentShaderProg->program);
never executed (the execution status of this line is deduced): customSrcStage->setUniforms(currentShaderProg->program);
-
858 }
never executed: }
0
859 -
860 // Make sure all the vertex attribute arrays the program uses are enabled (and the ones it -
861 // doesn't use are disabled) -
862 QGLContextPrivate* ctx_d = ctx->d_func();
never executed (the execution status of this line is deduced): QGLContextPrivate* ctx_d = ctx->d_func();
-
863 ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
never executed (the execution status of this line is deduced): ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
-
864 ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, currentShaderProg && currentShaderProg->useTextureCoords);
never executed (the execution status of this line is deduced): ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, currentShaderProg && currentShaderProg->useTextureCoords);
-
865 ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, currentShaderProg && currentShaderProg->useOpacityAttribute);
never executed (the execution status of this line is deduced): ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, currentShaderProg && currentShaderProg->useOpacityAttribute);
-
866 -
867 shaderProgNeedsChanging = false;
never executed (the execution status of this line is deduced): shaderProgNeedsChanging = false;
-
868 return true;
never executed: return true;
0
869} -
870 -
871QT_END_NAMESPACE -
872 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial