This commit is contained in:
Alejandro Alonso 2026-04-23 12:55:58 +02:00
parent 96722fde4b
commit 7e76aace1b
2 changed files with 16 additions and 3 deletions

View File

@ -1575,10 +1575,17 @@
(def ^:private default-context-options
#js {:antialias false
:depth true
;; Depth is not needed for 2D canvas rendering and can add driver work.
:depth false
:stencil true
:alpha true
"preserveDrawingBuffer" true})
;; Preserving the drawing buffer forces extra GPU/driver work and can
;; stall every frame; we re-render explicitly so it is unnecessary for
;; the viewport and hurts FPS during interactions like drag.
"preserveDrawingBuffer" false
;; Hint the browser/ANGLE to reduce compositor-induced stalls.
"desynchronized" true
"powerPreference" "high-performance"})
(defn resize-viewbox
[width height]

View File

@ -1768,6 +1768,7 @@ impl RenderState {
performance::end_measure!("start_render_loop");
performance::end_timed_log!("start_render_loop", _start);
Ok(())
}
@ -1826,7 +1827,12 @@ impl RenderState {
// 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();
// self.gpu_state.context.flush_and_submit();
if self.options.is_interactive_transform() {
self.gpu_state.context.flush_and_submit();
} else {
self.flush_and_submit();
}
} else {
self.gpu_state.context.flush_and_submit();
}