Skip to content

Commit b08d63c

Browse files
authored
Make Gazebo aware of SetCameraPassCountPerGpuFlush (#921)
* Call Scene::PostRenderGpuFlush Requires ign-rendering update to compile correctly Affects gazebosim/gz-rendering#323 Signed-off-by: Matias N. Goldberg <[email protected]> * Update to use the renamed PostRender call Signed-off-by: Matias N. Goldberg <[email protected]> * Avoid warnings from Legacy mode Signed-off-by: Matias N. Goldberg <[email protected]> * Default to SetNumCameraPassesPerGpuFlush = 6 Signed-off-by: Matias N. Goldberg <[email protected]> * Rename SetNumCameraPassesPerGpuFlush -> SetCameraPassCountPerGpuFlush Signed-off-by: Matias N. Goldberg <[email protected]> * Style changes Signed-off-by: Matias N. Goldberg <[email protected]>
1 parent c07b49c commit b08d63c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/gui/plugins/scene3d/Scene3D.cc

+2
Original file line numberDiff line numberDiff line change
@@ -2019,6 +2019,8 @@ void IgnRenderer::Initialize()
20192019

20202020
auto root = scene->RootVisual();
20212021

2022+
scene->SetCameraPassCountPerGpuFlush(6u);
2023+
20222024
// Camera
20232025
this->dataPtr->camera = scene->CreateCamera();
20242026
root->AddChild(this->dataPtr->camera);

src/systems/sensors/Sensors.cc

+10
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ void SensorsPrivate::WaitForInit()
196196
igndbg << "Initializing render context" << std::endl;
197197
this->renderUtil.Init();
198198
this->scene = this->renderUtil.Scene();
199+
this->scene->SetCameraPassCountPerGpuFlush(6u);
199200
this->initialized = true;
200201
}
201202

@@ -262,6 +263,15 @@ void SensorsPrivate::RunOnce()
262263
// publish data
263264
IGN_PROFILE("RunOnce");
264265
this->sensorManager.RunOnce(this->updateTime);
266+
}
267+
268+
{
269+
IGN_PROFILE("PostRender");
270+
// Update the scene graph manually to improve performance
271+
// We only need to do this once per frame It is important to call
272+
// sensors::RenderingSensor::SetManualSceneUpdate and set it to true
273+
// so we don't waste cycles doing one scene graph update per sensor
274+
this->scene->PostRender();
265275
this->eventManager->Emit<events::PostRender>();
266276
}
267277

0 commit comments

Comments
 (0)