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