| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickopenglshadereffectnode.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 | - | |||||||||||||||||||||||||
| 54 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | static bool hasAtlasTexture(const QVector<QSGTextureProvider *> &textureProviders) | - | ||||||||||||||||||||||||
| 57 | { | - | ||||||||||||||||||||||||
| 58 | for (int i = 0; i < textureProviders.size(); ++i) {
| 0 | ||||||||||||||||||||||||
| 59 | QSGTextureProvider *t = textureProviders.at(i); | - | ||||||||||||||||||||||||
| 60 | if (t && t->texture() && t->texture()->isAtlasTexture())
| 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 | - | |||||||||||||||||||||||||
| 66 | class QQuickCustomMaterialShader : public QSGMaterialShader | - | ||||||||||||||||||||||||
| 67 | { | - | ||||||||||||||||||||||||
| 68 | public: | - | ||||||||||||||||||||||||
| 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 | - | |||||||||||||||||||||||||
| 74 | protected: | - | ||||||||||||||||||||||||
| 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 | - | |||||||||||||||||||||||||
| 91 | QQuickCustomMaterialShader::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)
| 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:
| 153 | ||||||||||||||||||||||||
| 101 | m_attributeNames.append(0); | - | ||||||||||||||||||||||||
| 102 | } executed 63 times by 6 tests: end of blockExecuted by:
| 63 | ||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | void QQuickCustomMaterialShader::deactivate() | - | ||||||||||||||||||||||||
| 105 | { | - | ||||||||||||||||||||||||
| 106 | QSGMaterialShader::deactivate(); | - | ||||||||||||||||||||||||
| 107 | QOpenGLContext::currentContext()->functions()->glDisable(GL_CULL_FACE); | - | ||||||||||||||||||||||||
| 108 | } executed 451 times by 6 tests: end of blockExecuted by:
| 451 | ||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | void 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) {
| 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 blockExecuted by:
| 54 | ||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | int textureProviderIndex = 0; | - | ||||||||||||||||||||||||
| 124 | if (!m_initialized) {
| 63-388 | ||||||||||||||||||||||||
| 125 | for (int shaderType = 0; shaderType < QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount; ++shaderType) {
| 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) {
| 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) {
| 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 blockExecuted by:
| 56 | ||||||||||||||||||||||||
| 138 | m_uniformLocs[shaderType].append(program()->uniformLocation(name.constData())); | - | ||||||||||||||||||||||||
| 139 | } executed 185 times by 6 tests: end of blockExecuted by:
| 185 | ||||||||||||||||||||||||
| 140 | } executed 126 times by 6 tests: end of blockExecuted by:
| 126 | ||||||||||||||||||||||||
| 141 | m_initialized = true; | - | ||||||||||||||||||||||||
| 142 | textureProviderIndex = 0; | - | ||||||||||||||||||||||||
| 143 | } executed 63 times by 6 tests: end of blockExecuted by:
| 63 | ||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||
| 145 | QOpenGLFunctions *functions = state.context()->functions(); | - | ||||||||||||||||||||||||
| 146 | for (int shaderType = 0; shaderType < QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount; ++shaderType) {
| 451-902 | ||||||||||||||||||||||||
| 147 | for (int i = 0; i < material->uniforms[shaderType].size(); ++i) {
| 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) {
| 0-1127 | ||||||||||||||||||||||||
| 151 | int idx = textureProviderIndex++; | - | ||||||||||||||||||||||||
| 152 | functions->glActiveTexture(GL_TEXTURE0 + idx); | - | ||||||||||||||||||||||||
| 153 | if (QSGTextureProvider *provider = material->textureProviders.at(idx)) {
| 133-305 | ||||||||||||||||||||||||
| 154 | if (QSGTexture *texture = provider->texture()) {
| 0-305 | ||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||
| 156 | #ifndef QT_NO_DEBUG | - | ||||||||||||||||||||||||
| 157 | if (!qsg_safeguard_texture(texture))
| 0-305 | ||||||||||||||||||||||||
| 158 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 159 | #endif | - | ||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | if (loc >= 0) {
| 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
| 0-299 | ||||||||||||||||||||||||
| 165 | texture = texture->removedFromAtlas(); | - | ||||||||||||||||||||||||
| 166 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 167 | texture->bind(); | - | ||||||||||||||||||||||||
| 168 | continue; executed 305 times by 5 tests: continue;Executed by:
| 305 | ||||||||||||||||||||||||
| 169 | } | - | ||||||||||||||||||||||||
| 170 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 171 | if (d.specialType == UniformData::Sampler)
| 0-133 | ||||||||||||||||||||||||
| 172 | functions->glBindTexture(GL_TEXTURE_2D, 0); executed 133 times by 1 test: functions->glBindTexture( 0x0DE1 , 0);Executed by:
| 133 | ||||||||||||||||||||||||
| 173 | else if (d.specialType == UniformData::SamplerExternal)
| 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 blockExecuted by:
| 133-760 | ||||||||||||||||||||||||
| 176 | program()->setUniformValue(loc, state.opacity()); | - | ||||||||||||||||||||||||
| 177 | } else if (d.specialType == UniformData::Matrix) { executed 367 times by 4 tests: end of blockExecuted by:
| 309-451 | ||||||||||||||||||||||||
| 178 | if (state.isMatrixDirty())
| 0-451 | ||||||||||||||||||||||||
| 179 | program()->setUniformValue(loc, state.combinedMatrix()); executed 451 times by 6 tests: program()->setUniformValue(loc, state.combinedMatrix());Executed by:
| 451 | ||||||||||||||||||||||||
| 180 | } else if (d.specialType == UniformData::None) { executed 451 times by 6 tests: end of blockExecuted by:
| 0-451 | ||||||||||||||||||||||||
| 181 | switch (int(d.value.type())) { | - | ||||||||||||||||||||||||
| 182 | case QMetaType::QColor: executed 8 times by 1 test: case QMetaType::QColor:Executed by:
| 8 | ||||||||||||||||||||||||
| 183 | program()->setUniformValue(loc, qt_premultiply_color(qvariant_cast<QColor>(d.value))); | - | ||||||||||||||||||||||||
| 184 | break; executed 8 times by 1 test: break;Executed by:
| 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:
| 291 | ||||||||||||||||||||||||
| 189 | program()->setUniformValue(loc, (float) qvariant_cast<double>(d.value)); | - | ||||||||||||||||||||||||
| 190 | break; executed 291 times by 2 tests: break;Executed by:
| 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:
| 6 | ||||||||||||||||||||||||
| 202 | program()->setUniformValue(loc, d.value.toSizeF()); | - | ||||||||||||||||||||||||
| 203 | break; executed 6 times by 1 test: break;Executed by:
| 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:
| 4 | ||||||||||||||||||||||||
| 234 | break; executed 4 times by 1 test: break;Executed by:
| 4 | ||||||||||||||||||||||||
| 235 | } | - | ||||||||||||||||||||||||
| 236 | } | - | ||||||||||||||||||||||||
| 237 | } executed 1260 times by 6 tests: end of blockExecuted by:
| 1260 | ||||||||||||||||||||||||
| 238 | } executed 902 times by 6 tests: end of blockExecuted by:
| 902 | ||||||||||||||||||||||||
| 239 | functions->glActiveTexture(GL_TEXTURE0); | - | ||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | const QQuickOpenGLShaderEffectMaterial *oldMaterial = static_cast<const QQuickOpenGLShaderEffectMaterial *>(oldEffect); | - | ||||||||||||||||||||||||
| 242 | if (oldEffect == nullptr || material->cullMode != oldMaterial->cullMode) {
| 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:
| 451 | ||||||||||||||||||||||||
| 253 | functions->glDisable(GL_CULL_FACE); | - | ||||||||||||||||||||||||
| 254 | break; executed 451 times by 6 tests: break;Executed by:
| 451 | ||||||||||||||||||||||||
| 255 | } | - | ||||||||||||||||||||||||
| 256 | } | - | ||||||||||||||||||||||||
| 257 | } executed 451 times by 6 tests: end of blockExecuted by:
| 451 | ||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||
| 259 | char const *const *QQuickCustomMaterialShader::attributeNames() const | - | ||||||||||||||||||||||||
| 260 | { | - | ||||||||||||||||||||||||
| 261 | return m_attributeNames.constData(); executed 1416 times by 6 tests: return m_attributeNames.constData();Executed by:
| 1416 | ||||||||||||||||||||||||
| 262 | } | - | ||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||
| 264 | void 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())) {
| 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())) {
| 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])
| 0-54 | ||||||||||||||||||||||||
| 285 | ++attrCount; executed 45 times by 2 tests: ++attrCount;Executed by:
| 45 | ||||||||||||||||||||||||
| 286 | if (attr[attrCount]) {
| 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) {
| 0-9 | ||||||||||||||||||||||||
| 296 | #ifndef QT_NO_DEBUG | - | ||||||||||||||||||||||||
| 297 | for (int i = 0; i < attrCount; ++i) {
| 9-45 | ||||||||||||||||||||||||
| 298 | #else | - | ||||||||||||||||||||||||
| 299 | for (int i = 0; attr[i]; ++i) { | - | ||||||||||||||||||||||||
| 300 | #endif | - | ||||||||||||||||||||||||
| 301 | if (*attr[i])
| 0-45 | ||||||||||||||||||||||||
| 302 | program()->bindAttributeLocation(attr[i], i); executed 45 times by 2 tests: program()->bindAttributeLocation(attr[i], i);Executed by:
| 45 | ||||||||||||||||||||||||
| 303 | } executed 45 times by 2 tests: end of blockExecuted by:
| 45 | ||||||||||||||||||||||||
| 304 | m_compiled = program()->link(); | - | ||||||||||||||||||||||||
| 305 | m_log += program()->log(); | - | ||||||||||||||||||||||||
| 306 | } executed 9 times by 2 tests: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||
| 308 | if (!m_compiled) {
| 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) {
| 0 | ||||||||||||||||||||||||
| 319 | #else | - | ||||||||||||||||||||||||
| 320 | for (int i = 0; attr[i]; ++i) { | - | ||||||||||||||||||||||||
| 321 | #endif | - | ||||||||||||||||||||||||
| 322 | if (qstrcmp(attr[i], qtPositionAttributeName()) == 0)
| 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 blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||
| 329 | const 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:
| 63 | ||||||||||||||||||||||||
| 332 | } | - | ||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | const 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:
| 63 | ||||||||||||||||||||||||
| 337 | } | - | ||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||
| 340 | bool QQuickOpenGLShaderEffectMaterialKey::operator == (const QQuickOpenGLShaderEffectMaterialKey &other) const | - | ||||||||||||||||||||||||
| 341 | { | - | ||||||||||||||||||||||||
| 342 | for (int shaderType = 0; shaderType < ShaderTypeCount; ++shaderType) {
| 2-4 | ||||||||||||||||||||||||
| 343 | if (sourceCode[shaderType] != other.sourceCode[shaderType])
| 0-4 | ||||||||||||||||||||||||
| 344 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 345 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 346 | return true; executed 2 times by 1 test: return true;Executed by:
| 2 | ||||||||||||||||||||||||
| 347 | } | - | ||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||
| 349 | bool QQuickOpenGLShaderEffectMaterialKey::operator != (const QQuickOpenGLShaderEffectMaterialKey &other) const | - | ||||||||||||||||||||||||
| 350 | { | - | ||||||||||||||||||||||||
| 351 | return !(*this == other); never executed: return !(*this == other); | 0 | ||||||||||||||||||||||||
| 352 | } | - | ||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | uint qHash(const QQuickOpenGLShaderEffectMaterialKey &key) | - | ||||||||||||||||||||||||
| 355 | { | - | ||||||||||||||||||||||||
| 356 | uint hash = 1; | - | ||||||||||||||||||||||||
| 357 | typedef QQuickOpenGLShaderEffectMaterialKey Key; | - | ||||||||||||||||||||||||
| 358 | for (int shaderType = 0; shaderType < Key::ShaderTypeCount; ++shaderType)
| 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:
| 174 | ||||||||||||||||||||||||
| 360 | return hash; executed 87 times by 6 tests: return hash;Executed by:
| 87 | ||||||||||||||||||||||||
| 361 | } | - | ||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||
| 363 | class QQuickOpenGLShaderEffectMaterialCache : public QObject | - | ||||||||||||||||||||||||
| 364 | { | - | ||||||||||||||||||||||||
| 365 | Q_OBJECT | - | ||||||||||||||||||||||||
| 366 | public: | - | ||||||||||||||||||||||||
| 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:
| 5427 | ||||||||||||||||||||||||
| 370 | if (!me && create) {
| 57-5354 | ||||||||||||||||||||||||
| 371 | me = new QQuickOpenGLShaderEffectMaterialCache(); | - | ||||||||||||||||||||||||
| 372 | me->setObjectName(QStringLiteral("__qt_ShaderEffectCache")); executed 57 times by 6 tests: return qstring_literal_temp;Executed by:
| 57 | ||||||||||||||||||||||||
| 373 | me->setParent(ctx); | - | ||||||||||||||||||||||||
| 374 | } executed 57 times by 6 tests: end of blockExecuted by:
| 57 | ||||||||||||||||||||||||
| 375 | return me; executed 5427 times by 89 tests: return me;Executed by:
| 5427 | ||||||||||||||||||||||||
| 376 | } | - | ||||||||||||||||||||||||
| 377 | QHash<QQuickOpenGLShaderEffectMaterialKey, QSGMaterialType *> cache; | - | ||||||||||||||||||||||||
| 378 | }; | - | ||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||
| 380 | QQuickOpenGLShaderEffectMaterial::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 blockExecuted by:
| 73 | ||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | QSGMaterialType *QQuickOpenGLShaderEffectMaterial::type() const | - | ||||||||||||||||||||||||
| 390 | { | - | ||||||||||||||||||||||||
| 391 | return m_type; executed 509 times by 6 tests: return m_type;Executed by:
| 509 | ||||||||||||||||||||||||
| 392 | } | - | ||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||
| 394 | QSGMaterialShader *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:
| 63 | ||||||||||||||||||||||||
| 397 | } | - | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | bool QQuickOpenGLShaderEffectMaterial::UniformData::operator == (const UniformData &other) const | - | ||||||||||||||||||||||||
| 400 | { | - | ||||||||||||||||||||||||
| 401 | if (specialType != other.specialType)
| 0 | ||||||||||||||||||||||||
| 402 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 403 | if (name != other.name)
| 0 | ||||||||||||||||||||||||
| 404 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | if (specialType == UniformData::Sampler || specialType == UniformData::SamplerExternal) {
| 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 | - | |||||||||||||||||||||||||
| 416 | int 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))
| 0 | ||||||||||||||||||||||||
| 420 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
| 421 | if (cullMode != other->cullMode)
| 0 | ||||||||||||||||||||||||
| 422 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
| 423 | for (int shaderType = 0; shaderType < QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount; ++shaderType) {
| 0 | ||||||||||||||||||||||||
| 424 | if (uniforms[shaderType] != other->uniforms[shaderType])
| 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())
| 0 | ||||||||||||||||||||||||
| 430 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
| 431 | for (int i=0; i<textureProviders.size(); ++i) {
| 0 | ||||||||||||||||||||||||
| 432 | QSGTextureProvider *tp1 = textureProviders.at(i); | - | ||||||||||||||||||||||||
| 433 | QSGTextureProvider *tp2 = other->textureProviders.at(i); | - | ||||||||||||||||||||||||
| 434 | if (!tp1 || !tp2)
| 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)
| 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())
| 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 | - | |||||||||||||||||||||||||
| 447 | void 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) {
| 2-71 | ||||||||||||||||||||||||
| 455 | m_type = new QSGMaterialType(); | - | ||||||||||||||||||||||||
| 456 | cache->cache.insert(source, m_type); | - | ||||||||||||||||||||||||
| 457 | } executed 71 times by 6 tests: end of blockExecuted by:
| 71 | ||||||||||||||||||||||||
| 458 | } executed 73 times by 6 tests: end of blockExecuted by:
| 73 | ||||||||||||||||||||||||
| 459 | - | |||||||||||||||||||||||||
| 460 | void QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache() | - | ||||||||||||||||||||||||
| 461 | { | - | ||||||||||||||||||||||||
| 462 | QQuickOpenGLShaderEffectMaterialCache *cache = QQuickOpenGLShaderEffectMaterialCache::get(false); | - | ||||||||||||||||||||||||
| 463 | if (cache) {
| 57-5297 | ||||||||||||||||||||||||
| 464 | qDeleteAll(cache->cache); | - | ||||||||||||||||||||||||
| 465 | delete cache; | - | ||||||||||||||||||||||||
| 466 | } executed 57 times by 6 tests: end of blockExecuted by:
| 57 | ||||||||||||||||||||||||
| 467 | } executed 5354 times by 89 tests: end of blockExecuted by:
| 5354 | ||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||
| 469 | void QQuickOpenGLShaderEffectMaterial::updateTextures() const | - | ||||||||||||||||||||||||
| 470 | { | - | ||||||||||||||||||||||||
| 471 | for (int i = 0; i < textureProviders.size(); ++i) {
| 438-451 | ||||||||||||||||||||||||
| 472 | if (QSGTextureProvider *provider = textureProviders.at(i)) {
| 133-305 | ||||||||||||||||||||||||
| 473 | if (QSGDynamicTexture *texture = qobject_cast<QSGDynamicTexture *>(provider->texture()))
| 6-299 | ||||||||||||||||||||||||
| 474 | texture->updateTexture(); executed 299 times by 3 tests: texture->updateTexture();Executed by:
| 299 | ||||||||||||||||||||||||
| 475 | } executed 305 times by 5 tests: end of blockExecuted by:
| 305 | ||||||||||||||||||||||||
| 476 | } executed 438 times by 5 tests: end of blockExecuted by:
| 438 | ||||||||||||||||||||||||
| 477 | } executed 451 times by 6 tests: end of blockExecuted by:
| 451 | ||||||||||||||||||||||||
| 478 | - | |||||||||||||||||||||||||
| 479 | void QQuickOpenGLShaderEffectMaterial::invalidateTextureProvider(QSGTextureProvider *provider) | - | ||||||||||||||||||||||||
| 480 | { | - | ||||||||||||||||||||||||
| 481 | for (int i = 0; i < textureProviders.size(); ++i) {
| 8-12 | ||||||||||||||||||||||||
| 482 | if (provider == textureProviders.at(i))
| 4-8 | ||||||||||||||||||||||||
| 483 | textureProviders[i] = 0; executed 8 times by 2 tests: textureProviders[i] = 0;Executed by:
| 8 | ||||||||||||||||||||||||
| 484 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||
| 485 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 486 | - | |||||||||||||||||||||||||
| 487 | - | |||||||||||||||||||||||||
| 488 | QQuickOpenGLShaderEffectNode::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 blockExecuted by:
| 73 | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | QQuickOpenGLShaderEffectNode::~QQuickOpenGLShaderEffectNode() | - | ||||||||||||||||||||||||
| 498 | { | - | ||||||||||||||||||||||||
| 499 | } | - | ||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||
| 501 | void QQuickOpenGLShaderEffectNode::markDirtyTexture() | - | ||||||||||||||||||||||||
| 502 | { | - | ||||||||||||||||||||||||
| 503 | markDirty(DirtyMaterial); | - | ||||||||||||||||||||||||
| 504 | Q_EMIT dirtyTexture(); | - | ||||||||||||||||||||||||
| 505 | } executed 266 times by 3 tests: end of blockExecuted by:
| 266 | ||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||
| 507 | void 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 blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||
| 513 | void QQuickOpenGLShaderEffectNode::preprocess() | - | ||||||||||||||||||||||||
| 514 | { | - | ||||||||||||||||||||||||
| 515 | Q_ASSERT(material()); | - | ||||||||||||||||||||||||
| 516 | static_cast<QQuickOpenGLShaderEffectMaterial *>(material())->updateTextures(); | - | ||||||||||||||||||||||||
| 517 | } executed 451 times by 6 tests: end of blockExecuted by:
| 451 | ||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||
| 519 | #include "qquickopenglshadereffectnode.moc" | - | ||||||||||||||||||||||||
| 520 | #include "moc_qquickopenglshadereffectnode_p.cpp" | - | ||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||
| 522 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |