1414
1515logger = logging .getLogger (__name__ )
1616
17- # Module-level dedup stamp: tracks the last (sim instance, physics step) at
17+ # Module-level dedup stamp: tracks the last (sim instance, physics step, render generation ) at
1818# which Kit's ``app.update()`` was pumped. Keyed on ``id(sim)`` so that a
1919# new ``SimulationContext`` (e.g. in a new test) automatically invalidates
2020# any stale stamp from a previous instance.
21- _last_render_update_key : tuple [int , int ] = (0 , - 1 )
21+ _last_render_update_key : tuple [int , int , int ] = (0 , - 1 , - 1 )
2222
2323# ---------------------------------------------------------------------------
2424# RTX streaming status tracking
@@ -91,19 +91,19 @@ def _wait_for_streaming_complete() -> None:
9191
9292
9393def ensure_isaac_rtx_render_update () -> None :
94- """Ensure the Isaac RTX renderer has been pumped for the current physics step.
94+ """Ensure the Isaac RTX renderer has been pumped for the current sim step.
9595
9696 This keeps the Kit-specific ``app.update()`` logic inside the renderers
9797 package rather than in the backend-agnostic ``SimulationContext``.
9898
9999 Safe to call from multiple ``Camera`` / ``TiledCamera`` instances per step —
100100 only the first call triggers ``app.update()``. Subsequent calls are no-ops
101101 because the module-level ``_last_render_update_key`` already matches the
102- current ``(id(sim), step_count)`` pair .
102+ current ``(id(sim), step_count, render_generation )`` tuple .
103103
104- The key is a ``(sim_instance_id, step_count)`` tuple so that creating a new
105- ``SimulationContext`` (e.g. in a subsequent test) automatically invalidates
106- any stale stamp left over from a previous instance .
104+ The key is a ``(sim_instance_id, step_count, render_generation )`` tuple so that:
105+ - creating a new ``SimulationContext`` invalidates stale stamps, and
106+ - render/reset transitions that do not advance physics step count still force a fresh update .
107107
108108 If RTX texture/geometry streaming is in progress, additional
109109 ``app.update()`` calls are pumped until the streaming subsystem reports
@@ -120,7 +120,8 @@ def ensure_isaac_rtx_render_update() -> None:
120120 if sim is None :
121121 return
122122
123- key = (id (sim ), sim ._physics_step_count )
123+ render_generation = getattr (sim , "render_generation" , getattr (sim , "_render_generation" , 0 ))
124+ key = (id (sim ), sim ._physics_step_count , render_generation )
124125 if _last_render_update_key == key :
125126 return # Already pumped this step (by another camera or a visualizer)
126127
0 commit comments