diff --git a/src/engine/Qt3DSRuntimeView.cpp b/src/engine/Qt3DSRuntimeView.cpp index 36798aafe..7b84c98d7 100644 --- a/src/engine/Qt3DSRuntimeView.cpp +++ b/src/engine/Qt3DSRuntimeView.cpp @@ -163,7 +163,7 @@ private: bool m_showOnScreenStats; QElapsedTimer *m_startupTimer; qint64 m_startupTime; - + bool m_resize; public: CRuntimeView(ITimeProvider &inTimeProvider, IWindowSystem &inWindowSystem, IAudioPlayer *inAudioPlayer, QElapsedTimer *startupTimer); @@ -261,6 +261,7 @@ CRuntimeView::CRuntimeView(ITimeProvider &inTimeProvider, IWindowSystem &inWindo , m_showOnScreenStats(false) , m_startupTimer(startupTimer) , m_startupTime(-1) + , m_resize(true) { // Signal proxy thread affinity is set later when signals are connected to ensure it is correct signalProxy()->moveToThread(nullptr); @@ -410,7 +411,8 @@ bool CRuntimeView::Render() PerfLogGeneralEvent1(DATALOGGER_FRAME); - ret = m_Application->UpdateAndRender(); + ret = m_Application->UpdateAndRender(m_resize); + m_resize = false; if (m_startupTime < 0 && m_startupTimer && m_startupTimer->isValid()) { @@ -499,6 +501,7 @@ bool CRuntimeView::HandleMessage(const QEvent *inEvent) break; case QEvent::Resize: { + m_resize = true; if (m_Application->GetPrimaryPresentation()) m_RenderEngine->CheckResize(true, *m_Application->GetPrimaryPresentation()); ret = true; diff --git a/src/runtime/Qt3DSApplication.cpp b/src/runtime/Qt3DSApplication.cpp index ffcfa59a2..6d02c8f95 100644 --- a/src/runtime/Qt3DSApplication.cpp +++ b/src/runtime/Qt3DSApplication.cpp @@ -1138,7 +1138,7 @@ struct SApp : public IApplication } // Update all the presentations and render them. - bool UpdateAndRender() override + bool UpdateAndRender(bool isResize) override { QT3DS_ASSERT(m_AppLoadContext.mPtr == NULL); m_ThisFrameStartTime = qt3ds::foundation::Time::getCurrentCounterValue(); @@ -1186,9 +1186,11 @@ struct SApp : public IApplication bool skip = checkSkipFrame(); // If we skip rendering this frame, mark next frame to be rendered - renderNextFrame |= skip; - if (!skip) + + if (!skip && (renderNextFrame || IsApplicationDirty() || isResize)) Render(); + renderNextFrame |= skip; + m_LastRenderWasDirty |= isResize; m_InputEnginePtr->ClearInputFrame(); diff --git a/src/runtime/Qt3DSApplication.h b/src/runtime/Qt3DSApplication.h index fd7f027af..2fa7161b0 100644 --- a/src/runtime/Qt3DSApplication.h +++ b/src/runtime/Qt3DSApplication.h @@ -168,7 +168,7 @@ public: virtual QList GetPresentationList() = 0; // Update all the presentations and render them. Called exactly once per frame. - virtual bool UpdateAndRender() = 0; + virtual bool UpdateAndRender(bool isResize) = 0; virtual bool IsApplicationDirty() = 0;