diff options
Diffstat (limited to 'src/quick/items/qquickshadereffectnode_p.h')
-rw-r--r-- | src/quick/items/qquickshadereffectnode_p.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/quick/items/qquickshadereffectnode_p.h b/src/quick/items/qquickshadereffectnode_p.h index 420ca1237b..76aecd1b04 100644 --- a/src/quick/items/qquickshadereffectnode_p.h +++ b/src/quick/items/qquickshadereffectnode_p.h @@ -73,7 +73,6 @@ struct QQuickShaderEffectMaterialKey { uint qHash(const QQuickShaderEffectMaterialKey &key); - class QQuickCustomMaterialShader; class QQuickShaderEffectNode; class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffectMaterial : public QSGMaterial @@ -117,13 +116,12 @@ public: protected: friend class QQuickCustomMaterialShader; - // The type pointer needs to be unique. It is not safe to let the type object be part of the - // QQuickShaderEffectMaterial, since it can be deleted and a new one constructed on top of the old - // one. The new QQuickShaderEffectMaterial would then get the same type pointer as the old one, and - // CustomMaterialShaders based on the old one would incorrectly be used together with the new - // one. To guarantee that the type pointer is unique, the type object must live as long as - // there are any CustomMaterialShaders of that type. - QSharedPointer<QSGMaterialType> m_type; + // Each material needs a unique type to ensure that the renderer has a one + // and exactly one GL program for every unique set of shader sources. + // setProgramSource() stores the sources in a cache along with the right + // type. The type is cleaned up in cleanupMaterialCache() which is called + // when the GL context is shut down. + QSGMaterialType *m_type; QQuickShaderEffectMaterialKey m_source; QQuickShaderEffectNode *m_node; |