From d21c6f302a939de22b264ceb7cbe129a71df96f2 Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Tue, 20 Jul 2021 15:56:12 -0300 Subject: [PATCH] Make Sensors aware of CameraPassCountPerGpuFlush & Scene::PostFrame (#145) * Call Scene::PostRenderGpuFlush Requires ign-rendering update to compile correctly Requires ign-gazebo update to run correctly Affects ignitionrobotics/ign-rendering#323 Signed-off-by: Matias N. Goldberg * Update to use the renamed PostRender call Signed-off-by: Matias N. Goldberg * Update integration test Signed-off-by: Matias N. Goldberg * Rename SetNumCameraPassesPerGpuFlush -> SetCameraPassCountPerGpuFlush Signed-off-by: Matias N. Goldberg --- src/RenderingSensor.cc | 8 ++++++++ test/integration/gpu_lidar_sensor_plugin.cc | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/RenderingSensor.cc b/src/RenderingSensor.cc index ef99bcfe..aeba5918 100644 --- a/src/RenderingSensor.cc +++ b/src/RenderingSensor.cc @@ -111,5 +111,13 @@ void RenderingSensor::Render() rc->PostRender(); } } + + if (!this->dataPtr->manualSceneUpdate && + !this->dataPtr->scene->LegacyAutoGpuFlush()) + { + // When LegacyAutoGpuFlush = true, that function gets + // called per sensor, so we don't have to do anything here + this->dataPtr->scene->PostRender(); + } } diff --git a/test/integration/gpu_lidar_sensor_plugin.cc b/test/integration/gpu_lidar_sensor_plugin.cc index ca4c022c..d906e62e 100644 --- a/test/integration/gpu_lidar_sensor_plugin.cc +++ b/test/integration/gpu_lidar_sensor_plugin.cc @@ -751,6 +751,7 @@ void GpuLidarSensorTest::ManualUpdate(const std::string &_renderEngine) ignition::rendering::VisualPtr root = scene->RootVisual(); scene->SetAmbientLight(0.3, 0.3, 0.3); + scene->SetCameraPassCountPerGpuFlush(6u); // Create a sensor manager ignition::sensors::Manager mgr; @@ -791,6 +792,9 @@ void GpuLidarSensorTest::ManualUpdate(const std::string &_renderEngine) // Render and update mgr.RunOnce(std::chrono::steady_clock::duration::zero()); + // manually finish update scene + scene->PostRender(); + int mid = horzSamples / 2; int last = (horzSamples - 1); double unitBoxSize = 1.0;