summaryrefslogtreecommitdiffstats
path: root/src/engine/Qt3DSRuntimeView.cpp
diff options
context:
space:
mode:
authorAntti Määttä <antti.maatta@qt.io>2020-01-17 07:57:05 +0200
committerAntti Määttä <antti.maatta@qt.io>2020-01-22 13:28:49 +0200
commit88849a83a6f9ca3524cf3ba32c3a4ed7e6fabdb9 (patch)
treecbe79006339b63245381cef7e2822cbbf01dcae9 /src/engine/Qt3DSRuntimeView.cpp
parent7a49e1bdc590f0d3f397dd04355fd165bbd1cb86 (diff)
Don't render when scene is not changing
Reduce CPU and GPU load by checking if the scene has changed and render only if it has. Task-number: QT3DS-4042 Change-Id: I54e447760f04fdad8d64319f326245175b471331 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/engine/Qt3DSRuntimeView.cpp')
-rw-r--r--src/engine/Qt3DSRuntimeView.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/engine/Qt3DSRuntimeView.cpp b/src/engine/Qt3DSRuntimeView.cpp
index fd3be65..2335cf1 100644
--- a/src/engine/Qt3DSRuntimeView.cpp
+++ b/src/engine/Qt3DSRuntimeView.cpp
@@ -179,7 +179,7 @@ public:
void Cleanup() override;
bool CanRender() override;
- void Render() override;
+ bool Render() override;
bool WasLastFrameDirty() override;
bool HandleMessage(const QEvent *inEvent) override;
@@ -394,8 +394,9 @@ bool CRuntimeView::CanRender()
* returns KD_TRUE to call egl_render and swap properly, KD_FALSE if there has been no scene update
*or redraw.
*/
-void CRuntimeView::Render()
+bool CRuntimeView::Render()
{
+ bool ret = true;
if (m_Application.mPtr == nullptr) {
// InitializeGraphics has not been called
QT3DS_ASSERT(false);
@@ -403,7 +404,7 @@ void CRuntimeView::Render()
PerfLogGeneralEvent1(DATALOGGER_FRAME);
- m_Application->UpdateAndRender();
+ ret = m_Application->UpdateAndRender();
if (m_startupTime < 0 && m_startupTimer && m_startupTimer->isValid()) {
@@ -457,6 +458,7 @@ void CRuntimeView::Render()
manager.PopState();
}
+ return ret;
}
bool CRuntimeView::WasLastFrameDirty()