Optimize Ogre2DepthCamera performance by skipping color target passes when there are no connections #965
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🦟 Bug fix
Summary
Performance optimization - Ogre2DepthCamera is capable of generating color images in addition to depth and the color data are packed into a point cloud buffer. So if there are no point cloud connections, we can skip computations needed to generate the color rgb images.
Also added changes to skip light-related computations in the same way as lidars in #955
More info:
This is done by using ogre2's "execution mask". If the render passes execution mask matches the workspace's execution mask, the passes get executed. So by default, the color target's render passes' execution mask is set to something that does not match the workspace execution mask so we can skip computation for the color passes. When point cloud connections is detected, the passes' execution mask is updated to match the workspace's mask.
To Test
This is to be used with gazebosim/gz-sensors#413. You can see graphs in that pull request showing the performance improvements for a depth camera and a RGBD camera in gz sim.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.