OpenCoverage

qquickopenglshadereffectnode.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickopenglshadereffectnode.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQuick 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 The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include <private/qquickopenglshadereffectnode_p.h>-
41-
42#include "qquickopenglshadereffect_p.h"-
43#include <QtQuick/qsgtextureprovider.h>-
44#include <QtQuick/private/qsgrenderer_p.h>-
45#include <QtQuick/private/qsgshadersourcebuilder_p.h>-
46#include <QtQuick/private/qsgtexture_p.h>-
47#include <QtCore/qmutex.h>-
48#include <QtGui/qopenglfunctions.h>-
49-
50#ifndef GL_TEXTURE_EXTERNAL_OES-
51#define GL_TEXTURE_EXTERNAL_OES 0x8D65-
52#endif-
53-
54QT_BEGIN_NAMESPACE-
55-
56static bool hasAtlasTexture(const QVector<QSGTextureProvider *> &textureProviders)-
57{-
58 for (int i = 0; i < textureProviders.size(); ++i) {
i < textureProviders.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
59 QSGTextureProvider *t = textureProviders.at(i);-
60 if (t && t->texture() && t->texture()->isAtlasTexture())
tDescription
TRUEnever evaluated
FALSEnever evaluated
t->texture()Description
TRUEnever evaluated
FALSEnever evaluated
t->texture()->isAtlasTexture()Description
TRUEnever evaluated
FALSEnever evaluated
0
61 return true;
never executed: return true;
0
62 }
never executed: end of block
0
63 return false;
never executed: return false;
0
64}-
65-
66class QQuickCustomMaterialShader : public QSGMaterialShader-
67{-
68public:-
69 QQuickCustomMaterialShader(const QQuickOpenGLShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes);-
70 void deactivate() override;-
71 void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;-
72 char const *const *attributeNames() const override;-
73-
74protected:-
75 friend class QQuickOpenGLShaderEffectNode;-
76-
77 void compile() override;-
78 const char *vertexShader() const override;-
79 const char *fragmentShader() const override;-
80-
81 const QQuickOpenGLShaderEffectMaterialKey m_key;-
82 QVector<QByteArray> m_attributes;-
83 QVector<const char *> m_attributeNames;-
84 QString m_log;-
85 bool m_compiled;-
86-
87 QVector<int> m_uniformLocs[QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount];-
88 uint m_initialized : 1;-
89};-
90-
91QQuickCustomMaterialShader::QQuickCustomMaterialShader(const QQuickOpenGLShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes)-
92 : m_key(key)-
93 , m_attributes(attributes)-
94 , m_compiled(false)-
95 , m_initialized(false)-
96{-
97 const int attributesCount = m_attributes.count();-
98 m_attributeNames.reserve(attributesCount + 1);-
99 for (int i = 0; i < attributesCount; ++i)
i < attributesCountDescription
TRUEevaluated 153 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 63 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
63-153
100 m_attributeNames.append(m_attributes.at(i).constData());
executed 153 times by 6 tests: m_attributeNames.append(m_attributes.at(i).constData());
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
153
101 m_attributeNames.append(0);-
102}
executed 63 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
63
103-
104void QQuickCustomMaterialShader::deactivate()-
105{-
106 QSGMaterialShader::deactivate();-
107 QOpenGLContext::currentContext()->functions()->glDisable(GL_CULL_FACE);-
108}
executed 451 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
451
109-
110void QQuickCustomMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)-
111{-
112 typedef QQuickOpenGLShaderEffectMaterial::UniformData UniformData;-
113-
114 Q_ASSERT(newEffect != nullptr);-
115-
116 QQuickOpenGLShaderEffectMaterial *material = static_cast<QQuickOpenGLShaderEffectMaterial *>(newEffect);-
117 if (!material->m_emittedLogChanged && material->m_node) {
!material->m_emittedLogChangedDescription
TRUEevaluated 341 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 110 times by 3 tests
Evaluated by:
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
material->m_nodeDescription
TRUEevaluated 54 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 287 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
54-341
118 material->m_emittedLogChanged = true;-
119 emit material->m_node->logAndStatusChanged(m_log, m_compiled ? QQuickShaderEffect::Compiled-
120 : QQuickShaderEffect::Error);-
121 }
executed 54 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
54
122-
123 int textureProviderIndex = 0;-
124 if (!m_initialized) {
!m_initializedDescription
TRUEevaluated 63 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 388 times by 4 tests
Evaluated by:
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
63-388
125 for (int shaderType = 0; shaderType < QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount; ++shaderType) {
shaderType < Q...haderTypeCountDescription
TRUEevaluated 126 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 63 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
63-126
126 Q_ASSERT(m_uniformLocs[shaderType].isEmpty());-
127 m_uniformLocs[shaderType].reserve(material->uniforms[shaderType].size());-
128 for (int i = 0; i < material->uniforms[shaderType].size(); ++i) {
i < material->...erType].size()Description
TRUEevaluated 185 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 126 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
126-185
129 const UniformData &d = material->uniforms[shaderType].at(i);-
130 QByteArray name = d.name;-
131 if (d.specialType == UniformData::Sampler || d.specialType == UniformData::SamplerExternal) {
d.specialType ...mData::SamplerDescription
TRUEevaluated 56 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 129 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
d.specialType ...amplerExternalDescription
TRUEnever evaluated
FALSEevaluated 129 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
0-129
132 program()->setUniformValue(d.name.constData(), textureProviderIndex++);-
133 // We don't need to store the sampler uniform locations, since their values-
134 // only need to be set once. Look for the "qt_SubRect_" uniforms instead.-
135 // These locations are used when binding the textures later.-
136 name = "qt_SubRect_" + name;-
137 }
executed 56 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
56
138 m_uniformLocs[shaderType].append(program()->uniformLocation(name.constData()));-
139 }
executed 185 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
185
140 }
executed 126 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
126
141 m_initialized = true;-
142 textureProviderIndex = 0;-
143 }
executed 63 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
63
144-
145 QOpenGLFunctions *functions = state.context()->functions();-
146 for (int shaderType = 0; shaderType < QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount; ++shaderType) {
shaderType < Q...haderTypeCountDescription
TRUEevaluated 902 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 451 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
451-902
147 for (int i = 0; i < material->uniforms[shaderType].size(); ++i) {
i < material->...erType].size()Description
TRUEevaluated 1565 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 902 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
902-1565
148 const UniformData &d = material->uniforms[shaderType].at(i);-
149 int loc = m_uniformLocs[shaderType].at(i);-
150 if (d.specialType == UniformData::Sampler || d.specialType == UniformData::SamplerExternal) {
d.specialType ...mData::SamplerDescription
TRUEevaluated 438 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 1127 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
d.specialType ...amplerExternalDescription
TRUEnever evaluated
FALSEevaluated 1127 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
0-1127
151 int idx = textureProviderIndex++;-
152 functions->glActiveTexture(GL_TEXTURE0 + idx);-
153 if (QSGTextureProvider *provider = material->textureProviders.at(idx)) {
QSGTextureProv...viders.at(idx)Description
TRUEevaluated 305 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 133 times by 1 test
Evaluated by:
  • tst_qquickcustomparticle
133-305
154 if (QSGTexture *texture = provider->texture()) {
QSGTexture *te...der->texture()Description
TRUEevaluated 305 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEnever evaluated
0-305
155-
156#ifndef QT_NO_DEBUG-
157 if (!qsg_safeguard_texture(texture))
!qsg_safeguard...xture(texture)Description
TRUEnever evaluated
FALSEevaluated 305 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
0-305
158 continue;
never executed: continue;
0
159#endif-
160-
161 if (loc >= 0) {
loc >= 0Description
TRUEnever evaluated
FALSEevaluated 305 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
0-305
162 QRectF r = texture->normalizedTextureSubRect();-
163 program()->setUniformValue(loc, r.x(), r.y(), r.width(), r.height());-
164 } else if (texture->isAtlasTexture() && !material->geometryUsesTextureSubRect) {
never executed: end of block
texture->isAtlasTexture()Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qquickborderimage
  • tst_qquickshadereffect
FALSEevaluated 299 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
!material->geo...TextureSubRectDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickshadereffect
0-299
165 texture = texture->removedFromAtlas();-
166 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickborderimage
2
167 texture->bind();-
168 continue;
executed 305 times by 5 tests: continue;
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
305
169 }-
170 }
never executed: end of block
0
171 if (d.specialType == UniformData::Sampler)
d.specialType ...mData::SamplerDescription
TRUEevaluated 133 times by 1 test
Evaluated by:
  • tst_qquickcustomparticle
FALSEnever evaluated
0-133
172 functions->glBindTexture(GL_TEXTURE_2D, 0);
executed 133 times by 1 test: functions->glBindTexture( 0x0DE1 , 0);
Executed by:
  • tst_qquickcustomparticle
133
173 else if (d.specialType == UniformData::SamplerExternal)
d.specialType ...amplerExternalDescription
TRUEnever evaluated
FALSEnever evaluated
0
174 functions->glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
never executed: functions->glBindTexture(0x8D65, 0);
0
175 } else if (d.specialType == UniformData::Opacity) {
executed 133 times by 1 test: end of block
Executed by:
  • tst_qquickcustomparticle
d.specialType ...mData::OpacityDescription
TRUEevaluated 367 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
FALSEevaluated 760 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
133-760
176 program()->setUniformValue(loc, state.opacity());-
177 } else if (d.specialType == UniformData::Matrix) {
executed 367 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
d.specialType ...rmData::MatrixDescription
TRUEevaluated 451 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 309 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
309-451
178 if (state.isMatrixDirty())
state.isMatrixDirty()Description
TRUEevaluated 451 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEnever evaluated
0-451
179 program()->setUniformValue(loc, state.combinedMatrix());
executed 451 times by 6 tests: program()->setUniformValue(loc, state.combinedMatrix());
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
451
180 } else if (d.specialType == UniformData::None) {
executed 451 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
d.specialType ...formData::NoneDescription
TRUEevaluated 309 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
FALSEnever evaluated
0-451
181 switch (int(d.value.type())) {-
182 case QMetaType::QColor:
executed 8 times by 1 test: case QMetaType::QColor:
Executed by:
  • tst_examples
8
183 program()->setUniformValue(loc, qt_premultiply_color(qvariant_cast<QColor>(d.value)));-
184 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_examples
8
185 case QMetaType::Float:
never executed: case QMetaType::Float:
0
186 program()->setUniformValue(loc, qvariant_cast<float>(d.value));-
187 break;
never executed: break;
0
188 case QMetaType::Double:
executed 291 times by 2 tests: case QMetaType::Double:
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
291
189 program()->setUniformValue(loc, (float) qvariant_cast<double>(d.value));-
190 break;
executed 291 times by 2 tests: break;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
291
191 case QMetaType::QTransform:
never executed: case QMetaType::QTransform:
0
192 program()->setUniformValue(loc, qvariant_cast<QTransform>(d.value));-
193 break;
never executed: break;
0
194 case QMetaType::Int:
never executed: case QMetaType::Int:
0
195 program()->setUniformValue(loc, d.value.toInt());-
196 break;
never executed: break;
0
197 case QMetaType::Bool:
never executed: case QMetaType::Bool:
0
198 program()->setUniformValue(loc, GLint(d.value.toBool()));-
199 break;
never executed: break;
0
200 case QMetaType::QSize:
never executed: case QMetaType::QSize:
0
201 case QMetaType::QSizeF:
executed 6 times by 1 test: case QMetaType::QSizeF:
Executed by:
  • tst_examples
6
202 program()->setUniformValue(loc, d.value.toSizeF());-
203 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_examples
6
204 case QMetaType::QPoint:
never executed: case QMetaType::QPoint:
0
205 case QMetaType::QPointF:
never executed: case QMetaType::QPointF:
0
206 program()->setUniformValue(loc, d.value.toPointF());-
207 break;
never executed: break;
0
208 case QMetaType::QRect:
never executed: case QMetaType::QRect:
0
209 case QMetaType::QRectF:
never executed: case QMetaType::QRectF:
0
210 {-
211 QRectF r = d.value.toRectF();-
212 program()->setUniformValue(loc, r.x(), r.y(), r.width(), r.height());-
213 }-
214 break;
never executed: break;
0
215 case QMetaType::QVector2D:
never executed: case QMetaType::QVector2D:
0
216 program()->setUniformValue(loc, qvariant_cast<QVector2D>(d.value));-
217 break;
never executed: break;
0
218 case QMetaType::QVector3D:
never executed: case QMetaType::QVector3D:
0
219 program()->setUniformValue(loc, qvariant_cast<QVector3D>(d.value));-
220 break;
never executed: break;
0
221 case QMetaType::QVector4D:
never executed: case QMetaType::QVector4D:
0
222 program()->setUniformValue(loc, qvariant_cast<QVector4D>(d.value));-
223 break;
never executed: break;
0
224 case QMetaType::QQuaternion:
never executed: case QMetaType::QQuaternion:
0
225 {-
226 QQuaternion q = qvariant_cast<QQuaternion>(d.value);-
227 program()->setUniformValue(loc, q.x(), q.y(), q.z(), q.scalar());-
228 }-
229 break;
never executed: break;
0
230 case QMetaType::QMatrix4x4:
never executed: case QMetaType::QMatrix4x4:
0
231 program()->setUniformValue(loc, qvariant_cast<QMatrix4x4>(d.value));-
232 break;
never executed: break;
0
233 default:
executed 4 times by 1 test: default:
Executed by:
  • tst_examples
4
234 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_examples
4
235 }-
236 }-
237 }
executed 1260 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
1260
238 }
executed 902 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
902
239 functions->glActiveTexture(GL_TEXTURE0);-
240-
241 const QQuickOpenGLShaderEffectMaterial *oldMaterial = static_cast<const QQuickOpenGLShaderEffectMaterial *>(oldEffect);-
242 if (oldEffect == nullptr || material->cullMode != oldMaterial->cullMode) {
oldEffect == nullptrDescription
TRUEevaluated 451 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEnever evaluated
material->cull...rial->cullModeDescription
TRUEnever evaluated
FALSEnever evaluated
0-451
243 switch (material->cullMode) {-
244 case QQuickShaderEffect::FrontFaceCulling:
never executed: case QQuickShaderEffect::FrontFaceCulling:
0
245 functions->glEnable(GL_CULL_FACE);-
246 functions->glCullFace(GL_FRONT);-
247 break;
never executed: break;
0
248 case QQuickShaderEffect::BackFaceCulling:
never executed: case QQuickShaderEffect::BackFaceCulling:
0
249 functions->glEnable(GL_CULL_FACE);-
250 functions->glCullFace(GL_BACK);-
251 break;
never executed: break;
0
252 default:
executed 451 times by 6 tests: default:
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
451
253 functions->glDisable(GL_CULL_FACE);-
254 break;
executed 451 times by 6 tests: break;
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
451
255 }-
256 }-
257}
executed 451 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
451
258-
259char const *const *QQuickCustomMaterialShader::attributeNames() const-
260{-
261 return m_attributeNames.constData();
executed 1416 times by 6 tests: return m_attributeNames.constData();
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
1416
262}-
263-
264void QQuickCustomMaterialShader::compile()-
265{-
266 Q_ASSERT_X(!program()->isLinked(), "QQuickCustomMaterialShader::compile()", "Compile called multiple times!");-
267-
268 m_log.clear();-
269 m_compiled = true;-
270 if (!program()->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vertexShader())) {
!program()->ad...ertexShader())Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
0-9
271 m_log += QLatin1String("*** Vertex shader ***\n") + program()->log();-
272 m_compiled = false;-
273 }
never executed: end of block
0
274 if (!program()->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShader())) {
!program()->ad...gmentShader())Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
0-9
275 m_log += QLatin1String("*** Fragment shader ***\n") + program()->log();-
276 m_compiled = false;-
277 }
never executed: end of block
0
278-
279 char const *const *attr = attributeNames();-
280#ifndef QT_NO_DEBUG-
281 int maxVertexAttribs = 0;-
282 QOpenGLContext::currentContext()->functions()->glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);-
283 int attrCount = 0;-
284 while (attrCount < maxVertexAttribs && attr[attrCount])
attrCount < maxVertexAttribsDescription
TRUEevaluated 54 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
FALSEnever evaluated
attr[attrCount]Description
TRUEevaluated 45 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
0-54
285 ++attrCount;
executed 45 times by 2 tests: ++attrCount;
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
45
286 if (attr[attrCount]) {
attr[attrCount]Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
0-9
287 qWarning("List of attribute names is too long.\n"-
288 "Maximum number of attributes on this hardware is %i.\n"-
289 "Vertex shader:\n%s\n"-
290 "Fragment shader:\n%s\n",-
291 maxVertexAttribs, vertexShader(), fragmentShader());-
292 }
never executed: end of block
0
293#endif-
294-
295 if (m_compiled) {
m_compiledDescription
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
FALSEnever evaluated
0-9
296#ifndef QT_NO_DEBUG-
297 for (int i = 0; i < attrCount; ++i) {
i < attrCountDescription
TRUEevaluated 45 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
9-45
298#else-
299 for (int i = 0; attr[i]; ++i) {-
300#endif-
301 if (*attr[i])
*attr[i]Description
TRUEevaluated 45 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
FALSEnever evaluated
0-45
302 program()->bindAttributeLocation(attr[i], i);
executed 45 times by 2 tests: program()->bindAttributeLocation(attr[i], i);
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
45
303 }
executed 45 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
45
304 m_compiled = program()->link();-
305 m_log += program()->log();-
306 }
executed 9 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
9
307-
308 if (!m_compiled) {
!m_compiledDescription
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
0-9
309 qWarning("QQuickCustomMaterialShader: Shader compilation failed:");-
310 qWarning() << program()->log();-
311-
312 QSGShaderSourceBuilder::initializeProgramFromFiles(-
313 program(),-
314 QStringLiteral(":/qt-project.org/items/shaders/shadereffectfallback.vert"),
never executed: return qstring_literal_temp;
0
315 QStringLiteral(":/qt-project.org/items/shaders/shadereffectfallback.frag"));
never executed: return qstring_literal_temp;
0
316-
317#ifndef QT_NO_DEBUG-
318 for (int i = 0; i < attrCount; ++i) {
i < attrCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
319#else-
320 for (int i = 0; attr[i]; ++i) {-
321#endif-
322 if (qstrcmp(attr[i], qtPositionAttributeName()) == 0)
qstrcmp(attr[i...teName()) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
323 program()->bindAttributeLocation("v", i);
never executed: program()->bindAttributeLocation("v", i);
0
324 }
never executed: end of block
0
325 program()->link();-
326 }
never executed: end of block
0
327}
executed 9 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
9
328-
329const char *QQuickCustomMaterialShader::vertexShader() const-
330{-
331 return m_key.sourceCode[QQuickOpenGLShaderEffectMaterialKey::VertexShader].constData();
executed 63 times by 6 tests: return m_key.sourceCode[QQuickOpenGLShaderEffectMaterialKey::VertexShader].constData();
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
63
332}-
333-
334const char *QQuickCustomMaterialShader::fragmentShader() const-
335{-
336 return m_key.sourceCode[QQuickOpenGLShaderEffectMaterialKey::FragmentShader].constData();
executed 63 times by 6 tests: return m_key.sourceCode[QQuickOpenGLShaderEffectMaterialKey::FragmentShader].constData();
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
63
337}-
338-
339-
340bool QQuickOpenGLShaderEffectMaterialKey::operator == (const QQuickOpenGLShaderEffectMaterialKey &other) const-
341{-
342 for (int shaderType = 0; shaderType < ShaderTypeCount; ++shaderType) {
shaderType < ShaderTypeCountDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickshadereffect
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickshadereffect
2-4
343 if (sourceCode[shaderType] != other.sourceCode[shaderType])
sourceCode[sha...de[shaderType]Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickshadereffect
0-4
344 return false;
never executed: return false;
0
345 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickshadereffect
4
346 return true;
executed 2 times by 1 test: return true;
Executed by:
  • tst_qquickshadereffect
2
347}-
348-
349bool QQuickOpenGLShaderEffectMaterialKey::operator != (const QQuickOpenGLShaderEffectMaterialKey &other) const-
350{-
351 return !(*this == other);
never executed: return !(*this == other);
0
352}-
353-
354uint qHash(const QQuickOpenGLShaderEffectMaterialKey &key)-
355{-
356 uint hash = 1;-
357 typedef QQuickOpenGLShaderEffectMaterialKey Key;-
358 for (int shaderType = 0; shaderType < Key::ShaderTypeCount; ++shaderType)
shaderType < K...haderTypeCountDescription
TRUEevaluated 174 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 87 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
87-174
359 hash = hash * 31337 + qHash(key.sourceCode[shaderType]);
executed 174 times by 6 tests: hash = hash * 31337 + qHash(key.sourceCode[shaderType]);
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
174
360 return hash;
executed 87 times by 6 tests: return hash;
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
87
361}-
362-
363class QQuickOpenGLShaderEffectMaterialCache : public QObject-
364{-
365 Q_OBJECT-
366public:-
367 static QQuickOpenGLShaderEffectMaterialCache *get(bool create = true) {-
368 QOpenGLContext *ctx = QOpenGLContext::currentContext();-
369 QQuickOpenGLShaderEffectMaterialCache *me = ctx->findChild<QQuickOpenGLShaderEffectMaterialCache *>(QStringLiteral("__qt_ShaderEffectCache"), Qt::FindDirectChildrenOnly);
executed 5427 times by 89 tests: return qstring_literal_temp;
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdraghandler
  • tst_qquickdroparea
  • ...
5427
370 if (!me && create) {
!meDescription
TRUEevaluated 5354 times by 89 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdraghandler
  • tst_qquickdroparea
  • ...
FALSEevaluated 73 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
createDescription
TRUEevaluated 57 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 5297 times by 88 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdraghandler
  • tst_qquickdroparea
  • tst_qquickdynamicpropertyanimation
  • ...
57-5354
371 me = new QQuickOpenGLShaderEffectMaterialCache();-
372 me->setObjectName(QStringLiteral("__qt_ShaderEffectCache"));
executed 57 times by 6 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
57
373 me->setParent(ctx);-
374 }
executed 57 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
57
375 return me;
executed 5427 times by 89 tests: return me;
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdraghandler
  • tst_qquickdroparea
  • ...
5427
376 }-
377 QHash<QQuickOpenGLShaderEffectMaterialKey, QSGMaterialType *> cache;-
378};-
379-
380QQuickOpenGLShaderEffectMaterial::QQuickOpenGLShaderEffectMaterial(QQuickOpenGLShaderEffectNode *node)-
381 : cullMode(QQuickShaderEffect::NoCulling)-
382 , geometryUsesTextureSubRect(false)-
383 , m_node(node)-
384 , m_emittedLogChanged(false)-
385{-
386 setFlag(Blending | RequiresFullMatrix, true);-
387}
executed 73 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
73
388-
389QSGMaterialType *QQuickOpenGLShaderEffectMaterial::type() const-
390{-
391 return m_type;
executed 509 times by 6 tests: return m_type;
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
509
392}-
393-
394QSGMaterialShader *QQuickOpenGLShaderEffectMaterial::createShader() const-
395{-
396 return new QQuickCustomMaterialShader(m_source, attributes);
executed 63 times by 6 tests: return new QQuickCustomMaterialShader(m_source, attributes);
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
63
397}-
398-
399bool QQuickOpenGLShaderEffectMaterial::UniformData::operator == (const UniformData &other) const-
400{-
401 if (specialType != other.specialType)
specialType !=...er.specialTypeDescription
TRUEnever evaluated
FALSEnever evaluated
0
402 return false;
never executed: return false;
0
403 if (name != other.name)
name != other.nameDescription
TRUEnever evaluated
FALSEnever evaluated
0
404 return false;
never executed: return false;
0
405-
406 if (specialType == UniformData::Sampler || specialType == UniformData::SamplerExternal) {
specialType ==...mData::SamplerDescription
TRUEnever evaluated
FALSEnever evaluated
specialType ==...amplerExternalDescription
TRUEnever evaluated
FALSEnever evaluated
0
407 // We can't check the source objects as these live in the GUI thread,-
408 // so return true here and rely on the textureProvider check for-
409 // equality of these..-
410 return true;
never executed: return true;
0
411 } else {-
412 return value == other.value;
never executed: return value == other.value;
0
413 }-
414}-
415-
416int QQuickOpenGLShaderEffectMaterial::compare(const QSGMaterial *o) const-
417{-
418 const QQuickOpenGLShaderEffectMaterial *other = static_cast<const QQuickOpenGLShaderEffectMaterial *>(o);-
419 if ((hasAtlasTexture(textureProviders) && !geometryUsesTextureSubRect) || (hasAtlasTexture(other->textureProviders) && !other->geometryUsesTextureSubRect))
hasAtlasTextur...tureProviders)Description
TRUEnever evaluated
FALSEnever evaluated
!geometryUsesTextureSubRectDescription
TRUEnever evaluated
FALSEnever evaluated
hasAtlasTextur...tureProviders)Description
TRUEnever evaluated
FALSEnever evaluated
!other->geomet...TextureSubRectDescription
TRUEnever evaluated
FALSEnever evaluated
0
420 return 1;
never executed: return 1;
0
421 if (cullMode != other->cullMode)
cullMode != other->cullModeDescription
TRUEnever evaluated
FALSEnever evaluated
0
422 return 1;
never executed: return 1;
0
423 for (int shaderType = 0; shaderType < QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount; ++shaderType) {
shaderType < Q...haderTypeCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
424 if (uniforms[shaderType] != other->uniforms[shaderType])
uniforms[shade...ms[shaderType]Description
TRUEnever evaluated
FALSEnever evaluated
0
425 return 1;
never executed: return 1;
0
426 }
never executed: end of block
0
427-
428 // Check the texture providers..-
429 if (textureProviders.size() != other->textureProviders.size())
textureProvide...oviders.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
430 return 1;
never executed: return 1;
0
431 for (int i=0; i<textureProviders.size(); ++i) {
i<textureProviders.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
432 QSGTextureProvider *tp1 = textureProviders.at(i);-
433 QSGTextureProvider *tp2 = other->textureProviders.at(i);-
434 if (!tp1 || !tp2)
!tp1Description
TRUEnever evaluated
FALSEnever evaluated
!tp2Description
TRUEnever evaluated
FALSEnever evaluated
0
435 return tp1 == tp2 ? 0 : 1;
never executed: return tp1 == tp2 ? 0 : 1;
0
436 QSGTexture *t1 = tp1->texture();-
437 QSGTexture *t2 = tp2->texture();-
438 if (!t1 || !t2)
!t1Description
TRUEnever evaluated
FALSEnever evaluated
!t2Description
TRUEnever evaluated
FALSEnever evaluated
0
439 return t1 == t2 ? 0 : 1;
never executed: return t1 == t2 ? 0 : 1;
0
440 // Check texture id's as textures may be in the same atlas.-
441 if (t1->textureId() != t2->textureId())
t1->textureId(...2->textureId()Description
TRUEnever evaluated
FALSEnever evaluated
0
442 return 1;
never executed: return 1;
0
443 }
never executed: end of block
0
444 return 0;
never executed: return 0;
0
445}-
446-
447void QQuickOpenGLShaderEffectMaterial::setProgramSource(const QQuickOpenGLShaderEffectMaterialKey &source)-
448{-
449 m_source = source;-
450 m_emittedLogChanged = false;-
451-
452 QQuickOpenGLShaderEffectMaterialCache *cache = QQuickOpenGLShaderEffectMaterialCache::get();-
453 m_type = cache->cache.value(m_source);-
454 if (!m_type) {
!m_typeDescription
TRUEevaluated 71 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickshadereffect
2-71
455 m_type = new QSGMaterialType();-
456 cache->cache.insert(source, m_type);-
457 }
executed 71 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
71
458}
executed 73 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
73
459-
460void QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache()-
461{-
462 QQuickOpenGLShaderEffectMaterialCache *cache = QQuickOpenGLShaderEffectMaterialCache::get(false);-
463 if (cache) {
cacheDescription
TRUEevaluated 57 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
FALSEevaluated 5297 times by 88 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdraghandler
  • tst_qquickdroparea
  • tst_qquickdynamicpropertyanimation
  • ...
57-5297
464 qDeleteAll(cache->cache);-
465 delete cache;-
466 }
executed 57 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
57
467}
executed 5354 times by 89 tests: end of block
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdraghandler
  • tst_qquickdroparea
  • ...
5354
468-
469void QQuickOpenGLShaderEffectMaterial::updateTextures() const-
470{-
471 for (int i = 0; i < textureProviders.size(); ++i) {
i < textureProviders.size()Description
TRUEevaluated 438 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 451 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
438-451
472 if (QSGTextureProvider *provider = textureProviders.at(i)) {
QSGTextureProv...roviders.at(i)Description
TRUEevaluated 305 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
FALSEevaluated 133 times by 1 test
Evaluated by:
  • tst_qquickcustomparticle
133-305
473 if (QSGDynamicTexture *texture = qobject_cast<QSGDynamicTexture *>(provider->texture()))
QSGDynamicText...er->texture())Description
TRUEevaluated 299 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qquickborderimage
  • tst_qquickshadereffect
6-299
474 texture->updateTexture();
executed 299 times by 3 tests: texture->updateTexture();
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
299
475 }
executed 305 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
305
476 }
executed 438 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
438
477}
executed 451 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
451
478-
479void QQuickOpenGLShaderEffectMaterial::invalidateTextureProvider(QSGTextureProvider *provider)-
480{-
481 for (int i = 0; i < textureProviders.size(); ++i) {
i < textureProviders.size()Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
8-12
482 if (provider == textureProviders.at(i))
provider == te...roviders.at(i)Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_examples
4-8
483 textureProviders[i] = 0;
executed 8 times by 2 tests: textureProviders[i] = 0;
Executed by:
  • tst_examples
  • tst_qquickborderimage
8
484 }
executed 12 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
12
485}
executed 8 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
8
486-
487-
488QQuickOpenGLShaderEffectNode::QQuickOpenGLShaderEffectNode()-
489{-
490 QSGNode::setFlag(UsePreprocess, true);-
491-
492#ifdef QSG_RUNTIME_DESCRIPTION-
493 qsgnode_set_description(this, QLatin1String("shadereffect"));-
494#endif-
495}
executed 73 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
73
496-
497QQuickOpenGLShaderEffectNode::~QQuickOpenGLShaderEffectNode()-
498{-
499}-
500-
501void QQuickOpenGLShaderEffectNode::markDirtyTexture()-
502{-
503 markDirty(DirtyMaterial);-
504 Q_EMIT dirtyTexture();-
505}
executed 266 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
266
506-
507void QQuickOpenGLShaderEffectNode::textureProviderDestroyed(QObject *object)-
508{-
509 Q_ASSERT(material());-
510 static_cast<QQuickOpenGLShaderEffectMaterial *>(material())->invalidateTextureProvider(static_cast<QSGTextureProvider *>(object));-
511}
executed 8 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
8
512-
513void QQuickOpenGLShaderEffectNode::preprocess()-
514{-
515 Q_ASSERT(material());-
516 static_cast<QQuickOpenGLShaderEffectMaterial *>(material())->updateTextures();-
517}
executed 451 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickcustomparticle
  • tst_qquickitemlayer
  • tst_qquickshadereffect
  • tst_scenegraph
451
518-
519#include "qquickopenglshadereffectnode.moc"-
520#include "moc_qquickopenglshadereffectnode_p.cpp"-
521-
522QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0