From 88849a83a6f9ca3524cf3ba32c3a4ed7e6fabdb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 17 Jan 2020 07:57:05 +0200 Subject: Don't render when scene is not changing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tomi Korpipää --- src/engine/Qt3DSRuntimeView.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/engine/Qt3DSRuntimeView.cpp') 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() -- cgit v1.2.3