From c2c4338185722e02cb55a886c14c04295713609a Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Mon, 18 Nov 2019 13:01:22 +0200 Subject: Add changes file for Qt 5.14.0 Change-Id: I0ef3dd0006783337917677cf0b5f980ec0215081 Reviewed-by: Paul Lemire --- dist/changes-5.14.0 | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 dist/changes-5.14.0 diff --git a/dist/changes-5.14.0 b/dist/changes-5.14.0 new file mode 100644 index 000000000..442296db8 --- /dev/null +++ b/dist/changes-5.14.0 @@ -0,0 +1,49 @@ +Qt 5.14 introduces many new features and improvements as well as bugfixes +over the 5.13.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.14 series is binary compatible with the 5.13.x series. +Applications compiled for 5.13 will continue to run with 5.14. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Qt3DExtras * +**************************************************************************** + + - QDistanceFieldGlyphCache: + * make sure the change arbiter of atlas for QText2DEntity can be set + when traversing node tree, and add new auto test for this. + +**************************************************************************** +* Qt3DRender * +**************************************************************************** + + - QNoPicking: control picking execution in the FrameGraph + - Textures: internal data sharing removed + - QSortPolicy can now sort by Texture + - QPickEvent adds property for picked entity + + - QImageTextureDataFunctor: + * return a invalid image data when url is invalid to ensure the property + of GLTexture will not be set to NoFormat + +**************************************************************************** +* UNSPECIFIED * +**************************************************************************** + + - Add basic support for KTX container format. + - Add worldMatrix property on QTransform + - Added SubtreeEnabler to allow easing enabling + and disabling of frame graph subtrees. + - [QTBUG-74977] Scene3D add compositingMode property. Allows underlay + rendering. + - Introduce Scene3DView to render multiple distinct 3D scenes -- cgit v1.2.3 From 96b1b9e3e198e751bb96eeb279106862ca38e7d7 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Wed, 4 Dec 2019 08:14:29 +0100 Subject: Fix OnDemand rendering with Scene3D When using OnDemand rendering, Scene3D would lock if nothing in the scene were to change. By being blocked, it would also not process jobs for other aspects (input, logics). That would prevent things like a CameraController from running, which in turn would make it impossible to move the camera and trigger a change in the scene to request rendering. Additionally, Scene3D would ignore whether the Qt3D renderer actually needed rendering or not as it was watching on its own the changeArbiter for changes to decide whether rendering was required or not. This would ignore the case where Qt3D needs multiple frames to render a correct frame (e.g loading buffers, shaders at frame n, rebuilding commands at frame n+1) Scene3D now asks the Qt3D renderer by calling the shouldRender() function to decide whether rendering is needed or not, in addition to watching the changeArbiter. Regardless of whether rendering is needed, it now let each aspect process jobs. This ensures things like FrameAction/Input are processed. Then, Scene3D decides whether full rendering is required or whether it only has to be called to allow the Qt3D simulation loop to proceed for the next frame. If the latter, it does it so as not to have QtQuick trigger a redraw. Change-Id: I870f773c224286d6b7ec0f6045319e51e09cbf8e Task-number: QTBUG-80521 Reviewed-by: Mike Krus --- src/quick3d/imports/scene3d/scene3ditem.cpp | 23 +++++++++++++++++------ src/quick3d/imports/scene3d/scene3drenderer.cpp | 19 +++++++++++++++++++ src/quick3d/imports/scene3d/scene3drenderer_p.h | 3 ++- src/render/backend/abstractrenderer_p.h | 2 +- src/render/renderers/opengl/renderer/renderer.cpp | 3 +-- src/render/renderers/opengl/renderer/renderer_p.h | 2 +- tests/auto/render/commons/testrenderer.h | 2 +- 7 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp index 5a1cec495..f0ebfbc38 100644 --- a/src/quick3d/imports/scene3d/scene3ditem.cpp +++ b/src/quick3d/imports/scene3d/scene3ditem.cpp @@ -433,12 +433,26 @@ void Scene3DItem::applyRootEntityChange() bool Scene3DItem::needsRender() { + // We need the dirty flag which is connected to the change arbiter + // receiving updates to know whether something in the scene has changed + + // Ideally we would use shouldRender() alone but given that it becomes true + // only after the arbiter has sync the changes and might be reset before + // process jobs is completed, we cannot fully rely on it. It would require + // splitting processFrame in 2 parts. + + // We only use it for cases where Qt3D render may require several loops of + // the simulation to fully process a frame (e.g shaders are loaded in frame + // n and we can only build render commands for the new shader at frame n + + // This is where renderer->shouldRender() comes into play as it knows + // whether some states remain dirty or not (even after processFrame is + // called) + auto renderAspectPriv = static_cast(QRenderAspectPrivate::get(m_renderAspect)); const bool dirty = m_dirty || (renderAspectPriv && renderAspectPriv->m_renderer - && renderAspectPriv->m_renderer->settings() - && renderAspectPriv->m_renderer->settings()->renderPolicy() == QRenderSettings::Always); + && renderAspectPriv->m_renderer->shouldRender()); m_dirty = false; return dirty; } @@ -466,10 +480,6 @@ void Scene3DItem::onBeforeSync() if (!isVisible()) return; - // Has anything in the 3D scene actually changed that requires us to render? - if (!needsRender()) - return; - Q_ASSERT(QThread::currentThread() == thread()); // Since we are in manual mode, trigger jobs for the next frame @@ -510,6 +520,7 @@ void Scene3DItem::onBeforeSync() // start rendering before this function has been called // We add in a safety to skip such frames as this could otherwise // make Qt3D enter a locked state + m_renderer->setSkipFrame(!needsRender()); m_renderer->allowRender(); // Note: it's too early to request an update at this point as diff --git a/src/quick3d/imports/scene3d/scene3drenderer.cpp b/src/quick3d/imports/scene3d/scene3drenderer.cpp index 1e322a615..fafeeedf4 100644 --- a/src/quick3d/imports/scene3d/scene3drenderer.cpp +++ b/src/quick3d/imports/scene3d/scene3drenderer.cpp @@ -161,6 +161,7 @@ Scene3DRenderer::Scene3DRenderer(Scene3DItem *item, Qt3DCore::QAspectEngine *asp , m_forceRecreate(false) , m_shouldRender(false) , m_dirtyViews(false) + , m_skipFrame(false) , m_allowRendering(0) , m_compositingMode(Scene3DItem::FBO) { @@ -278,6 +279,19 @@ void Scene3DRenderer::beforeSynchronize() // We could otherwise enter a deadlock state if (!m_allowRendering.tryAcquire(std::max(m_allowRendering.available(), 1))) return; + + // In the case of OnDemand rendering, we still need to get to this + // point to ensure we have processed jobs for all aspects. + // We also still need to call render() to allow proceeding with the + // next frame. However it won't be performing any 3d rendering at all + // so we do it here and return early. This prevents a costly QtQuick + // SceneGraph update for nothing + if (m_skipFrame) { + m_skipFrame = false; + static_cast(QRenderAspectPrivate::get(m_renderAspect))->renderSynchronous(false); + return; + } + m_shouldRender = true; // Check size / multisampling @@ -360,6 +374,11 @@ void Scene3DRenderer::setCompositingMode(Scene3DItem::CompositingMode mode) m_compositingMode = mode; } +void Scene3DRenderer::setSkipFrame(bool skip) +{ + m_skipFrame = skip; +} + // Main Thread, Render Thread locked void Scene3DRenderer::setScene3DViews(const QVector views) { diff --git a/src/quick3d/imports/scene3d/scene3drenderer_p.h b/src/quick3d/imports/scene3d/scene3drenderer_p.h index 4f3651cd3..08a2c60a3 100644 --- a/src/quick3d/imports/scene3d/scene3drenderer_p.h +++ b/src/quick3d/imports/scene3d/scene3drenderer_p.h @@ -87,7 +87,7 @@ public: void setCleanerHelper(Scene3DCleaner *cleaner); void allowRender(); void setCompositingMode(Scene3DItem::CompositingMode mode); - + void setSkipFrame(bool skip); void setScene3DViews(const QVector views); public Q_SLOTS: @@ -119,6 +119,7 @@ private: bool m_forceRecreate; bool m_shouldRender; bool m_dirtyViews; + bool m_skipFrame; QSemaphore m_allowRendering; Scene3DItem::CompositingMode m_compositingMode; QVector m_views; diff --git a/src/render/backend/abstractrenderer_p.h b/src/render/backend/abstractrenderer_p.h index b618eda55..c8dd537c7 100644 --- a/src/render/backend/abstractrenderer_p.h +++ b/src/render/backend/abstractrenderer_p.h @@ -151,7 +151,7 @@ public: #if defined(QT_BUILD_INTERNAL) virtual void clearDirtyBits(BackendNodeDirtySet changes) = 0; #endif - virtual bool shouldRender() = 0; + virtual bool shouldRender() const = 0; virtual void skipNextFrame() = 0; virtual QVector preRenderingJobs() = 0; diff --git a/src/render/renderers/opengl/renderer/renderer.cpp b/src/render/renderers/opengl/renderer/renderer.cpp index a530c26b0..bf9230079 100644 --- a/src/render/renderers/opengl/renderer/renderer.cpp +++ b/src/render/renderers/opengl/renderer/renderer.cpp @@ -1821,12 +1821,11 @@ void Renderer::clearDirtyBits(BackendNodeDirtySet changes) } #endif -bool Renderer::shouldRender() +bool Renderer::shouldRender() const { // Only render if something changed during the last frame, or the last frame // was not rendered successfully (or render-on-demand is disabled) return (m_settings->renderPolicy() == QRenderSettings::Always - || m_renderThread == nullptr // <==> we use Scene3D || m_dirtyBits.marked != 0 || m_dirtyBits.remaining != 0 || !m_lastFrameCorrect.loadRelaxed()); diff --git a/src/render/renderers/opengl/renderer/renderer_p.h b/src/render/renderers/opengl/renderer/renderer_p.h index b2889bb0e..ee01754d3 100644 --- a/src/render/renderers/opengl/renderer/renderer_p.h +++ b/src/render/renderers/opengl/renderer/renderer_p.h @@ -207,7 +207,7 @@ public: #if defined(QT_BUILD_INTERNAL) void clearDirtyBits(BackendNodeDirtySet changes) override; #endif - bool shouldRender() override; + bool shouldRender() const override; void skipNextFrame() override; QVector preRenderingJobs() override; diff --git a/tests/auto/render/commons/testrenderer.h b/tests/auto/render/commons/testrenderer.h index 8d27998a0..e1ee329f4 100644 --- a/tests/auto/render/commons/testrenderer.h +++ b/tests/auto/render/commons/testrenderer.h @@ -55,7 +55,7 @@ public: void doRender(bool swapBuffers) override { Q_UNUSED(swapBuffers); } void cleanGraphicsResources() override {} bool isRunning() const override { return true; } - bool shouldRender() override { return true; } + bool shouldRender() const override { return true; } void skipNextFrame() override {} QVector preRenderingJobs() override { return QVector(); } QVector renderBinJobs() override { return QVector(); } -- cgit v1.2.3 From 69789d0184ffa54c1760ad5204bb4539c9399753 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Sat, 7 Dec 2019 13:03:58 +0000 Subject: Fix picking with primitive restart Task-number: QTBUG-71919 Change-Id: If7923fab6c43f5d7139d1bbdceb73c17bf489099 Reviewed-by: Paul Lemire --- src/render/backend/bufferutils_p.h | 4 ++++ src/render/backend/segmentsvisitor.cpp | 7 +++++- src/render/backend/trianglesvisitor.cpp | 11 ++++++++- src/render/backend/visitorutils_p.h | 2 ++ .../render/trianglevisitor/tst_trianglevisitor.cpp | 26 +++++++++++++++++----- 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/render/backend/bufferutils_p.h b/src/render/backend/bufferutils_p.h index 2bb35fac6..ea783df0d 100644 --- a/src/render/backend/bufferutils_p.h +++ b/src/render/backend/bufferutils_p.h @@ -74,6 +74,8 @@ struct BufferInfo , count(0) , byteStride(0) , byteOffset(0) + , restartEnabled(false) + , restartIndexValue(-1) {} QByteArray data; @@ -82,6 +84,8 @@ struct BufferInfo uint count; uint byteStride; uint byteOffset; + bool restartEnabled; + int restartIndexValue; }; diff --git a/src/render/backend/segmentsvisitor.cpp b/src/render/backend/segmentsvisitor.cpp index a3a5d059c..68deafb15 100644 --- a/src/render/backend/segmentsvisitor.cpp +++ b/src/render/backend/segmentsvisitor.cpp @@ -140,13 +140,18 @@ void traverseSegmentStripIndexed(Index *indices, uint ndx[2]; Vector3D abc[2]; - ndx[0] = indices[0]; + + startLinePrimitive:ndx[0] = indices[i]; uint idx = ndx[0] * verticesStride; for (uint j = 0; j < maxVerticesDataSize; ++j) abc[0][j] = vertices[idx + j]; while (i < indexInfo.count - 1) { ndx[1] = indices[i + 1]; if (ndx[0] != ndx[1]) { + if (indexInfo.restartEnabled && indexInfo.restartIndexValue == static_cast(ndx[1])) { + i += 2; + goto startLinePrimitive; + } idx = ndx[1] * verticesStride; for (uint j = 0; j < maxVerticesDataSize; ++j) abc[1][j] = vertices[idx + j]; diff --git a/src/render/backend/trianglesvisitor.cpp b/src/render/backend/trianglesvisitor.cpp index 87ba7bde9..a58f2d20b 100644 --- a/src/render/backend/trianglesvisitor.cpp +++ b/src/render/backend/trianglesvisitor.cpp @@ -153,6 +153,10 @@ void traverseTriangleStripIndexed(index *indices, uint ndx[3]; Vector3D abc[3]; while (i < indexInfo.count - 2) { + if (indexInfo.restartEnabled && indexInfo.restartIndexValue == static_cast(indices[i + 2])) { + i += 3; + continue; + } bool degenerate = false; for (uint u = 0; u < 3; ++u) { ndx[u] = indices[i + u]; @@ -216,6 +220,11 @@ void traverseTriangleFanIndexed(index *indices, ndx[0] = indices[0]; uint i = 1; while (i < indexInfo.count - 1) { + if (indexInfo.restartEnabled && indexInfo.restartIndexValue == static_cast(indices[i + 1])) { + ndx[0] = indices[i + 2]; + i += 3; + continue; + } for (uint u = 0; u < 2; ++u) { ndx[u + 1] = indices[i + u]; uint idx = ndx[u + 1] * verticesStride; @@ -224,7 +233,7 @@ void traverseTriangleFanIndexed(index *indices, } } visitor->visit(ndx[2], abc[2], ndx[1], abc[1], ndx[0], abc[0]); - i += 1; + ++i; } } diff --git a/src/render/backend/visitorutils_p.h b/src/render/backend/visitorutils_p.h index 6a5c7b4ff..14183e11b 100644 --- a/src/render/backend/visitorutils_p.h +++ b/src/render/backend/visitorutils_p.h @@ -149,6 +149,8 @@ void visitPrimitives(NodeManagers *manager, const GeometryRenderer *renderer, Vi indexBufferInfo.byteOffset = indexAttribute->byteOffset(); indexBufferInfo.byteStride = indexAttribute->byteStride(); indexBufferInfo.count = indexAttribute->count(); + indexBufferInfo.restartEnabled = renderer->primitiveRestartEnabled(); + indexBufferInfo.restartIndexValue = renderer->restartIndexValue(); IndexExecutor executor; executor.m_vertexBufferInfo = vertexBufferInfo; diff --git a/tests/auto/render/trianglevisitor/tst_trianglevisitor.cpp b/tests/auto/render/trianglevisitor/tst_trianglevisitor.cpp index 8dfda0eea..66f67e08a 100644 --- a/tests/auto/render/trianglevisitor/tst_trianglevisitor.cpp +++ b/tests/auto/render/trianglevisitor/tst_trianglevisitor.cpp @@ -454,7 +454,7 @@ private Q_SLOTS: simulateInitializationSync(dataBuffer.data(), backendBuffer); QByteArray indexData; - indexData.resize(sizeof(uint) * 3 * 4); + indexData.resize(sizeof(uint) * 4 * 4); uint *iDataPtr = reinterpret_cast(indexData.data()); iDataPtr[0] = 0; iDataPtr[1] = 1; @@ -468,6 +468,10 @@ private Q_SLOTS: iDataPtr[9] = 4; iDataPtr[10] = 3; iDataPtr[11] = 2; + iDataPtr[12] = static_cast(-1); + iDataPtr[13] = 0; + iDataPtr[14] = 1; + iDataPtr[15] = 2; indexDataBuffer->setData(indexData); Buffer *backendIndexBuffer = nodeManagers->bufferManager()->getOrCreateResource(indexDataBuffer->id()); @@ -486,7 +490,7 @@ private Q_SLOTS: indexAttribute->setBuffer(indexDataBuffer.data()); indexAttribute->setVertexBaseType(Qt3DRender::QAttribute::UnsignedInt); - indexAttribute->setCount(3*4); + indexAttribute->setCount(4*4); indexAttribute->setAttributeType(Qt3DRender::QAttribute::IndexAttribute); geometry->addAttribute(positionAttribute.data()); @@ -494,6 +498,8 @@ private Q_SLOTS: geometryRenderer->setGeometry(geometry); geometryRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::TriangleStrip); + geometryRenderer->setPrimitiveRestartEnabled(true); + geometryRenderer->setRestartIndexValue(-1); Attribute *backendAttribute = nodeManagers->attributeManager()->getOrCreateResource(positionAttribute->id()); backendAttribute->setRenderer(&renderer); @@ -516,7 +522,7 @@ private Q_SLOTS: visitor.apply(backendRenderer, Qt3DCore::QNodeId()); // THEN - QVERIFY(visitor.triangleCount() == 8); + QCOMPARE(visitor.triangleCount(), 9U); QVERIFY(visitor.verifyTriangle(0, 2,1,0, Vector3D(0,1,0), Vector3D(1,0,0), Vector3D(0,0,1))); QVERIFY(visitor.verifyTriangle(1, 3,2,1, Vector3D(0,0,1), Vector3D(0,1,0), Vector3D(1,0,0))); QVERIFY(visitor.verifyTriangle(2, 4,3,2, Vector3D(1,0,0), Vector3D(0,0,1), Vector3D(0,1,0))); @@ -525,6 +531,7 @@ private Q_SLOTS: QVERIFY(visitor.verifyTriangle(5, 4,0,1, Vector3D(1,0,0), Vector3D(0,0,1), Vector3D(1,0,0))); QVERIFY(visitor.verifyTriangle(6, 3,4,0, Vector3D(0,0,1), Vector3D(1,0,0), Vector3D(0,0,1))); QVERIFY(visitor.verifyTriangle(7, 2,3,4, Vector3D(0,1,0), Vector3D(0,0,1), Vector3D(1,0,0))); + QVERIFY(visitor.verifyTriangle(8, 2,1,0, Vector3D(0,1,0), Vector3D(1,0,0), Vector3D(0,0,1))); } void testVisitTriangleFan() @@ -643,7 +650,7 @@ private Q_SLOTS: simulateInitializationSync(dataBuffer.data(), backendBuffer); QByteArray indexData; - indexData.resize(sizeof(uint) * 3 * 2); + indexData.resize(sizeof(uint) * 10); uint *iDataPtr = reinterpret_cast(indexData.data()); iDataPtr[0] = 0; iDataPtr[1] = 1; @@ -651,6 +658,10 @@ private Q_SLOTS: iDataPtr[3] = 3; iDataPtr[4] = 4; iDataPtr[5] = 5; + iDataPtr[6] = static_cast(-1); + iDataPtr[7] = 0; + iDataPtr[8] = 1; + iDataPtr[9] = 2; indexDataBuffer->setData(indexData); Buffer *backendIndexBuffer = nodeManagers->bufferManager()->getOrCreateResource(indexDataBuffer->id()); @@ -669,7 +680,7 @@ private Q_SLOTS: indexAttribute->setBuffer(indexDataBuffer.data()); indexAttribute->setVertexBaseType(Qt3DRender::QAttribute::UnsignedInt); - indexAttribute->setCount(3*2); + indexAttribute->setCount(10); indexAttribute->setAttributeType(Qt3DRender::QAttribute::IndexAttribute); geometry->addAttribute(positionAttribute.data()); @@ -677,6 +688,8 @@ private Q_SLOTS: geometryRenderer->setGeometry(geometry); geometryRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::TriangleFan); + geometryRenderer->setPrimitiveRestartEnabled(true); + geometryRenderer->setRestartIndexValue(-1); Attribute *backendAttribute = nodeManagers->attributeManager()->getOrCreateResource(positionAttribute->id()); backendAttribute->setRenderer(&renderer); @@ -699,11 +712,12 @@ private Q_SLOTS: visitor.apply(backendRenderer, Qt3DCore::QNodeId()); // THEN - QVERIFY(visitor.triangleCount() == 4); + QCOMPARE(visitor.triangleCount(), 5U); QVERIFY(visitor.verifyTriangle(0, 2,1,0, Vector3D(0,1,0), Vector3D(1,0,0), Vector3D(0,0,1))); QVERIFY(visitor.verifyTriangle(1, 3,2,0, Vector3D(0,0,1), Vector3D(0,1,0), Vector3D(0,0,1))); QVERIFY(visitor.verifyTriangle(2, 4,3,0, Vector3D(1,0,0), Vector3D(0,0,1), Vector3D(0,0,1))); QVERIFY(visitor.verifyTriangle(3, 5,4,0, Vector3D(0,1,0), Vector3D(1,0,0), Vector3D(0,0,1))); + QVERIFY(visitor.verifyTriangle(4, 2,1,0, Vector3D(0,1,0), Vector3D(1,0,0), Vector3D(0,0,1))); } void testVisitTrianglesAdjacency() -- cgit v1.2.3 From 068309acaa787fe8a094869e839c1d0131721f55 Mon Sep 17 00:00:00 2001 From: Martin Andersson Date: Mon, 18 Nov 2019 13:51:06 +0100 Subject: QDistanceFieldMaterial: Don't scale rgb colors with distance field alpha Scaling the rbg colors with the calculated distance field alpha value can result in faint text and different colors across the same text. These issues are most obvious when the text is small. Change-Id: Ia12e54e3f344cb918575739a15e519e34d67e0f1 Reviewed-by: Wieland Hagen Reviewed-by: Paul Lemire --- src/extras/shaders/es2/distancefieldtext.frag | 2 +- src/extras/shaders/gl3/distancefieldtext.frag | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extras/shaders/es2/distancefieldtext.frag b/src/extras/shaders/es2/distancefieldtext.frag index d2db2e306..b7563e397 100644 --- a/src/extras/shaders/es2/distancefieldtext.frag +++ b/src/extras/shaders/es2/distancefieldtext.frag @@ -33,5 +33,5 @@ void main() FP float maxAlpha = threshold + range; FP float distVal = texture2D(distanceFieldTexture, texCoord).r; - gl_FragColor = color * smoothstep(minAlpha, maxAlpha, distVal); + gl_FragColor = vec4(color.rgb, color.a * smoothstep(minAlpha, maxAlpha, distVal)); } diff --git a/src/extras/shaders/gl3/distancefieldtext.frag b/src/extras/shaders/gl3/distancefieldtext.frag index 23dff8e0f..8e0684adc 100644 --- a/src/extras/shaders/gl3/distancefieldtext.frag +++ b/src/extras/shaders/gl3/distancefieldtext.frag @@ -34,6 +34,6 @@ void main() float maxAlpha = threshold + range; float distVal = texture(distanceFieldTexture, texCoord).r; - fragColor = color * smoothstep(minAlpha, maxAlpha, distVal); + fragColor = vec4(color.rgb, color.a * smoothstep(minAlpha, maxAlpha, distVal)); gl_FragDepth = gl_FragCoord.z - zValue * 0.00001; } -- cgit v1.2.3 From 98b8894856dd7359ebfe1075962ce770b5d110e0 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Fri, 6 Dec 2019 13:09:24 +0100 Subject: Doc: Add note about implementation specific property meaning Fixes: QTBUG-73095 Change-Id: I843b0376ed0e4ece6ef949acb596a0303aac977d Reviewed-by: Andy Shaw --- src/render/lights/qdirectionallight.cpp | 10 +++++-- src/render/lights/qenvironmentlight.cpp | 12 ++++++++ src/render/lights/qpointlight.cpp | 30 ++++++++++++++++---- src/render/lights/qspotlight.cpp | 50 ++++++++++++++++++++++++++------- 4 files changed, 84 insertions(+), 18 deletions(-) diff --git a/src/render/lights/qdirectionallight.cpp b/src/render/lights/qdirectionallight.cpp index 13fb78843..51827b644 100644 --- a/src/render/lights/qdirectionallight.cpp +++ b/src/render/lights/qdirectionallight.cpp @@ -115,12 +115,18 @@ QDirectionalLight::QDirectionalLight(QDirectionalLightPrivate &dd, QNode *parent /*! \qmlproperty vector3d Qt3D.Render::DirectionalLight::worldDirection - Specifies the world direction of the directional light + Specifies the world direction of the directional light. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! \property Qt3DRender::QDirectionalLight::worldDirection - Specifies the world direction of the directional light + Specifies the world direction of the directional light. + + \note The exact meaning and use of this property is up to the + material implementation. */ void QDirectionalLight::setWorldDirection(const QVector3D &direction) { diff --git a/src/render/lights/qenvironmentlight.cpp b/src/render/lights/qenvironmentlight.cpp index 86ef04f95..977e117db 100644 --- a/src/render/lights/qenvironmentlight.cpp +++ b/src/render/lights/qenvironmentlight.cpp @@ -158,6 +158,9 @@ QEnvironmentLight::~QEnvironmentLight() Holds the current environment irradiance map texture. By default, the environment irradiance texture is null. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! @@ -166,6 +169,9 @@ QEnvironmentLight::~QEnvironmentLight() Holds the current environment irradiance map texture. By default, the environment irradiance texture is null. + + \note The exact meaning and use of this property is up to the + material implementation. */ QAbstractTexture *QEnvironmentLight::irradiance() const { @@ -179,6 +185,9 @@ QAbstractTexture *QEnvironmentLight::irradiance() const Holds the current environment specular map texture. By default, the environment specular texture is null. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! @@ -187,6 +196,9 @@ QAbstractTexture *QEnvironmentLight::irradiance() const Holds the current environment specular map texture. By default, the environment specular texture is null. + + \note The exact meaning and use of this property is up to the + material implementation. */ QAbstractTexture *QEnvironmentLight::specular() const { diff --git a/src/render/lights/qpointlight.cpp b/src/render/lights/qpointlight.cpp index 2b042c91d..c16291709 100644 --- a/src/render/lights/qpointlight.cpp +++ b/src/render/lights/qpointlight.cpp @@ -135,12 +135,18 @@ QPointLight::QPointLight(QPointLightPrivate &dd, QNode *parent) /*! \qmlproperty float Qt3D.Render::PointLight::constantAttenuation - Specifies the constant attenuation of the point light + Specifies the constant attenuation of the point light. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! \property Qt3DRender::QPointLight::constantAttenuation - Specifies the constant attenuation of the point light + Specifies the constant attenuation of the point light. + + \note The exact meaning and use of this property is up to the + material implementation. */ float QPointLight::constantAttenuation() const { @@ -159,12 +165,18 @@ void QPointLight::setConstantAttenuation(float value) /*! \qmlproperty float Qt3D.Render::PointLight::linearAttenuation - Specifies the linear attenuation of the point light + Specifies the linear attenuation of the point light. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! \property Qt3DRender::QPointLight::linearAttenuation - Specifies the linear attenuation of the point light + Specifies the linear attenuation of the point light. + + \note The exact meaning and use of this property is up to the + material implementation. */ float QPointLight::linearAttenuation() const { @@ -183,12 +195,18 @@ void QPointLight::setLinearAttenuation(float value) /*! \qmlproperty float Qt3D.Render::PointLight::quadraticAttenuation - Specifies the quadratic attenuation of the point light + Specifies the quadratic attenuation of the point light. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! \property Qt3DRender::QPointLight::quadraticAttenuation - Specifies the quadratic attenuation of the point light + Specifies the quadratic attenuation of the point light. + + \note The exact meaning and use of this property is up to the + material implementation. */ float QPointLight::quadraticAttenuation() const { diff --git a/src/render/lights/qspotlight.cpp b/src/render/lights/qspotlight.cpp index eddafbe61..c725a6baf 100644 --- a/src/render/lights/qspotlight.cpp +++ b/src/render/lights/qspotlight.cpp @@ -140,12 +140,18 @@ QSpotLight::QSpotLight(QSpotLightPrivate &dd, QNode *parent) /*! \qmlproperty float Qt3D.Render::SpotLight::constantAttenuation - Specifies the constant attenuation of the spot light + Specifies the constant attenuation of the spot light. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! \property Qt3DRender::QSpotLight::constantAttenuation - Specifies the constant attenuation of the spot light + Specifies the constant attenuation of the spot light. + + \note The exact meaning and use of this property is up to the + material implementation. */ float QSpotLight::constantAttenuation() const { @@ -164,12 +170,18 @@ void QSpotLight::setConstantAttenuation(float value) /*! \qmlproperty float Qt3D.Render::SpotLight::linearAttenuation - Specifies the linear attenuation of the spot light + Specifies the linear attenuation of the spot light. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! \property Qt3DRender::QSpotLight::linearAttenuation - Specifies the linear attenuation of the spot light + Specifies the linear attenuation of the spot light. + + \note The exact meaning and use of this property is up to the + material implementation. */ float QSpotLight::linearAttenuation() const { @@ -188,12 +200,18 @@ void QSpotLight::setLinearAttenuation(float value) /*! \qmlproperty float Qt3D.Render::SpotLight::quadraticAttenuation - Specifies the quadratic attenuation of the spot light + Specifies the quadratic attenuation of the spot light. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! \property Qt3DRender::QSpotLight::quadraticAttenuation - Specifies the quadratic attenuation of the spot light + Specifies the quadratic attenuation of the spot light. + + \note The exact meaning and use of this property is up to the + material implementation. */ float QSpotLight::quadraticAttenuation() const { @@ -212,12 +230,18 @@ void QSpotLight::setQuadraticAttenuation(float value) /*! \qmlproperty vector3d Qt3D.Render::SpotLight::localDirection - Specifies the local direction of the spot light + Specifies the local direction of the spot light. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! \property Qt3DRender::QSpotLight::localDirection - Specifies the local direction of the spot light + Specifies the local direction of the spot light. + + \note The exact meaning and use of this property is up to the + material implementation. */ QVector3D QSpotLight::localDirection() const { @@ -227,12 +251,18 @@ QVector3D QSpotLight::localDirection() const /*! \qmlproperty float Qt3D.Render::SpotLight::cutOffAngle - Specifies the cut off angle of the spot light + Specifies the cut off angle of the spot light. + + \note The exact meaning and use of this property is up to the + material implementation. */ /*! \property Qt3DRender::QSpotLight::cutOffAngle - Specifies the cut off angle of the spot light + Specifies the cut off angle of the spot light. + + \note The exact meaning and use of this property is up to the + material implementation. */ float QSpotLight::cutOffAngle() const { -- cgit v1.2.3 From e5f41230d2fa1cdc126785f396e5a57cee728341 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 10 Dec 2019 14:44:08 +0100 Subject: Skip shouldNotCrashInNormalStartupShutdownSequence The test is flaky on macOS 10.12 and 10.13. As it usually times out, a blacklist entry won't help. Blacklisting merely ignores the result, but doesn't prevent the test watchdog from killing the process. Task-number: QTBUG-80660 Change-Id: I6aec979e7437700e4e6596241f135622d99fd3be Reviewed-by: Simon Hausmann --- tests/auto/core/qaspectengine/tst_qaspectengine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/core/qaspectengine/tst_qaspectengine.cpp b/tests/auto/core/qaspectengine/tst_qaspectengine.cpp index 244077d46..2f16bf7c6 100644 --- a/tests/auto/core/qaspectengine/tst_qaspectengine.cpp +++ b/tests/auto/core/qaspectengine/tst_qaspectengine.cpp @@ -146,6 +146,10 @@ private Q_SLOTS: void shouldNotCrashInNormalStartupShutdownSequence() { +#ifdef Q_OS_MACOS + QSKIP("Test frequently times out. See QTBUG-80660."); +#endif + // GIVEN // An initialized aspect engine... QAspectEngine engine; -- cgit v1.2.3 From 07c6f38d38b32169a5bf80e5fe2db4b3b4cf2635 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 11 Dec 2019 09:04:05 +0100 Subject: qquaternionanimation.cpp: Fix warning suppression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quote the option, fixing g++ 8.3 warning about: qquaternionanimation.cpp: In member function ‘void Qt3DCore::Quick::QQuaternionAnimation::setType(Qt3DCore::Quick::QQuaternionAnimation::Type)’: qquaternionanimation.cpp:147:44: warning: missing option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] QT_WARNING_DISABLE_GCC(-Wcast-function-type) ^ qquaternionanimation.cpp:148:107: warning: cast between incompatible function types from ‘QVariant (*)(const QQuaternion&, const QQuaternion&, qreal)’ {aka ‘QVariant (*)(const QQuaternion&, const QQuaternion&, double)’} to ‘QVariantAnimation::Interpolator’ {aka ‘QVariant (*)(const void*, const void*, double)’} [-Wcast-function-type] d->interpolator = reinterpret_cast(&q_quaternionNlerpInterpolator); Amends 698bd5f22c79ecf777a0abe57a36676dc49fa8f3. Change-Id: Ia68e2b5b198e658ef7ce9e930d8f3d4bd77fd2d2 Reviewed-by: Thiago Macieira --- src/quick3d/quick3d/qquaternionanimation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick3d/quick3d/qquaternionanimation.cpp b/src/quick3d/quick3d/qquaternionanimation.cpp index 22cc905f7..933a08ee4 100644 --- a/src/quick3d/quick3d/qquaternionanimation.cpp +++ b/src/quick3d/quick3d/qquaternionanimation.cpp @@ -144,7 +144,7 @@ void QQuaternionAnimation::setType(Type type) switch (type) { case Nlerp: QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC(-Wcast-function-type) +QT_WARNING_DISABLE_GCC("-Wcast-function-type") d->interpolator = reinterpret_cast(&q_quaternionNlerpInterpolator); QT_WARNING_POP break; -- cgit v1.2.3 From cfaa43c554ef3e9d1e2ebf1cbdbbb8ce1bdcbe59 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Wed, 11 Dec 2019 17:43:27 +0000 Subject: Always get the estimate primitive count from the attribute Previously were checking that the attribute was actually but due to refactoring the shader is not yet examined at this point. With this change, we always get the estimated number of points from the attributes. Potentially it means we're getting it from an attribute that is not being used but the user should then set the correct number on the geometry renderer anyway. Task-number: QTBUG-80697 Change-Id: Ie34131fe3ff41b34609a2f2eb95c4ff678424036 Reviewed-by: Paul Lemire --- src/render/renderers/opengl/renderer/renderview.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp index 3612d8767..d7e34e16c 100644 --- a/src/render/renderers/opengl/renderer/renderview.cpp +++ b/src/render/renderers/opengl/renderer/renderview.cpp @@ -686,11 +686,9 @@ EntityRenderCommandData RenderView::buildDrawRenderCommands(const QVectornameId())) - estimatedCount = std::max(int(attribute->count()), estimatedCount); + case QAttribute::VertexAttribute: + estimatedCount = std::max(int(attribute->count()), estimatedCount); break; - } default: Q_UNREACHABLE(); break; -- cgit v1.2.3 From ecd193d7b5788fca8b478a02068060a078dc5738 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Mon, 9 Dec 2019 15:10:53 +0000 Subject: Fix picking with primitive restart for line loops Previous fix was not closing the loop on every primitive, just the last one. Task-number: QTBUG-71919 Change-Id: I22d52258477b0c4777118ee36a0b3868da982885 Reviewed-by: Volker Enderlein Reviewed-by: Paul Lemire --- src/render/backend/segmentsvisitor.cpp | 57 ++++++++++++---------- .../render/segmentvisitor/tst_segmentvisitor.cpp | 27 +++++++--- 2 files changed, 52 insertions(+), 32 deletions(-) diff --git a/src/render/backend/segmentsvisitor.cpp b/src/render/backend/segmentsvisitor.cpp index 68deafb15..d9f2d79ec 100644 --- a/src/render/backend/segmentsvisitor.cpp +++ b/src/render/backend/segmentsvisitor.cpp @@ -135,39 +135,44 @@ void traverseSegmentStripIndexed(Index *indices, bool loop) { uint i = 0; + uint stripStartIndex = 0; + const uint verticesStride = vertexInfo.byteStride / sizeof(Vertex); const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U); uint ndx[2]; Vector3D abc[2]; - - startLinePrimitive:ndx[0] = indices[i]; - uint idx = ndx[0] * verticesStride; - for (uint j = 0; j < maxVerticesDataSize; ++j) - abc[0][j] = vertices[idx + j]; - while (i < indexInfo.count - 1) { - ndx[1] = indices[i + 1]; - if (ndx[0] != ndx[1]) { - if (indexInfo.restartEnabled && indexInfo.restartIndexValue == static_cast(ndx[1])) { - i += 2; - goto startLinePrimitive; - } - idx = ndx[1] * verticesStride; - for (uint j = 0; j < maxVerticesDataSize; ++j) - abc[1][j] = vertices[idx + j]; - visitor->visit(ndx[0], abc[0], ndx[1], abc[1]); + while (i < indexInfo.count) { + if (indexInfo.restartEnabled && indexInfo.restartIndexValue == static_cast(indices[i])) { + ++i; + continue; } + stripStartIndex = i; + ndx[0] = indices[stripStartIndex]; + uint idx = ndx[0] * verticesStride; + for (uint j = 0; j < maxVerticesDataSize; ++j) + abc[0][j] = vertices[idx + j]; ++i; - ndx[0] = ndx[1]; - abc[0] = abc[1]; - } - if (loop) { - ndx[1] = indices[0]; - if (ndx[0] != ndx[1]) { - idx = ndx[1] * verticesStride; - for (uint j = 0; j < maxVerticesDataSize; ++j) - abc[1][j] = vertices[idx + j]; - visitor->visit(ndx[0], abc[0], ndx[1], abc[1]); + while (i < indexInfo.count && (!indexInfo.restartEnabled || indexInfo.restartIndexValue != static_cast(indices[i]))) { + ndx[1] = indices[i]; + if (ndx[0] != ndx[1]) { + idx = ndx[1] * verticesStride; + for (uint j = 0; j < maxVerticesDataSize; ++j) + abc[1][j] = vertices[idx + j]; + visitor->visit(ndx[0], abc[0], ndx[1], abc[1]); + } + ++i; + ndx[0] = ndx[1]; + abc[0] = abc[1]; + } + if (loop) { + ndx[1] = indices[stripStartIndex]; + if (ndx[0] != ndx[1]) { + idx = ndx[1] * verticesStride; + for (uint j = 0; j < maxVerticesDataSize; ++j) + abc[1][j] = vertices[idx + j]; + visitor->visit(ndx[0], abc[0], ndx[1], abc[1]); + } } } } diff --git a/tests/auto/render/segmentvisitor/tst_segmentvisitor.cpp b/tests/auto/render/segmentvisitor/tst_segmentvisitor.cpp index 4db12136a..fc65d0854 100644 --- a/tests/auto/render/segmentvisitor/tst_segmentvisitor.cpp +++ b/tests/auto/render/segmentvisitor/tst_segmentvisitor.cpp @@ -426,12 +426,15 @@ private Q_SLOTS: simulateInitializationSync(dataBuffer.data(), backendBuffer); QByteArray indexData; - indexData.resize(sizeof(uint) * 2 * 4); + indexData.resize(sizeof(uint) * 7); uint *iDataPtr = reinterpret_cast(indexData.data()); iDataPtr[0] = 0; iDataPtr[1] = 1; iDataPtr[2] = 2; iDataPtr[3] = 3; + iDataPtr[4] = static_cast(-1); + iDataPtr[5] = 0; + iDataPtr[6] = 1; indexDataBuffer->setData(indexData); Buffer *backendIndexBuffer = nodeManagers->bufferManager()->getOrCreateResource(indexDataBuffer->id()); @@ -450,7 +453,7 @@ private Q_SLOTS: indexAttribute->setBuffer(indexDataBuffer.data()); indexAttribute->setVertexBaseType(Qt3DRender::QAttribute::UnsignedInt); - indexAttribute->setCount(4); + indexAttribute->setCount(7); indexAttribute->setAttributeType(Qt3DRender::QAttribute::IndexAttribute); geometry->addAttribute(positionAttribute.data()); @@ -458,6 +461,8 @@ private Q_SLOTS: geometryRenderer->setGeometry(geometry); geometryRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::LineStrip); + geometryRenderer->setPrimitiveRestartEnabled(true); + geometryRenderer->setRestartIndexValue(-1); Attribute *backendAttribute = nodeManagers->attributeManager()->getOrCreateResource(positionAttribute->id()); backendAttribute->setRenderer(&renderer); @@ -480,10 +485,11 @@ private Q_SLOTS: visitor.apply(backendRenderer, Qt3DCore::QNodeId()); // THEN - QCOMPARE(visitor.segmentCount(), uint(3)); + QCOMPARE(visitor.segmentCount(), uint(4)); QVERIFY(visitor.verifySegment(0, 0,1, Vector3D(0,0,0), Vector3D(1,0,0))); QVERIFY(visitor.verifySegment(1, 1,2, Vector3D(1,0,0), Vector3D(1,1,0))); QVERIFY(visitor.verifySegment(2, 2,3, Vector3D(1,1,0), Vector3D(0,1,0))); + QVERIFY(visitor.verifySegment(3, 0,1, Vector3D(0,0,0), Vector3D(1,0,0))); } void testVisitLineLoop() @@ -588,12 +594,16 @@ private Q_SLOTS: simulateInitializationSync(dataBuffer.data(), backendBuffer); QByteArray indexData; - indexData.resize(sizeof(uint) * 2 * 4); + indexData.resize(sizeof(uint) * 8); uint *iDataPtr = reinterpret_cast(indexData.data()); iDataPtr[0] = 0; iDataPtr[1] = 1; iDataPtr[2] = 2; iDataPtr[3] = 3; + iDataPtr[4] = static_cast(-1); + iDataPtr[5] = 0; + iDataPtr[6] = 1; + iDataPtr[7] = 2; indexDataBuffer->setData(indexData); Buffer *backendIndexBuffer = nodeManagers->bufferManager()->getOrCreateResource(indexDataBuffer->id()); @@ -612,7 +622,7 @@ private Q_SLOTS: indexAttribute->setBuffer(indexDataBuffer.data()); indexAttribute->setVertexBaseType(Qt3DRender::QAttribute::UnsignedInt); - indexAttribute->setCount(4); + indexAttribute->setCount(8); indexAttribute->setAttributeType(Qt3DRender::QAttribute::IndexAttribute); geometry->addAttribute(positionAttribute.data()); @@ -620,6 +630,8 @@ private Q_SLOTS: geometryRenderer->setGeometry(geometry); geometryRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::LineLoop); + geometryRenderer->setPrimitiveRestartEnabled(true); + geometryRenderer->setRestartIndexValue(-1); Attribute *backendAttribute = nodeManagers->attributeManager()->getOrCreateResource(positionAttribute->id()); backendAttribute->setRenderer(&renderer); @@ -642,11 +654,14 @@ private Q_SLOTS: visitor.apply(backendRenderer, Qt3DCore::QNodeId()); // THEN - QCOMPARE(visitor.segmentCount(), uint(4)); + QCOMPARE(visitor.segmentCount(), uint(7)); QVERIFY(visitor.verifySegment(0, 0,1, Vector3D(0,0,0), Vector3D(1,0,0))); QVERIFY(visitor.verifySegment(1, 1,2, Vector3D(1,0,0), Vector3D(1,1,0))); QVERIFY(visitor.verifySegment(2, 2,3, Vector3D(1,1,0), Vector3D(0,1,0))); QVERIFY(visitor.verifySegment(3, 3,0, Vector3D(0,1,0), Vector3D(0,0,0))); + QVERIFY(visitor.verifySegment(4, 0,1, Vector3D(0,0,0), Vector3D(1,0,0))); + QVERIFY(visitor.verifySegment(5, 1,2, Vector3D(1,0,0), Vector3D(1,1,0))); + QVERIFY(visitor.verifySegment(6, 2,0, Vector3D(1,1,0), Vector3D(0,0,0))); } void testVisitLineAdjacency() -- cgit v1.2.3 From 1cb7458af3ca427f2d25f939044b10e037740db3 Mon Sep 17 00:00:00 2001 From: Volker Enderlein Date: Fri, 6 Dec 2019 13:01:16 +0100 Subject: QText2DEntity: Support display of empty strings The DistantFieldTextRenderer of a QText2DEntity was not properly updated for empty strings. The dereferencing of previous QGlyphRuns needs to be done before the number of DistantFieldTextRenderers is adjusted as a DistandFieldTextRenderer may be the parent of a QTextureAtlas that is referenced by a Glyph. Task-number: QTBUG-80569 Change-Id: I0dba8b749148bef088864dc7200ae0513965745a Reviewed-by: Paul Lemire --- src/extras/text/qtext2dentity.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/extras/text/qtext2dentity.cpp b/src/extras/text/qtext2dentity.cpp index aa4785fe7..897672782 100644 --- a/src/extras/text/qtext2dentity.cpp +++ b/src/extras/text/qtext2dentity.cpp @@ -217,9 +217,6 @@ struct RenderData { void QText2DEntityPrivate::setCurrentGlyphRuns(const QVector &runs) { - if (runs.isEmpty()) - return; - // For each distinct texture, we need a separate DistanceFieldTextRenderer, // for which we need vertex and index data QHash renderData; @@ -294,6 +291,11 @@ void QText2DEntityPrivate::setCurrentGlyphRuns(const QVector &runs) } } + // de-ref all glyphs for previous QGlyphRuns + for (int i = 0; i < m_currentGlyphRuns.size(); i++) + m_glyphCache->derefGlyphs(m_currentGlyphRuns[i]); + m_currentGlyphRuns = runs; + // make sure we have the correct number of DistanceFieldTextRenderers // TODO: we might keep one renderer at all times, so we won't delete and // re-allocate one every time the text changes from an empty to a non-empty string @@ -314,11 +316,6 @@ void QText2DEntityPrivate::setCurrentGlyphRuns(const QVector &runs) for (auto it = renderData.begin(); it != renderData.end(); ++it) { m_renderers[rendererIdx++]->setGlyphData(it.key(), it.value().vertex, it.value().index); } - - // de-ref all glyphs for previous QGlyphRuns - for (int i = 0; i < m_currentGlyphRuns.size(); i++) - m_glyphCache->derefGlyphs(m_currentGlyphRuns[i]); - m_currentGlyphRuns = runs; } void QText2DEntityPrivate::clearCurrentGlyphRuns() -- cgit v1.2.3 From 12ae9f1892edfe5927b5b38f3d12de14b027889a Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 13 Dec 2019 14:41:47 +0100 Subject: RenderView: fix leak with m_stateset Change-Id: I368935178c285b9beb609083b93ae4621c70e28e Reviewed-by: Mike Krus --- src/render/renderers/opengl/renderer/renderview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp index d7e34e16c..c00a92629 100644 --- a/src/render/renderers/opengl/renderer/renderview.cpp +++ b/src/render/renderers/opengl/renderer/renderview.cpp @@ -282,6 +282,7 @@ RenderView::RenderView() RenderView::~RenderView() { + delete m_stateSet; } namespace { -- cgit v1.2.3