From dfa8b59a793e84213e690c6ad1b48c27a7069cfa Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Sun, 16 May 2021 20:38:55 -0300 Subject: [PATCH 1/6] Call Scene::PostRenderGpuFlush Requires ign-rendering update to compile correctly Affects ignitionrobotics/ign-rendering#323 Signed-off-by: Matias N. Goldberg --- src/systems/sensors/Sensors.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/systems/sensors/Sensors.cc b/src/systems/sensors/Sensors.cc index a20b5c3280..9fc3055995 100644 --- a/src/systems/sensors/Sensors.cc +++ b/src/systems/sensors/Sensors.cc @@ -262,6 +262,15 @@ void SensorsPrivate::RunOnce() // publish data IGN_PROFILE("RunOnce"); this->sensorManager.RunOnce(this->updateTime); + } + + { + IGN_PROFILE("PostRender"); + // Update the scene graph manually to improve performance + // We only need to do this once per frame It is important to call + // sensors::RenderingSensor::SetManualSceneUpdate and set it to true + // so we don't waste cycles doing one scene graph update per sensor + this->scene->PostRenderGpuFlush(); this->eventManager->Emit(); } From b63aae9ff3978f27c0a89250476af84bae5fb8a5 Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Sun, 23 May 2021 21:54:47 -0300 Subject: [PATCH 2/6] Update to use the renamed PostRender call Signed-off-by: Matias N. Goldberg --- src/systems/sensors/Sensors.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systems/sensors/Sensors.cc b/src/systems/sensors/Sensors.cc index 9fc3055995..57f1bd6c86 100644 --- a/src/systems/sensors/Sensors.cc +++ b/src/systems/sensors/Sensors.cc @@ -270,7 +270,7 @@ void SensorsPrivate::RunOnce() // We only need to do this once per frame It is important to call // sensors::RenderingSensor::SetManualSceneUpdate and set it to true // so we don't waste cycles doing one scene graph update per sensor - this->scene->PostRenderGpuFlush(); + this->scene->PostRender(); this->eventManager->Emit(); } From 4db847ab0908015f5df35c98b78982a83cd804db Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Sat, 29 May 2021 15:10:04 -0300 Subject: [PATCH 3/6] Avoid warnings from Legacy mode Signed-off-by: Matias N. Goldberg --- src/systems/sensors/Sensors.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/systems/sensors/Sensors.cc b/src/systems/sensors/Sensors.cc index 57f1bd6c86..a7a2d2da41 100644 --- a/src/systems/sensors/Sensors.cc +++ b/src/systems/sensors/Sensors.cc @@ -196,6 +196,7 @@ void SensorsPrivate::WaitForInit() igndbg << "Initializing render context" << std::endl; this->renderUtil.Init(); this->scene = this->renderUtil.Scene(); + this->scene->SetNumCameraPassesPerGpuFlush( 6u ); this->initialized = true; } From 73db69615eb8879ac9a4e44094387839edf1aa82 Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Sun, 30 May 2021 21:26:54 -0300 Subject: [PATCH 4/6] Default to SetNumCameraPassesPerGpuFlush = 6 Signed-off-by: Matias N. Goldberg --- src/gui/plugins/scene3d/Scene3D.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/plugins/scene3d/Scene3D.cc b/src/gui/plugins/scene3d/Scene3D.cc index 9dab3e058e..651916ef32 100644 --- a/src/gui/plugins/scene3d/Scene3D.cc +++ b/src/gui/plugins/scene3d/Scene3D.cc @@ -2019,6 +2019,8 @@ void IgnRenderer::Initialize() auto root = scene->RootVisual(); + scene->SetNumCameraPassesPerGpuFlush( 6u ); + // Camera this->dataPtr->camera = scene->CreateCamera(); root->AddChild(this->dataPtr->camera); From a4ea20f42a0bba64059a775970ae5939358d31eb Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Sun, 6 Jun 2021 17:45:17 -0300 Subject: [PATCH 5/6] Rename SetNumCameraPassesPerGpuFlush -> SetCameraPassCountPerGpuFlush Signed-off-by: Matias N. Goldberg --- src/gui/plugins/scene3d/Scene3D.cc | 2 +- src/systems/sensors/Sensors.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/plugins/scene3d/Scene3D.cc b/src/gui/plugins/scene3d/Scene3D.cc index 651916ef32..ef468e724f 100644 --- a/src/gui/plugins/scene3d/Scene3D.cc +++ b/src/gui/plugins/scene3d/Scene3D.cc @@ -2019,7 +2019,7 @@ void IgnRenderer::Initialize() auto root = scene->RootVisual(); - scene->SetNumCameraPassesPerGpuFlush( 6u ); + scene->SetCameraPassCountPerGpuFlush( 6u ); // Camera this->dataPtr->camera = scene->CreateCamera(); diff --git a/src/systems/sensors/Sensors.cc b/src/systems/sensors/Sensors.cc index a7a2d2da41..88a88d811f 100644 --- a/src/systems/sensors/Sensors.cc +++ b/src/systems/sensors/Sensors.cc @@ -196,7 +196,7 @@ void SensorsPrivate::WaitForInit() igndbg << "Initializing render context" << std::endl; this->renderUtil.Init(); this->scene = this->renderUtil.Scene(); - this->scene->SetNumCameraPassesPerGpuFlush( 6u ); + this->scene->SetCameraPassCountPerGpuFlush( 6u ); this->initialized = true; } From 7f013fc4596196c669046bc978fc5b9744494501 Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Mon, 19 Jul 2021 19:58:09 -0300 Subject: [PATCH 6/6] Style changes Signed-off-by: Matias N. Goldberg --- src/gui/plugins/scene3d/Scene3D.cc | 2 +- src/systems/sensors/Sensors.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/plugins/scene3d/Scene3D.cc b/src/gui/plugins/scene3d/Scene3D.cc index ef468e724f..7d83f94a44 100644 --- a/src/gui/plugins/scene3d/Scene3D.cc +++ b/src/gui/plugins/scene3d/Scene3D.cc @@ -2019,7 +2019,7 @@ void IgnRenderer::Initialize() auto root = scene->RootVisual(); - scene->SetCameraPassCountPerGpuFlush( 6u ); + scene->SetCameraPassCountPerGpuFlush(6u); // Camera this->dataPtr->camera = scene->CreateCamera(); diff --git a/src/systems/sensors/Sensors.cc b/src/systems/sensors/Sensors.cc index 88a88d811f..9ee719e708 100644 --- a/src/systems/sensors/Sensors.cc +++ b/src/systems/sensors/Sensors.cc @@ -196,7 +196,7 @@ void SensorsPrivate::WaitForInit() igndbg << "Initializing render context" << std::endl; this->renderUtil.Init(); this->scene = this->renderUtil.Scene(); - this->scene->SetCameraPassCountPerGpuFlush( 6u ); + this->scene->SetCameraPassCountPerGpuFlush(6u); this->initialized = true; }