diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-09-30 13:18:10 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-03 16:18:44 +0200 |
commit | c20ce89e6e92c403e9b50462a0e000056a2eff73 (patch) | |
tree | 45ca13d91ecb65f130d54cd45c9e2df98d0fa5ad /src/quick/scenegraph | |
parent | 4c09e1e0560e7a12ed80ec0603401d3441fd54e1 (diff) |
Remove QSGContext's precompilation step.
Materials are managed solely inside the renderer now, so these
are just wasting time.
Task-number: QTBUG-33456
Change-Id: Ie320df20b7971633c257b1bd3a218e7d70e52c3d
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 74 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 3 |
2 files changed, 0 insertions, 77 deletions
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index f1c13a9a5a..caa0d032a4 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -49,7 +49,6 @@ #include <QtQuick/private/qsgdistancefieldglyphnode_p.h> #include <QtQuick/private/qsgdistancefieldglyphnode_p_p.h> #include <QtQuick/private/qsgshareddistancefieldglyphcache_p.h> -#include <QtQuick/QSGFlatColorMaterial> #include <QtQuick/private/qsgatlastexture_p.h> #include <QtQuick/private/qsgtexture_p.h> @@ -78,11 +77,6 @@ DEFINE_BOOL_CONFIG_OPTION(qmlTranslucentMode, QML_TRANSLUCENT_MODE) DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD) -#ifndef QSG_NO_RENDER_TIMING -static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty(); -static QElapsedTimer qsg_renderer_timer; -#endif - /* Comments about this class from Gunnar: @@ -129,7 +123,6 @@ public: QOpenGLContext *gl; - QHash<QSGMaterialType *, QSGMaterialShader *> materials; QMutex textureMutex; QHash<QQuickTextureFactory *, QSGTexture *> textures; QSGDepthStencilBufferManager *depthStencilBufferManager; @@ -207,8 +200,6 @@ void QSGContext::invalidate() qDeleteAll(d->textures.values()); d->textures.clear(); d->textureMutex.unlock(); - qDeleteAll(d->materials.values()); - d->materials.clear(); delete d->depthStencilBufferManager; d->depthStencilBufferManager = 0; delete d->distanceFieldCacheManager; @@ -319,36 +310,9 @@ void QSGContext::initialize(QOpenGLContext *context) Q_ASSERT(!d->gl); d->gl = context; - precompileMaterials(); - emit initialized(); } -#define QSG_PRECOMPILE_MATERIAL(name) { name m; prepareMaterial(&m); } - -/* - * Some glsl compilers take their time compiling materials, and - * the way the scene graph is being processed, these materials - * get compiled when they are first taken into use. This can - * easily lead to skipped frames. By precompiling the most - * common materials, we potentially add a few milliseconds to the - * start up, and reduce the chance of avoiding skipped frames - * later on. - */ -void QSGContext::precompileMaterials() -{ - if (qEnvironmentVariableIsEmpty("QSG_NO_MATERIAL_PRELOADING")) { - QSG_PRECOMPILE_MATERIAL(QSGVertexColorMaterial); - QSG_PRECOMPILE_MATERIAL(QSGFlatColorMaterial); - QSG_PRECOMPILE_MATERIAL(QSGOpaqueTextureMaterial); - QSG_PRECOMPILE_MATERIAL(QSGTextureMaterial); - QSG_PRECOMPILE_MATERIAL(QSGSmoothTextureMaterial); - QSG_PRECOMPILE_MATERIAL(QSGSmoothColorMaterial); - QSG_PRECOMPILE_MATERIAL(QSGDistanceFieldTextMaterial); - } -} - - /*! Returns if the scene graph context is ready or not, meaning that it has a valid GL context. @@ -568,44 +532,6 @@ QSGDepthStencilBufferManager *QSGContext::depthStencilBufferManager() /*! - Returns a material shader for the given material. - */ - -QSGMaterialShader *QSGContext::prepareMaterial(QSGMaterial *material) -{ - Q_D(QSGContext); - QSGMaterialType *type = material->type(); - QSGMaterialShader *shader = d->materials.value(type); - if (shader) - return shader; - -#ifndef QSG_NO_RENDER_TIMING - if (qsg_render_timing || QQmlProfilerService::enabled) - qsg_renderer_timer.start(); -#endif - - shader = material->createShader(); - shader->compile(); - shader->initialize(); - d->materials[type] = shader; - -#ifndef QSG_NO_RENDER_TIMING - if (qsg_render_timing) - printf(" - compiling material: %dms\n", (int) qsg_renderer_timer.elapsed()); - - if (QQmlProfilerService::enabled) { - QQmlProfilerService::sceneGraphFrame( - QQmlProfilerService::SceneGraphContextFrame, - qsg_renderer_timer.nsecsElapsed()); - } -#endif - - return shader; -} - - - -/*! Sets whether the scene graph should render with flashing update rectangles or not */ diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 7727f0774e..2057c0031d 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -90,9 +90,6 @@ public: bool isReady() const; - virtual void precompileMaterials(); - QSGMaterialShader *prepareMaterial(QSGMaterial *material); - virtual void renderNextFrame(QSGRenderer *renderer, GLuint fboId); virtual QSGDistanceFieldGlyphCache *distanceFieldGlyphCache(const QRawFont &font); |