Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions patch/ros-rolling-rviz-rendering.osx.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/src/rviz_rendering/ogre_render_window_impl.cpp b/src/rviz_rendering/ogre_render_window_impl.cpp
index 466e1d1e4..8fcd56d57 100644
--- a/src/rviz_rendering/ogre_render_window_impl.cpp
+++ b/src/rviz_rendering/ogre_render_window_impl.cpp
@@ -235,12 +235,21 @@ void
RenderWindowImpl::resize(size_t width, size_t height)
{
if (ogre_render_window_) {
- this->setCameraAspectRatio();
- ogre_render_window_->resize(
- static_cast<unsigned int>(width), // NOLINT
- static_cast<unsigned int>(height) // NOLINT
- );
- ogre_render_window_->windowMovedOrResized();
+ // Skip the costly Ogre resize / windowMovedOrResized when the size has
+ // not actually changed. On macOS Sonoma+, windowMovedOrResized triggers
+ // [NSOpenGLContext update] -> CGLSetVirtualScreen, which is hundreds of
+ // ms per call under the OpenGL-on-Metal compatibility path; each call
+ // also re-fires an expose event, so calling it on every expose creates
+ // a positive-feedback loop that makes the splash screen never progress.
+ const auto w = static_cast<unsigned int>(width);
+ const auto h = static_cast<unsigned int>(height);
+ if (w != last_resize_width_ || h != last_resize_height_) {
+ last_resize_width_ = w;
+ last_resize_height_ = h;
Comment thread
wep21 marked this conversation as resolved.
+ this->setCameraAspectRatio();
+ ogre_render_window_->resize(w, h);
+ ogre_render_window_->windowMovedOrResized();
+ }
}
this->renderLater();
}
diff --git a/src/rviz_rendering/ogre_render_window_impl.hpp b/src/rviz_rendering/ogre_render_window_impl.hpp
index 7bd7b2238..8391498fe 100644
--- a/src/rviz_rendering/ogre_render_window_impl.hpp
+++ b/src/rviz_rendering/ogre_render_window_impl.hpp
@@ -150,6 +150,9 @@ protected:

bool animating_;

+ unsigned int last_resize_width_{0};
+ unsigned int last_resize_height_{0};
+
Ogre::Viewport * ogre_viewport_;

// std::function<void()> pre_render_callback_; ///< Functor which is called before each render
3 changes: 3 additions & 0 deletions pkg_additional_info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ compressed_depth_image_transport:
additional_cmake_args: "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON"
moveit_ros_visualization:
additional_cmake_args: "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON"
# Remove all lines after this one on new full rebuild
rviz_rendering:
build_number: 19