diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-20 01:00:59 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-20 01:00:59 +0100 |
commit | 1eef06e64fe91dc1f2148477fb932b293fba0312 (patch) | |
tree | 38a9a2de87bec5e6a45c090ea086f978421bb554 /src/quick/scenegraph | |
parent | 4b0034a01c360ac8b17c9503dba010c56a307c63 (diff) | |
parent | f726d237277de0f4c8f276d20a5bb1b6a8cd007c (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I6f320ea43b5837444226228c118e57c4bda8702a
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgtexture.cpp | 8 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 3 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultrendercontext.cpp | 9 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultrendercontext_p.h | 2 |
5 files changed, 17 insertions, 7 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgtexture.cpp b/src/quick/scenegraph/coreapi/qsgtexture.cpp index 486fe50190..df6f5cffe6 100644 --- a/src/quick/scenegraph/coreapi/qsgtexture.cpp +++ b/src/quick/scenegraph/coreapi/qsgtexture.cpp @@ -842,11 +842,15 @@ void QSGTexturePrivate::updateRhiTexture(QRhi *rhi, QRhiResourceUpdateBatch *res /*! \fn bool QSGDynamicTexture::updateTexture() - Call this function to explicitly update the dynamic texture. Calling bind() will bind - the content that was previously updated. + Call this function to explicitly update the dynamic texture. The function returns true if the texture was changed as a resul of the update; otherwise returns false. + + \note This function is typically called from QQuickItem::updatePaintNode() + or QSGNode::preprocess(), meaning during the \c{synchronization} or the + \c{node preprocessing} phases of the scenegraph. Calling it at other times + is discouraged and can lead to unexpected behavior. */ /*! diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 17eb1e312c..e3c951e5ed 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -341,9 +341,10 @@ void QSGRenderContext::invalidate() { } -void QSGRenderContext::prepareSync(qreal devicePixelRatio) +void QSGRenderContext::prepareSync(qreal devicePixelRatio, QRhiCommandBuffer *cb) { Q_UNUSED(devicePixelRatio); + Q_UNUSED(cb); } void QSGRenderContext::beginNextFrame(QSGRenderer *renderer, diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 244bcfabd1..d389420907 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -174,7 +174,7 @@ public: using RenderPassCallback = void (*)(void *); - virtual void prepareSync(qreal devicePixelRatio); + virtual void prepareSync(qreal devicePixelRatio, QRhiCommandBuffer *cb); virtual void beginNextFrame(QSGRenderer *renderer, RenderPassCallback mainPassRecordingStart, RenderPassCallback mainPassRecordingEnd, diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp index ae227a0106..14314b2c94 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp +++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp @@ -200,9 +200,14 @@ void QSGDefaultRenderContext::invalidate() emit invalidated(); } -void QSGDefaultRenderContext::prepareSync(qreal devicePixelRatio) +void QSGDefaultRenderContext::prepareSync(qreal devicePixelRatio, QRhiCommandBuffer *cb) { m_currentDevicePixelRatio = devicePixelRatio; + + // we store the command buffer already here, in case there is something in + // an updatePaintNode() implementation that leads to needing it (for + // example, an updateTexture() call on a QSGRhiLayer) + m_currentFrameCommandBuffer = cb; } static QBasicMutex qsg_framerender_mutex; @@ -244,7 +249,7 @@ void QSGDefaultRenderContext::beginNextRhiFrame(QSGRenderer *renderer, QRhiRende renderer->setCommandBuffer(cb); renderer->setRenderPassRecordingCallbacks(mainPassRecordingStart, mainPassRecordingEnd, callbackUserData); - m_currentFrameCommandBuffer = cb; + m_currentFrameCommandBuffer = cb; // usually the same as what was passed to prepareSync() but cannot count on that having been called m_currentFrameRenderPass = rp; } diff --git a/src/quick/scenegraph/qsgdefaultrendercontext_p.h b/src/quick/scenegraph/qsgdefaultrendercontext_p.h index 2fdb3a48dd..97ed681f9a 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext_p.h +++ b/src/quick/scenegraph/qsgdefaultrendercontext_p.h @@ -104,7 +104,7 @@ public: void initialize(const QSGRenderContext::InitParams *params) override; void invalidate() override; - void prepareSync(qreal devicePixelRatio) override; + void prepareSync(qreal devicePixelRatio, QRhiCommandBuffer *cb) override; void beginNextFrame(QSGRenderer *renderer, RenderPassCallback mainPassRecordingStart, RenderPassCallback mainPassRecordingEnd, |