diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-01-23 12:36:29 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-01-23 12:36:29 +0100 |
commit | 03fe99ba3a7d29b1606660baa407cff21c4d4d35 (patch) | |
tree | 525d5f03e8703bf7e9a7851280de67a597dceea1 /src/quick/scenegraph | |
parent | f02e234fc012f4430378bc5205f32914822e4dff (diff) | |
parent | 94e6106d357ca5a1349a2b10a69dd84db34065c8 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Change-Id: I762e578aaf14a77efa26ce3fda2abb0e335003ea
Diffstat (limited to 'src/quick/scenegraph')
5 files changed, 39 insertions, 3 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp index df5ec9b745..8abbefdd48 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp @@ -618,6 +618,11 @@ void QSGSoftwareThreadedRenderLoop::windowDestroyed(QQuickWindow *window) break; } } + + // Now that we altered the window list, we may need to stop the animation + // timer even if we didn't via handleObscurity. This covers the case where + // we destroy a visible & exposed QQuickWindow. + startOrStopAnimationTimer(); } void QSGSoftwareThreadedRenderLoop::exposureChanged(QQuickWindow *window) diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index b8ed190b33..d4324bc489 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -898,6 +898,7 @@ void Renderer::map(Buffer *buffer, int byteSize, bool isIndexBuf) } else if (buffer->size != byteSize) { free(buffer->data); buffer->data = (char *) malloc(byteSize); + Q_CHECK_PTR(buffer->data); } buffer->size = byteSize; } @@ -2025,6 +2026,8 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip) } ClipType clipType = NoClip; + GLuint vbo = 0; + int vboSize = 0; glDisable(GL_SCISSOR_TEST); @@ -2109,7 +2112,21 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip) const QSGGeometry *g = clip->geometry(); Q_ASSERT(g->attributeCount() > 0); const QSGGeometry::Attribute *a = g->attributes(); - glVertexAttribPointer(0, a->tupleSize, a->type, GL_FALSE, g->sizeOfVertex(), g->vertexData()); + + if (!vbo) + glGenBuffers(1, &vbo); + + glBindBuffer(GL_ARRAY_BUFFER, vbo); + + const int vertexByteSize = g->sizeOfVertex() * g->vertexCount(); + if (vboSize < vertexByteSize) { + vboSize = vertexByteSize; + glBufferData(GL_ARRAY_BUFFER, vertexByteSize, g->vertexData(), GL_STATIC_DRAW); + } else { + glBufferSubData(GL_ARRAY_BUFFER, 0, vertexByteSize, g->vertexData()); + } + + glVertexAttribPointer(0, a->tupleSize, a->type, GL_FALSE, g->sizeOfVertex(), 0); m_clipProgram.setUniformValue(m_clipMatrixId, m); if (g->indexCount()) { @@ -2118,12 +2135,17 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip) glDrawArrays(g->drawingMode(), 0, g->vertexCount()); } + glBindBuffer(GL_ARRAY_BUFFER, 0); + ++m_currentStencilValue; } clip = clip->clipList(); } + if (vbo) + glDeleteBuffers(1, &vbo); + if (clipType & StencilClip) { m_clipProgram.disableAttributeArray(0); glStencilFunc(GL_EQUAL, m_currentStencilValue, 0xff); // stencil test, ref, test mask diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index a278c6079b..69a8c21ed2 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -675,6 +675,7 @@ void QSGGeometry::allocate(int vertexCount, int indexCount) Q_ASSERT(m_index_type == UnsignedIntType || m_index_type == UnsignedShortType); int indexByteSize = indexCount * (m_index_type == UnsignedShortType ? sizeof(quint16) : sizeof(quint32)); m_data = (void *) malloc(vertexByteSize + indexByteSize); + Q_CHECK_PTR(m_data); m_index_data_offset = vertexByteSize; m_owns_data = true; } diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h index bf267ccf92..03a1f7f281 100644 --- a/src/quick/scenegraph/qsgadaptationlayer_p.h +++ b/src/quick/scenegraph/qsgadaptationlayer_p.h @@ -87,6 +87,8 @@ class QSGRenderNode; class Q_QUICK_PRIVATE_EXPORT QSGNodeVisitorEx { public: + virtual ~QSGNodeVisitorEx() {} + // visit(...) returns true if the children are supposed to be // visisted and false if they're supposed to be skipped by the visitor. diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 4543782d5b..5fa74027c1 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -280,7 +280,7 @@ public: , stopEventProcessing(false) { sgrc = static_cast<QSGDefaultRenderContext *>(renderContext); -#if defined(Q_OS_QNX) && !defined(Q_OS_BLACKBERRY) && defined(Q_PROCESSOR_X86) +#if defined(Q_OS_QNX) && defined(Q_PROCESSOR_X86) // The SDP 6.6.0 x86 MESA driver requires a larger stack than the default. setStackSize(1024 * 1024); #endif @@ -826,13 +826,14 @@ void QSGThreadedRenderLoop::startOrStopAnimationTimer() } if (m_animation_timer != 0 && (exposedWindows == 1 || !m_animation_driver->isRunning())) { + qCDebug(QSG_LOG_RENDERLOOP) << "*** Stopping animation timer"; killTimer(m_animation_timer); m_animation_timer = 0; // If animations are running, make sure we keep on animating if (m_animation_driver->isRunning()) maybePostPolishRequest(const_cast<Window *>(theOne)); - } else if (m_animation_timer == 0 && exposedWindows != 1 && m_animation_driver->isRunning()) { + qCDebug(QSG_LOG_RENDERLOOP) << "*** Starting animation timer"; m_animation_timer = startTimer(qsgrl_animation_interval()); } } @@ -888,6 +889,11 @@ void QSGThreadedRenderLoop::windowDestroyed(QQuickWindow *window) } } + // Now that we altered the window list, we may need to stop the animation + // timer even if we didn't via handleObscurity. This covers the case where + // we destroy a visible & exposed QQuickWindow. + startOrStopAnimationTimer(); + qCDebug(QSG_LOG_RENDERLOOP) << "done windowDestroyed()" << window; } |