diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-06-12 09:53:17 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-06-15 07:00:52 +0000 |
commit | a54621c231317c5777dea402215c30764ae96a2e (patch) | |
tree | a8ca199ed5c88172d474aaef716eb63994742b1c /src/quick/scenegraph/coreapi | |
parent | beea6c18f0b6050e4d2633fba462f2b9b67ab134 (diff) |
Get rid of preprocess in QQuickText
Preprocessing in the scene graph is actually pretty expensive,
so we want to avoid using it for something like text, where you
can often have a lot of nodes in a UI.
For text it was previously used for two purposes:
1. To make sure the distance field glyph cache was updated with
potential new glyphs before the frame was rendered, but *after*
all new glyph nodes had been created (this is an optimization to
avoid having to resize the cache multiple times in one frame,
but rather wait until we know the exact amount of new glyphs
that need to be added)
2. Update the coordinates of the glyph based on their position
in the glyph cache if the glyph cache says they have moved (or
if they have just been added for the first time).
Point #1 can actually be handled a lot simpler, by having a
separate loop for the existing glyph caches where we ask them
to preprocess. There is typically only a few glyph caches, but
can be hundreds of glyph nodes in a scene, so in the previous
code we would be calling the update() functions on the same
glyph cache over and over again every frame.
Point #2 does not need preprocessing every frame, but can be
reduced to only preprocess when the geometry is marked as
dirty. We then do a pass on the glyph node in question to
update its geometry and turn the flag off again so that we
don't pay the cost every frame.
Fixes: QTBUG-84351
Change-Id: If8c492acaef9c512c2db61b64bcab2103db2d997
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 1f3dd3f5db16892739963168c2a76df6354b178c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quick/scenegraph/coreapi')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgrenderer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp index 90090e1cc0..381fd7eb69 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp @@ -323,6 +323,8 @@ void QSGRenderer::preprocess() // For the default case, when this does not happen, the cost is negligible. QSet<QSGNode *> items = m_nodes_to_preprocess; + m_context->preprocess(); + for (QSet<QSGNode *>::const_iterator it = items.constBegin(); it != items.constEnd(); ++it) { QSGNode *n = *it; |