| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickopenglshadereffectnode.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | static bool hasAtlasTexture(const QVector<QSGTextureProvider *> &textureProviders) | - | ||||||||||||||||||||||||
| 10 | { | - | ||||||||||||||||||||||||
| 11 | for (int i = 0; i < textureProviders.size()
| 0 | ||||||||||||||||||||||||
| 12 | QSGTextureProvider *t = textureProviders.at(i); | - | ||||||||||||||||||||||||
| 13 | if (t
| 0 | ||||||||||||||||||||||||
| 14 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 15 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 16 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 17 | } | - | ||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||
| 19 | class QQuickCustomMaterialShader : public QSGMaterialShader | - | ||||||||||||||||||||||||
| 20 | { | - | ||||||||||||||||||||||||
| 21 | public: | - | ||||||||||||||||||||||||
| 22 | QQuickCustomMaterialShader(const QQuickOpenGLShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes); | - | ||||||||||||||||||||||||
| 23 | void deactivate() override; | - | ||||||||||||||||||||||||
| 24 | void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; | - | ||||||||||||||||||||||||
| 25 | char const *const *attributeNames() const override; | - | ||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||
| 27 | protected: | - | ||||||||||||||||||||||||
| 28 | friend class QQuickOpenGLShaderEffectNode; | - | ||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||
| 30 | void compile() override; | - | ||||||||||||||||||||||||
| 31 | const char *vertexShader() const override; | - | ||||||||||||||||||||||||
| 32 | const char *fragmentShader() const override; | - | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | const QQuickOpenGLShaderEffectMaterialKey m_key; | - | ||||||||||||||||||||||||
| 35 | QVector<QByteArray> m_attributes; | - | ||||||||||||||||||||||||
| 36 | QVector<const char *> m_attributeNames; | - | ||||||||||||||||||||||||
| 37 | QString m_log; | - | ||||||||||||||||||||||||
| 38 | bool m_compiled; | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | QVector<int> m_uniformLocs[QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount]; | - | ||||||||||||||||||||||||
| 41 | uint m_initialized : 1; | - | ||||||||||||||||||||||||
| 42 | }; | - | ||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||
| 44 | QQuickCustomMaterialShader::QQuickCustomMaterialShader(const QQuickOpenGLShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes) | - | ||||||||||||||||||||||||
| 45 | : m_key(key) | - | ||||||||||||||||||||||||
| 46 | , m_attributes(attributes) | - | ||||||||||||||||||||||||
| 47 | , m_compiled(false) | - | ||||||||||||||||||||||||
| 48 | , m_initialized(false) | - | ||||||||||||||||||||||||
| 49 | { | - | ||||||||||||||||||||||||
| 50 | const int attributesCount = m_attributes.count(); | - | ||||||||||||||||||||||||
| 51 | m_attributeNames.reserve(attributesCount + 1); | - | ||||||||||||||||||||||||
| 52 | for (int i = 0; i < attributesCount
| 63-153 | ||||||||||||||||||||||||
| 53 | m_attributeNames.append(m_attributes.at(i).constData()); executed 153 times by 6 tests: m_attributeNames.append(m_attributes.at(i).constData());Executed by:
| 153 | ||||||||||||||||||||||||
| 54 | m_attributeNames.append(0); | - | ||||||||||||||||||||||||
| 55 | } executed 63 times by 6 tests: end of blockExecuted by:
| 63 | ||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | void QQuickCustomMaterialShader::deactivate() | - | ||||||||||||||||||||||||
| 58 | { | - | ||||||||||||||||||||||||
| 59 | QSGMaterialShader::deactivate(); | - | ||||||||||||||||||||||||
| 60 | QOpenGLContext::currentContext()->functions()->glDisable( | - | ||||||||||||||||||||||||
| 61 | 0x0B44 | - | ||||||||||||||||||||||||
| 62 | ); | - | ||||||||||||||||||||||||
| 63 | } executed 451 times by 6 tests: end of blockExecuted by:
| 451 | ||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | void QQuickCustomMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) | - | ||||||||||||||||||||||||
| 66 | { | - | ||||||||||||||||||||||||
| 67 | typedef QQuickOpenGLShaderEffectMaterial::UniformData UniformData; | - | ||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||
| 69 | ((newEffect != nullptr) ? static_cast<void>(0) : qt_assert("newEffect != nullptr", __FILE__, 114)); | - | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | QQuickOpenGLShaderEffectMaterial *material = static_cast<QQuickOpenGLShaderEffectMaterial *>(newEffect); | - | ||||||||||||||||||||||||
| 72 | if (!material->m_emittedLogChanged
| 54-341 | ||||||||||||||||||||||||
| 73 | material->m_emittedLogChanged = true; | - | ||||||||||||||||||||||||
| 74 | material->m_node->logAndStatusChanged(m_log, m_compiled ? QQuickShaderEffect::Compiled | - | ||||||||||||||||||||||||
| 75 | : QQuickShaderEffect::Error); | - | ||||||||||||||||||||||||
| 76 | } executed 54 times by 5 tests: end of blockExecuted by:
| 54 | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | int textureProviderIndex = 0; | - | ||||||||||||||||||||||||
| 79 | if (!m_initialized
| 63-388 | ||||||||||||||||||||||||
| 80 | for (int shaderType = 0; shaderType < QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount
| 63-126 | ||||||||||||||||||||||||
| 81 | ((m_uniformLocs[shaderType].isEmpty()) ? static_cast<void>(0) : qt_assert("m_uniformLocs[shaderType].isEmpty()", __FILE__, 126)); | - | ||||||||||||||||||||||||
| 82 | m_uniformLocs[shaderType].reserve(material->uniforms[shaderType].size()); | - | ||||||||||||||||||||||||
| 83 | for (int i = 0; i < material->uniforms[shaderType].size()
| 126-185 | ||||||||||||||||||||||||
| 84 | const UniformData &d = material->uniforms[shaderType].at(i); | - | ||||||||||||||||||||||||
| 85 | QByteArray name = d.name; | - | ||||||||||||||||||||||||
| 86 | if (d.specialType == UniformData::Sampler
| 0-129 | ||||||||||||||||||||||||
| 87 | program()->setUniformValue(d.name.constData(), textureProviderIndex++); | - | ||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||
| 91 | name = "qt_SubRect_" + name; | - | ||||||||||||||||||||||||
| 92 | } executed 56 times by 5 tests: end of blockExecuted by:
| 56 | ||||||||||||||||||||||||
| 93 | m_uniformLocs[shaderType].append(program()->uniformLocation(name.constData())); | - | ||||||||||||||||||||||||
| 94 | } executed 185 times by 6 tests: end of blockExecuted by:
| 185 | ||||||||||||||||||||||||
| 95 | } executed 126 times by 6 tests: end of blockExecuted by:
| 126 | ||||||||||||||||||||||||
| 96 | m_initialized = true; | - | ||||||||||||||||||||||||
| 97 | textureProviderIndex = 0; | - | ||||||||||||||||||||||||
| 98 | } executed 63 times by 6 tests: end of blockExecuted by:
| 63 | ||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | QOpenGLFunctions *functions = state.context()->functions(); | - | ||||||||||||||||||||||||
| 101 | for (int shaderType = 0; shaderType < QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount
| 451-902 | ||||||||||||||||||||||||
| 102 | for (int i = 0; i < material->uniforms[shaderType].size()
| 902-1565 | ||||||||||||||||||||||||
| 103 | const UniformData &d = material->uniforms[shaderType].at(i); | - | ||||||||||||||||||||||||
| 104 | int loc = m_uniformLocs[shaderType].at(i); | - | ||||||||||||||||||||||||
| 105 | if (d.specialType == UniformData::Sampler
| 0-1127 | ||||||||||||||||||||||||
| 106 | int idx = textureProviderIndex++; | - | ||||||||||||||||||||||||
| 107 | functions->glActiveTexture( | - | ||||||||||||||||||||||||
| 108 | 0x84C0 | - | ||||||||||||||||||||||||
| 109 | + idx); | - | ||||||||||||||||||||||||
| 110 | if (QSGTextureProvider *provider = material->textureProviders.at(idx)
| 133-305 | ||||||||||||||||||||||||
| 111 | if (QSGTexture *texture = provider->texture()
| 0-305 | ||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||
| 114 | if (!qsg_safeguard_texture(texture)
| 0-305 | ||||||||||||||||||||||||
| 115 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | if (loc >= 0
| 0-305 | ||||||||||||||||||||||||
| 119 | QRectF r = texture->normalizedTextureSubRect(); | - | ||||||||||||||||||||||||
| 120 | program()->setUniformValue(loc, r.x(), r.y(), r.width(), r.height()); | - | ||||||||||||||||||||||||
| 121 | } never executed: else if (texture->isAtlasTexture()end of block
| 0-299 | ||||||||||||||||||||||||
| 122 | texture = texture->removedFromAtlas(); | - | ||||||||||||||||||||||||
| 123 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 124 | texture->bind(); | - | ||||||||||||||||||||||||
| 125 | continue; executed 305 times by 5 tests: continue;Executed by:
| 305 | ||||||||||||||||||||||||
| 126 | } | - | ||||||||||||||||||||||||
| 127 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 128 | if (d.specialType == UniformData::Sampler
| 0-133 | ||||||||||||||||||||||||
| 129 | functions->glBindTexture( executed 133 times by 1 test: functions->glBindTexture( 0x0DE1 , 0);Executed by:
| 133 | ||||||||||||||||||||||||
| 130 | 0x0DE1 executed 133 times by 1 test: functions->glBindTexture( 0x0DE1 , 0);Executed by:
| 133 | ||||||||||||||||||||||||
| 131 | , 0); executed 133 times by 1 test: functions->glBindTexture( 0x0DE1 , 0);Executed by:
| 133 | ||||||||||||||||||||||||
| 132 | else if (d.specialType == UniformData::SamplerExternal
| 0 | ||||||||||||||||||||||||
| 133 | functions->glBindTexture(0x8D65, 0); never executed: functions->glBindTexture(0x8D65, 0); | 0 | ||||||||||||||||||||||||
| 134 | } executed 133 times by 1 test: else if (d.specialType == UniformData::Opacityend of blockExecuted by:
| 133-760 | ||||||||||||||||||||||||
| 135 | program()->setUniformValue(loc, state.opacity()); | - | ||||||||||||||||||||||||
| 136 | } executed 367 times by 4 tests: else if (d.specialType == UniformData::Matrixend of blockExecuted by:
| 309-451 | ||||||||||||||||||||||||
| 137 | if (state.isMatrixDirty()
| 0-451 | ||||||||||||||||||||||||
| 138 | program()->setUniformValue(loc, state.combinedMatrix()); executed 451 times by 6 tests: program()->setUniformValue(loc, state.combinedMatrix());Executed by:
| 451 | ||||||||||||||||||||||||
| 139 | } executed 451 times by 6 tests: else if (d.specialType == UniformData::Noneend of blockExecuted by:
| 0-451 | ||||||||||||||||||||||||
| 140 | switch (int(d.value.type())) { | - | ||||||||||||||||||||||||
| 141 | case executed 8 times by 1 test: QMetaType::QColor:case QMetaType::QColor:Executed by:
executed 8 times by 1 test: case QMetaType::QColor:Executed by:
| 8 | ||||||||||||||||||||||||
| 142 | program()->setUniformValue(loc, qt_premultiply_color(qvariant_cast<QColor>(d.value))); | - | ||||||||||||||||||||||||
| 143 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||||||||||||||
| 144 | case never executed: QMetaType::Float:case QMetaType::Float:never executed: case QMetaType::Float: | 0 | ||||||||||||||||||||||||
| 145 | program()->setUniformValue(loc, qvariant_cast<float>(d.value)); | - | ||||||||||||||||||||||||
| 146 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 147 | case executed 291 times by 2 tests: QMetaType::Double:case QMetaType::Double:Executed by:
executed 291 times by 2 tests: case QMetaType::Double:Executed by:
| 291 | ||||||||||||||||||||||||
| 148 | program()->setUniformValue(loc, (float) qvariant_cast<double>(d.value)); | - | ||||||||||||||||||||||||
| 149 | break; executed 291 times by 2 tests: break;Executed by:
| 291 | ||||||||||||||||||||||||
| 150 | case never executed: QMetaType::QTransform:case QMetaType::QTransform:never executed: case QMetaType::QTransform: | 0 | ||||||||||||||||||||||||
| 151 | program()->setUniformValue(loc, qvariant_cast<QTransform>(d.value)); | - | ||||||||||||||||||||||||
| 152 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 153 | case never executed: QMetaType::Int:case QMetaType::Int:never executed: case QMetaType::Int: | 0 | ||||||||||||||||||||||||
| 154 | program()->setUniformValue(loc, d.value.toInt()); | - | ||||||||||||||||||||||||
| 155 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 156 | case never executed: QMetaType::Bool:case QMetaType::Bool:never executed: case QMetaType::Bool: | 0 | ||||||||||||||||||||||||
| 157 | program()->setUniformValue(loc, GLint(d.value.toBool())); | - | ||||||||||||||||||||||||
| 158 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 159 | case never executed: QMetaType::QSize:case QMetaType::QSize:never executed: case QMetaType::QSize: | 0 | ||||||||||||||||||||||||
| 160 | case executed 6 times by 1 test: QMetaType::QSizeF:case QMetaType::QSizeF:Executed by:
executed 6 times by 1 test: case QMetaType::QSizeF:Executed by:
| 6 | ||||||||||||||||||||||||
| 161 | program()->setUniformValue(loc, d.value.toSizeF()); | - | ||||||||||||||||||||||||
| 162 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||||||||
| 163 | case never executed: QMetaType::QPoint:case QMetaType::QPoint:never executed: case QMetaType::QPoint: | 0 | ||||||||||||||||||||||||
| 164 | case never executed: QMetaType::QPointF:case QMetaType::QPointF:never executed: case QMetaType::QPointF: | 0 | ||||||||||||||||||||||||
| 165 | program()->setUniformValue(loc, d.value.toPointF()); | - | ||||||||||||||||||||||||
| 166 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 167 | case never executed: QMetaType::QRect:case QMetaType::QRect:never executed: case QMetaType::QRect: | 0 | ||||||||||||||||||||||||
| 168 | case never executed: QMetaType::QRectF:case QMetaType::QRectF:never executed: case QMetaType::QRectF: | 0 | ||||||||||||||||||||||||
| 169 | { | - | ||||||||||||||||||||||||
| 170 | QRectF r = d.value.toRectF(); | - | ||||||||||||||||||||||||
| 171 | program()->setUniformValue(loc, r.x(), r.y(), r.width(), r.height()); | - | ||||||||||||||||||||||||
| 172 | } | - | ||||||||||||||||||||||||
| 173 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 174 | case never executed: QMetaType::QVector2D:case QMetaType::QVector2D:never executed: case QMetaType::QVector2D: | 0 | ||||||||||||||||||||||||
| 175 | program()->setUniformValue(loc, qvariant_cast<QVector2D>(d.value)); | - | ||||||||||||||||||||||||
| 176 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 177 | case never executed: QMetaType::QVector3D:case QMetaType::QVector3D:never executed: case QMetaType::QVector3D: | 0 | ||||||||||||||||||||||||
| 178 | program()->setUniformValue(loc, qvariant_cast<QVector3D>(d.value)); | - | ||||||||||||||||||||||||
| 179 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 180 | case never executed: QMetaType::QVector4D:case QMetaType::QVector4D:never executed: case QMetaType::QVector4D: | 0 | ||||||||||||||||||||||||
| 181 | program()->setUniformValue(loc, qvariant_cast<QVector4D>(d.value)); | - | ||||||||||||||||||||||||
| 182 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 183 | case never executed: QMetaType::QQuaternion:case QMetaType::QQuaternion:never executed: case QMetaType::QQuaternion: | 0 | ||||||||||||||||||||||||
| 184 | { | - | ||||||||||||||||||||||||
| 185 | QQuaternion q = qvariant_cast<QQuaternion>(d.value); | - | ||||||||||||||||||||||||
| 186 | program()->setUniformValue(loc, q.x(), q.y(), q.z(), q.scalar()); | - | ||||||||||||||||||||||||
| 187 | } | - | ||||||||||||||||||||||||
| 188 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 189 | case never executed: QMetaType::QMatrix4x4:case QMetaType::QMatrix4x4:never executed: case QMetaType::QMatrix4x4: | 0 | ||||||||||||||||||||||||
| 190 | program()->setUniformValue(loc, qvariant_cast<QMatrix4x4>(d.value)); | - | ||||||||||||||||||||||||
| 191 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 192 | default executed 4 times by 1 test: :default:Executed by:
executed 4 times by 1 test: default:Executed by:
| 4 | ||||||||||||||||||||||||
| 193 | break; executed 4 times by 1 test: break;Executed by:
| 4 | ||||||||||||||||||||||||
| 194 | } | - | ||||||||||||||||||||||||
| 195 | } | - | ||||||||||||||||||||||||
| 196 | } executed 1260 times by 6 tests: end of blockExecuted by:
| 1260 | ||||||||||||||||||||||||
| 197 | } executed 902 times by 6 tests: end of blockExecuted by:
| 902 | ||||||||||||||||||||||||
| 198 | functions->glActiveTexture( | - | ||||||||||||||||||||||||
| 199 | 0x84C0 | - | ||||||||||||||||||||||||
| 200 | ); | - | ||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||
| 202 | const QQuickOpenGLShaderEffectMaterial *oldMaterial = static_cast<const QQuickOpenGLShaderEffectMaterial *>(oldEffect); | - | ||||||||||||||||||||||||
| 203 | if (oldEffect == nullptr
| 0-451 | ||||||||||||||||||||||||
| 204 | switch (material->cullMode) { | - | ||||||||||||||||||||||||
| 205 | case never executed: QQuickShaderEffect::FrontFaceCulling:case QQuickShaderEffect::FrontFaceCulling:never executed: case QQuickShaderEffect::FrontFaceCulling: | 0 | ||||||||||||||||||||||||
| 206 | functions->glEnable( | - | ||||||||||||||||||||||||
| 207 | 0x0B44 | - | ||||||||||||||||||||||||
| 208 | ); | - | ||||||||||||||||||||||||
| 209 | functions->glCullFace( | - | ||||||||||||||||||||||||
| 210 | 0x0404 | - | ||||||||||||||||||||||||
| 211 | ); | - | ||||||||||||||||||||||||
| 212 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 213 | case never executed: QQuickShaderEffect::BackFaceCulling:case QQuickShaderEffect::BackFaceCulling:never executed: case QQuickShaderEffect::BackFaceCulling: | 0 | ||||||||||||||||||||||||
| 214 | functions->glEnable( | - | ||||||||||||||||||||||||
| 215 | 0x0B44 | - | ||||||||||||||||||||||||
| 216 | ); | - | ||||||||||||||||||||||||
| 217 | functions->glCullFace( | - | ||||||||||||||||||||||||
| 218 | 0x0405 | - | ||||||||||||||||||||||||
| 219 | ); | - | ||||||||||||||||||||||||
| 220 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 221 | default executed 451 times by 6 tests: :default:Executed by:
executed 451 times by 6 tests: default:Executed by:
| 451 | ||||||||||||||||||||||||
| 222 | functions->glDisable( | - | ||||||||||||||||||||||||
| 223 | 0x0B44 | - | ||||||||||||||||||||||||
| 224 | ); | - | ||||||||||||||||||||||||
| 225 | break; executed 451 times by 6 tests: break;Executed by:
| 451 | ||||||||||||||||||||||||
| 226 | } | - | ||||||||||||||||||||||||
| 227 | } | - | ||||||||||||||||||||||||
| 228 | } executed 451 times by 6 tests: end of blockExecuted by:
| 451 | ||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||
| 230 | char const *const *QQuickCustomMaterialShader::attributeNames() const | - | ||||||||||||||||||||||||
| 231 | { | - | ||||||||||||||||||||||||
| 232 | return executed 1416 times by 6 tests: m_attributeNames.constData();return m_attributeNames.constData();Executed by:
executed 1416 times by 6 tests: return m_attributeNames.constData();Executed by:
| 1416 | ||||||||||||||||||||||||
| 233 | } | - | ||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | void QQuickCustomMaterialShader::compile() | - | ||||||||||||||||||||||||
| 236 | { | - | ||||||||||||||||||||||||
| 237 | ((!program()->isLinked()) ? static_cast<void>(0) : qt_assert_x("QQuickCustomMaterialShader::compile()", "Compile called multiple times!", __FILE__, 266)); | - | ||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | m_log.clear(); | - | ||||||||||||||||||||||||
| 240 | m_compiled = true; | - | ||||||||||||||||||||||||
| 241 | if (!program()->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vertexShader())
| 0-9 | ||||||||||||||||||||||||
| 242 | m_log += QLatin1String("*** Vertex shader ***\n") + program()->log(); | - | ||||||||||||||||||||||||
| 243 | m_compiled = false; | - | ||||||||||||||||||||||||
| 244 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 245 | if (!program()->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShader())
| 0-9 | ||||||||||||||||||||||||
| 246 | m_log += QLatin1String("*** Fragment shader ***\n") + program()->log(); | - | ||||||||||||||||||||||||
| 247 | m_compiled = false; | - | ||||||||||||||||||||||||
| 248 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 249 | - | |||||||||||||||||||||||||
| 250 | char const *const *attr = attributeNames(); | - | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | int maxVertexAttribs = 0; | - | ||||||||||||||||||||||||
| 253 | QOpenGLContext::currentContext()->functions()->glGetIntegerv(0x8869, &maxVertexAttribs); | - | ||||||||||||||||||||||||
| 254 | int attrCount = 0; | - | ||||||||||||||||||||||||
| 255 | while (attrCount < maxVertexAttribs
| 0-54 | ||||||||||||||||||||||||
| 256 | ++ executed 45 times by 2 tests: attrCount;++attrCount;Executed by:
executed 45 times by 2 tests: ++attrCount;Executed by:
| 45 | ||||||||||||||||||||||||
| 257 | if (attr[attrCount]
| 0-9 | ||||||||||||||||||||||||
| 258 | QMessageLogger(__FILE__, 287, __PRETTY_FUNCTION__).warning("List of attribute names is too long.\n" | - | ||||||||||||||||||||||||
| 259 | "Maximum number of attributes on this hardware is %i.\n" | - | ||||||||||||||||||||||||
| 260 | "Vertex shader:\n%s\n" | - | ||||||||||||||||||||||||
| 261 | "Fragment shader:\n%s\n", | - | ||||||||||||||||||||||||
| 262 | maxVertexAttribs, vertexShader(), fragmentShader()); | - | ||||||||||||||||||||||||
| 263 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||
| 266 | if (m_compiled
| 0-9 | ||||||||||||||||||||||||
| 267 | - | |||||||||||||||||||||||||
| 268 | for (int i = 0; i < attrCount
| 9-45 | ||||||||||||||||||||||||
| 269 | - | |||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||
| 272 | if (*
| 0-45 | ||||||||||||||||||||||||
| 273 | program()->bindAttributeLocation(attr[i], i); executed 45 times by 2 tests: program()->bindAttributeLocation(attr[i], i);Executed by:
| 45 | ||||||||||||||||||||||||
| 274 | } executed 45 times by 2 tests: end of blockExecuted by:
| 45 | ||||||||||||||||||||||||
| 275 | m_compiled = program()->link(); | - | ||||||||||||||||||||||||
| 276 | m_log += program()->log(); | - | ||||||||||||||||||||||||
| 277 | } executed 9 times by 2 tests: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||
| 279 | if (!m_compiled
| 0-9 | ||||||||||||||||||||||||
| 280 | QMessageLogger(__FILE__, 309, __PRETTY_FUNCTION__).warning("QQuickCustomMaterialShader: Shader compilation failed:"); | - | ||||||||||||||||||||||||
| 281 | QMessageLogger(__FILE__, 310, __PRETTY_FUNCTION__).warning() << program()->log(); | - | ||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | QSGShaderSourceBuilder::initializeProgramFromFiles( | - | ||||||||||||||||||||||||
| 284 | program(), | - | ||||||||||||||||||||||||
| 285 | ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/items/shaders/shadereffectfallback.vert")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/items/shaders/shadereffectfallback.vert" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()),return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 286 | ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/items/shaders/shadereffectfallback.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/items/shaders/shadereffectfallback.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||
| 289 | for (int i = 0; i < attrCount
| 0 | ||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||
| 293 | if (qstrcmp(attr[i], qtPositionAttributeName()) == 0
| 0 | ||||||||||||||||||||||||
| 294 | program()->bindAttributeLocation("v", i); never executed: program()->bindAttributeLocation("v", i); | 0 | ||||||||||||||||||||||||
| 295 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 296 | program()->link(); | - | ||||||||||||||||||||||||
| 297 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 298 | } executed 9 times by 2 tests: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||
| 300 | const char *QQuickCustomMaterialShader::vertexShader() const | - | ||||||||||||||||||||||||
| 301 | { | - | ||||||||||||||||||||||||
| 302 | return executed 63 times by 6 tests: m_key.sourceCode[QQuickOpenGLShaderEffectMaterialKey::VertexShader].constData();return m_key.sourceCode[QQuickOpenGLShaderEffectMaterialKey::VertexShader].constData();Executed by:
executed 63 times by 6 tests: return m_key.sourceCode[QQuickOpenGLShaderEffectMaterialKey::VertexShader].constData();Executed by:
| 63 | ||||||||||||||||||||||||
| 303 | } | - | ||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||
| 305 | const char *QQuickCustomMaterialShader::fragmentShader() const | - | ||||||||||||||||||||||||
| 306 | { | - | ||||||||||||||||||||||||
| 307 | return executed 63 times by 6 tests: m_key.sourceCode[QQuickOpenGLShaderEffectMaterialKey::FragmentShader].constData();return m_key.sourceCode[QQuickOpenGLShaderEffectMaterialKey::FragmentShader].constData();Executed by:
executed 63 times by 6 tests: return m_key.sourceCode[QQuickOpenGLShaderEffectMaterialKey::FragmentShader].constData();Executed by:
| 63 | ||||||||||||||||||||||||
| 308 | } | - | ||||||||||||||||||||||||
| 309 | - | |||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||
| 311 | bool QQuickOpenGLShaderEffectMaterialKey::operator == (const QQuickOpenGLShaderEffectMaterialKey &other) const | - | ||||||||||||||||||||||||
| 312 | { | - | ||||||||||||||||||||||||
| 313 | for (int shaderType = 0; shaderType < ShaderTypeCount
| 2-4 | ||||||||||||||||||||||||
| 314 | if (sourceCode[shaderType] != other.sourceCode[shaderType]
| 0-4 | ||||||||||||||||||||||||
| 315 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 316 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 317 | return executed 2 times by 1 test: true;return true;Executed by:
executed 2 times by 1 test: return true;Executed by:
| 2 | ||||||||||||||||||||||||
| 318 | } | - | ||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||
| 320 | bool QQuickOpenGLShaderEffectMaterialKey::operator != (const QQuickOpenGLShaderEffectMaterialKey &other) const | - | ||||||||||||||||||||||||
| 321 | { | - | ||||||||||||||||||||||||
| 322 | return never executed: !(*this == other);return !(*this == other);never executed: return !(*this == other); | 0 | ||||||||||||||||||||||||
| 323 | } | - | ||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||
| 325 | uint qHash(const QQuickOpenGLShaderEffectMaterialKey &key) | - | ||||||||||||||||||||||||
| 326 | { | - | ||||||||||||||||||||||||
| 327 | uint hash = 1; | - | ||||||||||||||||||||||||
| 328 | typedef QQuickOpenGLShaderEffectMaterialKey Key; | - | ||||||||||||||||||||||||
| 329 | for (int shaderType = 0; shaderType < Key::ShaderTypeCount
| 87-174 | ||||||||||||||||||||||||
| 330 | hash = hash * 31337 + qHash(key.sourceCode[shaderType]); executed 174 times by 6 tests: hash = hash * 31337 + qHash(key.sourceCode[shaderType]);Executed by:
| 174 | ||||||||||||||||||||||||
| 331 | return executed 87 times by 6 tests: hash;return hash;Executed by:
executed 87 times by 6 tests: return hash;Executed by:
| 87 | ||||||||||||||||||||||||
| 332 | } | - | ||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | class QQuickOpenGLShaderEffectMaterialCache : public QObject | - | ||||||||||||||||||||||||
| 335 | { | - | ||||||||||||||||||||||||
| 336 | public: | - | ||||||||||||||||||||||||
| 337 | #pragma GCC diagnostic push | - | ||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||||||||||||||||||||
| 340 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||||||||||||||||||||
| 341 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||||||||||||||||||||
| 342 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||||||||||||||
| 343 | #pragma GCC diagnostic pop | - | ||||||||||||||||||||||||
| 344 | struct QPrivateSignal {}; | - | ||||||||||||||||||||||||
| 345 | public: | - | ||||||||||||||||||||||||
| 346 | static QQuickOpenGLShaderEffectMaterialCache *get(bool create = true) { | - | ||||||||||||||||||||||||
| 347 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||||||||||||||
| 348 | QQuickOpenGLShaderEffectMaterialCache *me = ctx->findChild<QQuickOpenGLShaderEffectMaterialCache *>(([]() noexcept -> QString { enum { Size = sizeof(u"" "__qt_ShaderEffectCache")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "__qt_ShaderEffectCache" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 5427 times by 89 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 5427 times by 89 tests: }()), Qt::FindDirectChildrenOnly);return qstring_literal_temp;Executed by:
| 5427 | ||||||||||||||||||||||||
| 349 | if (!me
| 57-5354 | ||||||||||||||||||||||||
| 350 | me = new QQuickOpenGLShaderEffectMaterialCache(); | - | ||||||||||||||||||||||||
| 351 | me->setObjectName(([]() noexcept -> QString { enum { Size = sizeof(u"" "__qt_ShaderEffectCache")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "__qt_ShaderEffectCache" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 57 times by 6 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 57 times by 6 tests: }()));return qstring_literal_temp;Executed by:
| 57 | ||||||||||||||||||||||||
| 352 | me->setParent(ctx); | - | ||||||||||||||||||||||||
| 353 | } executed 57 times by 6 tests: end of blockExecuted by:
| 57 | ||||||||||||||||||||||||
| 354 | return executed 5427 times by 89 tests: me;return me;Executed by:
executed 5427 times by 89 tests: return me;Executed by:
| 5427 | ||||||||||||||||||||||||
| 355 | } | - | ||||||||||||||||||||||||
| 356 | QHash<QQuickOpenGLShaderEffectMaterialKey, QSGMaterialType *> cache; | - | ||||||||||||||||||||||||
| 357 | }; | - | ||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 | QQuickOpenGLShaderEffectMaterial::QQuickOpenGLShaderEffectMaterial(QQuickOpenGLShaderEffectNode *node) | - | ||||||||||||||||||||||||
| 360 | : cullMode(QQuickShaderEffect::NoCulling) | - | ||||||||||||||||||||||||
| 361 | , geometryUsesTextureSubRect(false) | - | ||||||||||||||||||||||||
| 362 | , m_node(node) | - | ||||||||||||||||||||||||
| 363 | , m_emittedLogChanged(false) | - | ||||||||||||||||||||||||
| 364 | { | - | ||||||||||||||||||||||||
| 365 | setFlag(Blending | RequiresFullMatrix, true); | - | ||||||||||||||||||||||||
| 366 | } executed 73 times by 6 tests: end of blockExecuted by:
| 73 | ||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||
| 368 | QSGMaterialType *QQuickOpenGLShaderEffectMaterial::type() const | - | ||||||||||||||||||||||||
| 369 | { | - | ||||||||||||||||||||||||
| 370 | return executed 509 times by 6 tests: m_type;return m_type;Executed by:
executed 509 times by 6 tests: return m_type;Executed by:
| 509 | ||||||||||||||||||||||||
| 371 | } | - | ||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||
| 373 | QSGMaterialShader *QQuickOpenGLShaderEffectMaterial::createShader() const | - | ||||||||||||||||||||||||
| 374 | { | - | ||||||||||||||||||||||||
| 375 | return executed 63 times by 6 tests: new QQuickCustomMaterialShader(m_source, attributes);return new QQuickCustomMaterialShader(m_source, attributes);Executed by:
executed 63 times by 6 tests: return new QQuickCustomMaterialShader(m_source, attributes);Executed by:
| 63 | ||||||||||||||||||||||||
| 376 | } | - | ||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||
| 378 | bool QQuickOpenGLShaderEffectMaterial::UniformData::operator == (const UniformData &other) const | - | ||||||||||||||||||||||||
| 379 | { | - | ||||||||||||||||||||||||
| 380 | if (specialType != other.specialType
| 0 | ||||||||||||||||||||||||
| 381 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 382 | if (name != other.name
| 0 | ||||||||||||||||||||||||
| 383 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 384 | - | |||||||||||||||||||||||||
| 385 | if (specialType == UniformData::Sampler
| 0 | ||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 390 | } else { | - | ||||||||||||||||||||||||
| 391 | return never executed: value == other.value;return value == other.value;never executed: return value == other.value; | 0 | ||||||||||||||||||||||||
| 392 | } | - | ||||||||||||||||||||||||
| 393 | } | - | ||||||||||||||||||||||||
| 394 | - | |||||||||||||||||||||||||
| 395 | int QQuickOpenGLShaderEffectMaterial::compare(const QSGMaterial *o) const | - | ||||||||||||||||||||||||
| 396 | { | - | ||||||||||||||||||||||||
| 397 | const QQuickOpenGLShaderEffectMaterial *other = static_cast<const QQuickOpenGLShaderEffectMaterial *>(o); | - | ||||||||||||||||||||||||
| 398 | if ((hasAtlasTexture(textureProviders)
| 0 | ||||||||||||||||||||||||
| 399 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 400 | if (cullMode != other->cullMode
| 0 | ||||||||||||||||||||||||
| 401 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 402 | for (int shaderType = 0; shaderType < QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount
| 0 | ||||||||||||||||||||||||
| 403 | if (uniforms[shaderType] != other->uniforms[shaderType]
| 0 | ||||||||||||||||||||||||
| 404 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 405 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||
| 408 | if (textureProviders.size() != other->textureProviders.size()
| 0 | ||||||||||||||||||||||||
| 409 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 410 | for (int i=0; i<textureProviders.size()
| 0 | ||||||||||||||||||||||||
| 411 | QSGTextureProvider *tp1 = textureProviders.at(i); | - | ||||||||||||||||||||||||
| 412 | QSGTextureProvider *tp2 = other->textureProviders.at(i); | - | ||||||||||||||||||||||||
| 413 | if (!tp1
| 0 | ||||||||||||||||||||||||
| 414 | return never executed: tp1 == tp2 ? 0 : 1;return tp1 == tp2 ? 0 : 1;never executed: return tp1 == tp2 ? 0 : 1; | 0 | ||||||||||||||||||||||||
| 415 | QSGTexture *t1 = tp1->texture(); | - | ||||||||||||||||||||||||
| 416 | QSGTexture *t2 = tp2->texture(); | - | ||||||||||||||||||||||||
| 417 | if (!t1
| 0 | ||||||||||||||||||||||||
| 418 | return never executed: t1 == t2 ? 0 : 1;return t1 == t2 ? 0 : 1;never executed: return t1 == t2 ? 0 : 1; | 0 | ||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||
| 420 | if (t1->textureId() != t2->textureId()
| 0 | ||||||||||||||||||||||||
| 421 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 422 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 423 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 424 | } | - | ||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | void QQuickOpenGLShaderEffectMaterial::setProgramSource(const QQuickOpenGLShaderEffectMaterialKey &source) | - | ||||||||||||||||||||||||
| 427 | { | - | ||||||||||||||||||||||||
| 428 | m_source = source; | - | ||||||||||||||||||||||||
| 429 | m_emittedLogChanged = false; | - | ||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||
| 431 | QQuickOpenGLShaderEffectMaterialCache *cache = QQuickOpenGLShaderEffectMaterialCache::get(); | - | ||||||||||||||||||||||||
| 432 | m_type = cache->cache.value(m_source); | - | ||||||||||||||||||||||||
| 433 | if (!m_type
| 2-71 | ||||||||||||||||||||||||
| 434 | m_type = new QSGMaterialType(); | - | ||||||||||||||||||||||||
| 435 | cache->cache.insert(source, m_type); | - | ||||||||||||||||||||||||
| 436 | } executed 71 times by 6 tests: end of blockExecuted by:
| 71 | ||||||||||||||||||||||||
| 437 | } executed 73 times by 6 tests: end of blockExecuted by:
| 73 | ||||||||||||||||||||||||
| 438 | - | |||||||||||||||||||||||||
| 439 | void QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache() | - | ||||||||||||||||||||||||
| 440 | { | - | ||||||||||||||||||||||||
| 441 | QQuickOpenGLShaderEffectMaterialCache *cache = QQuickOpenGLShaderEffectMaterialCache::get(false); | - | ||||||||||||||||||||||||
| 442 | if (cache
| 57-5297 | ||||||||||||||||||||||||
| 443 | qDeleteAll(cache->cache); | - | ||||||||||||||||||||||||
| 444 | delete cache; | - | ||||||||||||||||||||||||
| 445 | } executed 57 times by 6 tests: end of blockExecuted by:
| 57 | ||||||||||||||||||||||||
| 446 | } executed 5354 times by 89 tests: end of blockExecuted by:
| 5354 | ||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||
| 448 | void QQuickOpenGLShaderEffectMaterial::updateTextures() const | - | ||||||||||||||||||||||||
| 449 | { | - | ||||||||||||||||||||||||
| 450 | for (int i = 0; i < textureProviders.size()
| 438-451 | ||||||||||||||||||||||||
| 451 | if (QSGTextureProvider *provider = textureProviders.at(i)
| 133-305 | ||||||||||||||||||||||||
| 452 | if (QSGDynamicTexture *texture = qobject_cast<QSGDynamicTexture *>(provider->texture())
| 6-299 | ||||||||||||||||||||||||
| 453 | texture->updateTexture(); executed 299 times by 3 tests: texture->updateTexture();Executed by:
| 299 | ||||||||||||||||||||||||
| 454 | } executed 305 times by 5 tests: end of blockExecuted by:
| 305 | ||||||||||||||||||||||||
| 455 | } executed 438 times by 5 tests: end of blockExecuted by:
| 438 | ||||||||||||||||||||||||
| 456 | } executed 451 times by 6 tests: end of blockExecuted by:
| 451 | ||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | void QQuickOpenGLShaderEffectMaterial::invalidateTextureProvider(QSGTextureProvider *provider) | - | ||||||||||||||||||||||||
| 459 | { | - | ||||||||||||||||||||||||
| 460 | for (int i = 0; i < textureProviders.size()
| 8-12 | ||||||||||||||||||||||||
| 461 | if (provider == textureProviders.at(i)
| 4-8 | ||||||||||||||||||||||||
| 462 | textureProviders[i] = 0; executed 8 times by 2 tests: textureProviders[i] = 0;Executed by:
| 8 | ||||||||||||||||||||||||
| 463 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||
| 464 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||
| 467 | QQuickOpenGLShaderEffectNode::QQuickOpenGLShaderEffectNode() | - | ||||||||||||||||||||||||
| 468 | { | - | ||||||||||||||||||||||||
| 469 | QSGNode::setFlag(UsePreprocess, true); | - | ||||||||||||||||||||||||
| 470 | - | |||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||
| 472 | qsgnode_set_description(this, QLatin1String("shadereffect")); | - | ||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||
| 474 | } executed 73 times by 6 tests: end of blockExecuted by:
| 73 | ||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||
| 476 | QQuickOpenGLShaderEffectNode::~QQuickOpenGLShaderEffectNode() | - | ||||||||||||||||||||||||
| 477 | { | - | ||||||||||||||||||||||||
| 478 | } | - | ||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||
| 480 | void QQuickOpenGLShaderEffectNode::markDirtyTexture() | - | ||||||||||||||||||||||||
| 481 | { | - | ||||||||||||||||||||||||
| 482 | markDirty(DirtyMaterial); | - | ||||||||||||||||||||||||
| 483 | dirtyTexture(); | - | ||||||||||||||||||||||||
| 484 | } executed 266 times by 3 tests: end of blockExecuted by:
| 266 | ||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||
| 486 | void QQuickOpenGLShaderEffectNode::textureProviderDestroyed(QObject *object) | - | ||||||||||||||||||||||||
| 487 | { | - | ||||||||||||||||||||||||
| 488 | ((material()) ? static_cast<void>(0) : qt_assert("material()", __FILE__, 509)); | - | ||||||||||||||||||||||||
| 489 | static_cast<QQuickOpenGLShaderEffectMaterial *>(material())->invalidateTextureProvider(static_cast<QSGTextureProvider *>(object)); | - | ||||||||||||||||||||||||
| 490 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 491 | - | |||||||||||||||||||||||||
| 492 | void QQuickOpenGLShaderEffectNode::preprocess() | - | ||||||||||||||||||||||||
| 493 | { | - | ||||||||||||||||||||||||
| 494 | ((material()) ? static_cast<void>(0) : qt_assert("material()", __FILE__, 515)); | - | ||||||||||||||||||||||||
| 495 | static_cast<QQuickOpenGLShaderEffectMaterial *>(material())->updateTextures(); | - | ||||||||||||||||||||||||
| 496 | } executed 451 times by 6 tests: end of blockExecuted by:
| 451 | ||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |