From e357f015391ac32e8d262b4ea2bd0e3fe1e87fe6 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 20 Jun 2013 09:31:56 +0200 Subject: [PATCH] Revert "Cut performance cost in QSGContext::prepareMaterial()". 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 --- src/quick/scenegraph/coreapi/qsgmaterial.cpp | 1 - src/quick/scenegraph/coreapi/qsgmaterial.h | 1 - src/quick/scenegraph/qsgcontext.cpp | 9 +-------- 3 files changed, 1 insertions(+), 10 deletions(-) diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp index 9346236..c0794d0 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp @@ -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) { diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.h b/src/quick/scenegraph/coreapi/qsgmaterial.h index 20ab21a..ee8889d 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.h +++ b/src/quick/scenegraph/coreapi/qsgmaterial.h @@ -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) diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 866d678..a142a23 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -507,16 +507,10 @@ QSGDepthStencilBufferManager *QSGContext::depthStencilBufferManager() QSGMaterialShader *QSGContext::prepareMaterial(QSGMaterial *material) { Q_D(QSGContext); - - if (material->m_reserved) - return reinterpret_cast(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; -- 1.7.2.5