Skip to content

Commit 1f417e1

Browse files
committed
fix: remove render call from data only path
1 parent 05bbf51 commit 1f417e1

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎src/ansys/visor/viewer/renderer/local_renderer.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,16 @@ def flush_wasm_state(self) -> None:
309309
self._local_view.update()
310310

311311
def push_without_rebuild(self) -> None:
312-
"""Render, then push the whole render window to the wasm client as data only, so its frontend is not rebuilt.
312+
"""Push the whole render window to the wasm client as data only, so its frontend is not rebuilt; renders nothing.
313313
314314
No object is named, so the window and everything it holds is sent,
315315
including an actor that has just become visible.
316+
317+
The window is not rendered: this runs on the trigger thread, while the
318+
window's GL context is current on the thread that rendered it first
319+
(the API caller's), and a context is current on one thread at a time.
320+
Only serialisation is needed: the wasm client draws the pushed state.
316321
"""
317-
self._render_window.Render()
318322
self._local_view.update(**{DATA_ONLY_UPDATE_OPTION: True})
319323

320324
@property

‎tests/unit/renderer/test_local_renderer.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,12 @@ def test_clear_of_a_visible_highlight_pushes_once_with_data_only(self, renderer)
12201220

12211221
renderer._local_view.update.assert_called_once_with(dataOnly=True)
12221222

1223+
def test_set_does_not_render_the_window(self, renderer):
1224+
"""The push runs on the trigger thread, which does not own the window's GL context."""
1225+
renderer.show_geometry_highlight(VertexPick(position=[1.0, 2.0, 3.0]))
1226+
renderer._render_window.Render.assert_not_called()
1227+
renderer._local_view.update.assert_called_once_with(dataOnly=True)
1228+
12231229
def test_clear_of_a_hidden_highlight_pushes_nothing(self, renderer):
12241230
renderer.show_geometry_highlight(NoGeometryPick())
12251231
renderer._local_view.update.assert_not_called()

0 commit comments

Comments
 (0)