gz-sim
gz-sim copied to clipboard
Optimize performance by skipping scene update when possible
Summary
IMPORTANT:
This PR depends on ignitionrobotics/ign-rendering#415 and should not be merged until that PR is.
Ray queries (performed every time the mouse moves) had a negative performance impact caused by https://github.com/ignitionrobotics/ign-rendering/pull/415
This commit prevents repetead calls to IgnRenderer::ScreenToScene to perform unnecessary performance degradation since calling ClosestPoint(true) the first time during the frame is enough
Code will not compile until PR ignitionrobotics/ign-rendering#415 is merged
Signed-off-by: Matias N. Goldberg [email protected]
Summary
Checklist
- [x] Signed all commits for DCO
- [ ] Added tests
- [ ] Updated documentation (as needed)
- [ ] Updated migration guide (as needed)
- [x]
codecheck
passed (See contributing) - [ ] All tests passed (See test coverage)
- [ ] While waiting for a review on your PR, please help review another open pull request to support the maintainers
Note to maintainers: Remember to use Squash-Merge
Note: As I'm studying a few changes I noticed we may be able to optimize it back to pre ignitionrobotics/ign-rendering#415 levels by calling this->HandleMouseEvent();
either before this->dataPtr->renderUtil.Update();
or after this->dataPtr->camera->Update();
and thus always calling rayQuery->ClosestPoint(false)
This would cause mouse events to lag behind by 1 frame; but no update of scene would be required (thus no extra CPU needed). Without ignitionrobotics/ign-rendering#415; gazebo's GUI is currently operating on data that is behind by 1 frame anyway.
Note that from Fortress, GzScene3D
is being deprecated in favor of MinimalScene
(still WIP), so we'll need to port this fix there). CC @ahcorde
@darksylinc , are you still working on this?
I forgot about this but because I thought it was already merged.
If I understand correctly this code should be ported to MinimalScene now?
If I understand correctly this code should be ported to MinimalScene now?
Yes, please 🙇🏽♀️ You're welcome to leave the code in GzScene3D
too because Fortress users may still be relying on it.
Scene3D
has been removed from the gz-sim7
branch. So this needs to target MinimalScene
on gz-gui. Closing.