From 4a549d090756e9d1ca0e62bf145eb65782bc16f0 Mon Sep 17 00:00:00 2001 From: Elena Torro Date: Thu, 23 Apr 2026 09:57:48 +0200 Subject: [PATCH] :zap: Drain GPU queue during pan/zoom to avoid render_from_cache hitch --- render-wasm/src/render.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/render-wasm/src/render.rs b/render-wasm/src/render.rs index 2920496de4..0d249f06e7 100644 --- a/render-wasm/src/render.rs +++ b/render-wasm/src/render.rs @@ -1815,16 +1815,20 @@ impl RenderState { } // In a pure viewport interaction (pan/zoom), render_from_cache - // owns the Target surface — skip flush so we don't present - // stale tile positions. The rAF still populates the Cache - // surface and tile HashMap so render_from_cache progressively - // shows more complete content. + // owns the Target surface — don't flush Target so we don't + // present stale tile positions. We still drain the GPU command + // queue with a non-Target `flush_and_submit` so the backlog + // of tile-render commands executes incrementally instead of + // piling up for hundreds of milliseconds and blowing up the + // next `render_from_cache` call into a multi-frame hitch. // // During interactive shape transforms (drag/resize/rotate) we // still need to flush every rAF so the user sees the updated // shape position — render_from_cache is not in the loop here. if !self.options.is_viewport_interaction() { self.flush_and_submit(); + } else { + self.gpu_state.context.flush_and_submit(); } if self.render_in_progress {