Skip to content

Commit

Permalink
Make Gazebo aware of SetCameraPassCountPerGpuFlush (#921)
Browse files Browse the repository at this point in the history
* Call Scene::PostRenderGpuFlush

Requires ign-rendering update to compile correctly

Affects gazebosim/gz-rendering#323

Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>

* Update to use the renamed PostRender call

Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>

* Avoid warnings from Legacy mode

Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>

* Default to SetNumCameraPassesPerGpuFlush = 6

Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>

* Rename SetNumCameraPassesPerGpuFlush -> SetCameraPassCountPerGpuFlush

Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>

* Style changes

Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
  • Loading branch information
darksylinc committed Jul 22, 2021
1 parent c07b49c commit b08d63c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gui/plugins/scene3d/Scene3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,8 @@ void IgnRenderer::Initialize()

auto root = scene->RootVisual();

scene->SetCameraPassCountPerGpuFlush(6u);

// Camera
this->dataPtr->camera = scene->CreateCamera();
root->AddChild(this->dataPtr->camera);
Expand Down
10 changes: 10 additions & 0 deletions src/systems/sensors/Sensors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ void SensorsPrivate::WaitForInit()
igndbg << "Initializing render context" << std::endl;
this->renderUtil.Init();
this->scene = this->renderUtil.Scene();
this->scene->SetCameraPassCountPerGpuFlush(6u);
this->initialized = true;
}

Expand Down Expand Up @@ -262,6 +263,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->PostRender();
this->eventManager->Emit<events::PostRender>();
}

Expand Down

0 comments on commit b08d63c

Please sign in to comment.