Revert "Cut performance cost in QSGContext::prepareMaterial()".
authorGunnar Sletta <gunnar.sletta@digia.com>
Thu, 20 Jun 2013 07:31:56 +0000 (09:31 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 20 Jun 2013 19:31:47 +0000 (21:31 +0200)
This reverts commit 0e9cd8b4098661bf611fa73a787c58c85e7d7338.

This optimization breaks ShaderEffects with changing fragment
and vertex shaders and needs some more thought.

Task-number: QTBUG-31837
Change-Id: I1abe249c65dd785825c249a7c22baee928bd76c8
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
src/quick/scenegraph/coreapi/qsgmaterial.cpp
src/quick/scenegraph/coreapi/qsgmaterial.h
src/quick/scenegraph/qsgcontext.cpp

index 9346236..c0794d0 100644 (file)
@@ -556,7 +556,6 @@ static void qt_print_material_count()
 
 QSGMaterial::QSGMaterial()
     : m_flags(0)
-    , m_reserved(0)
 {
 #ifndef QT_NO_DEBUG
     if (qsg_leak_check) {
index 20ab21a..ee8889d 100644 (file)
@@ -133,7 +133,6 @@ public:
     void setFlag(Flags flags, bool on = true);
 
 private:
-    friend class QSGContext;
     Flags m_flags;
     void *m_reserved;
     Q_DISABLE_COPY(QSGMaterial)
index 866d678..a142a23 100644 (file)
@@ -507,16 +507,10 @@ QSGDepthStencilBufferManager *QSGContext::depthStencilBufferManager()
 QSGMaterialShader *QSGContext::prepareMaterial(QSGMaterial *material)
 {
     Q_D(QSGContext);
-
-    if (material->m_reserved)
-        return reinterpret_cast<QSGMaterialShader *>(material->m_reserved);
-
     QSGMaterialType *type = material->type();
     QSGMaterialShader *shader = d->materials.value(type);
-    if (shader) {
-        material->m_reserved = shader;
+    if (shader)
         return shader;
-    }
 
 #ifndef QSG_NO_RENDER_TIMING
     if (qsg_render_timing  || QQmlProfilerService::enabled)
@@ -524,7 +518,6 @@ QSGMaterialShader *QSGContext::prepareMaterial(QSGMaterial *material)
 #endif
 
     shader = material->createShader();
-    material->m_reserved = shader;
     shader->compile();
     shader->initialize();
     d->materials[type] = shader;