From 0597eef75059cad58fd320c4487390455670c6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Albeza?= Date: Wed, 18 Mar 2026 12:44:10 +0100 Subject: [PATCH 1/3] :sparkles: Show/hide wasm info label via config flag --- common/src/app/common/flags.cljc | 2 ++ frontend/src/app/render_wasm/api.cljs | 4 +++- render-wasm/src/options.rs | 3 ++- render-wasm/src/render/debug.rs | 4 ++++ render-wasm/src/render/options.rs | 6 +++++- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common/src/app/common/flags.cljc b/common/src/app/common/flags.cljc index 23ef653592..d5e80d4381 100644 --- a/common/src/app/common/flags.cljc +++ b/common/src/app/common/flags.cljc @@ -136,6 +136,8 @@ :webhooks ;; TODO: deprecate this flag and consolidate the code :render-wasm-dpr + ;; Show WASM renderer info label (hidden by default). + :render-wasm-info :hide-release-modal :subscriptions :subscriptions-old diff --git a/frontend/src/app/render_wasm/api.cljs b/frontend/src/app/render_wasm/api.cljs index e4d097cc06..ddbd3d0085 100644 --- a/frontend/src/app/render_wasm/api.cljs +++ b/frontend/src/app/render_wasm/api.cljs @@ -1401,7 +1401,9 @@ (dbg/enabled? :wasm-viewbox) (bit-or 2r00000000000000000000000000000001) (text-editor-wasm?) - (bit-or 2r00000000000000000000000000001000))) + (bit-or 2r00000000000000000000000000001000) + (contains? cf/flags :render-wasm-info) + (bit-or 2r00000000000000000000000000010000))) (defn set-canvas-size [canvas] diff --git a/render-wasm/src/options.rs b/render-wasm/src/options.rs index beeeec5a30..56fa7b0ae1 100644 --- a/render-wasm/src/options.rs +++ b/render-wasm/src/options.rs @@ -1,4 +1,5 @@ pub const DEBUG_VISIBLE: u32 = 0x01; pub const PROFILE_REBUILD_TILES: u32 = 0x02; pub const FAST_MODE: u32 = 0x04; -pub const INFO_TEXT: u32 = 0x08; +pub const TEXT_EDITOR_V3: u32 = 0x08; +pub const SHOW_WASM_INFO: u32 = 0x10; diff --git a/render-wasm/src/render/debug.rs b/render-wasm/src/render/debug.rs index 41f68a663e..9bfa690441 100644 --- a/render-wasm/src/render/debug.rs +++ b/render-wasm/src/render/debug.rs @@ -41,6 +41,10 @@ pub fn render_debug_cache_surface(render_state: &mut RenderState) { } pub fn render_wasm_label(render_state: &mut RenderState) { + if !render_state.options.show_wasm_info() { + return; + } + let canvas = render_state.surfaces.canvas(SurfaceId::Target); let skia::ISize { width, height } = canvas.base_layer_size(); let mut paint = skia::Paint::default(); diff --git a/render-wasm/src/render/options.rs b/render-wasm/src/render/options.rs index d6f1d1396f..dfa8f7ec86 100644 --- a/render-wasm/src/render/options.rs +++ b/render-wasm/src/render/options.rs @@ -33,6 +33,10 @@ impl RenderOptions { } pub fn show_info_text(&self) -> bool { - self.flags & options::INFO_TEXT == options::INFO_TEXT + self.flags & options::TEXT_EDITOR_V3 == options::TEXT_EDITOR_V3 + } + + pub fn show_wasm_info(&self) -> bool { + self.flags & options::SHOW_WASM_INFO == options::SHOW_WASM_INFO } } From 619842152d62cd29d2a4387a8a18802e2c6e5352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Albeza?= Date: Wed, 18 Mar 2026 13:16:13 +0100 Subject: [PATCH 2/3] :recycle: Refactor render options (wasm) --- frontend/src/app/render_wasm/api.cljs | 4 ++-- render-wasm/src/main.rs | 1 - render-wasm/src/options.rs | 5 ----- render-wasm/src/render/debug.rs | 2 +- render-wasm/src/render/options.rs | 25 +++++++++++++------------ 5 files changed, 16 insertions(+), 21 deletions(-) delete mode 100644 render-wasm/src/options.rs diff --git a/frontend/src/app/render_wasm/api.cljs b/frontend/src/app/render_wasm/api.cljs index ddbd3d0085..04546d9ef1 100644 --- a/frontend/src/app/render_wasm/api.cljs +++ b/frontend/src/app/render_wasm/api.cljs @@ -1401,9 +1401,9 @@ (dbg/enabled? :wasm-viewbox) (bit-or 2r00000000000000000000000000000001) (text-editor-wasm?) - (bit-or 2r00000000000000000000000000001000) + (bit-or 2r00000000000000000000000000000100) (contains? cf/flags :render-wasm-info) - (bit-or 2r00000000000000000000000000010000))) + (bit-or 2r00000000000000000000000000001000))) (defn set-canvas-size [canvas] diff --git a/render-wasm/src/main.rs b/render-wasm/src/main.rs index 6e519cc249..ed0ba87f10 100644 --- a/render-wasm/src/main.rs +++ b/render-wasm/src/main.rs @@ -3,7 +3,6 @@ mod emscripten; mod error; mod math; mod mem; -mod options; mod performance; mod render; mod shapes; diff --git a/render-wasm/src/options.rs b/render-wasm/src/options.rs deleted file mode 100644 index 56fa7b0ae1..0000000000 --- a/render-wasm/src/options.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub const DEBUG_VISIBLE: u32 = 0x01; -pub const PROFILE_REBUILD_TILES: u32 = 0x02; -pub const FAST_MODE: u32 = 0x04; -pub const TEXT_EDITOR_V3: u32 = 0x08; -pub const SHOW_WASM_INFO: u32 = 0x10; diff --git a/render-wasm/src/render/debug.rs b/render-wasm/src/render/debug.rs index 9bfa690441..4ff244020b 100644 --- a/render-wasm/src/render/debug.rs +++ b/render-wasm/src/render/debug.rs @@ -61,7 +61,7 @@ pub fn render_wasm_label(render_state: &mut RenderState) { let debug_font = render_state.fonts.debug_font(); canvas.draw_str(str, p, debug_font, &paint); - if render_state.options.show_info_text() { + if render_state.options.is_text_editor_v3() { str = "TEXT EDITOR / V3"; let (scalar, _) = render_state.fonts.debug_font().measure_str(str, None); diff --git a/render-wasm/src/render/options.rs b/render-wasm/src/render/options.rs index dfa8f7ec86..9505d0b254 100644 --- a/render-wasm/src/render/options.rs +++ b/render-wasm/src/render/options.rs @@ -1,42 +1,43 @@ -use crate::options; +// Render options flags +const DEBUG_VISIBLE: u32 = 0x01; +const PROFILE_REBUILD_TILES: u32 = 0x02; +const TEXT_EDITOR_V3: u32 = 0x04; +const SHOW_WASM_INFO: u32 = 0x08; #[derive(Debug, Copy, Clone, PartialEq, Default)] pub struct RenderOptions { pub flags: u32, pub dpr: Option, + fast_mode: bool, } impl RenderOptions { pub fn is_debug_visible(&self) -> bool { - self.flags & options::DEBUG_VISIBLE == options::DEBUG_VISIBLE + self.flags & DEBUG_VISIBLE == DEBUG_VISIBLE } pub fn is_profile_rebuild_tiles(&self) -> bool { - self.flags & options::PROFILE_REBUILD_TILES == options::PROFILE_REBUILD_TILES + self.flags & PROFILE_REBUILD_TILES == PROFILE_REBUILD_TILES } /// Use fast mode to enable / disable expensive operations pub fn is_fast_mode(&self) -> bool { - self.flags & options::FAST_MODE == options::FAST_MODE + self.fast_mode } pub fn set_fast_mode(&mut self, enabled: bool) { - if enabled { - self.flags |= options::FAST_MODE; - } else { - self.flags &= !options::FAST_MODE; - } + self.fast_mode = enabled; } pub fn dpr(&self) -> f32 { self.dpr.unwrap_or(1.0) } - pub fn show_info_text(&self) -> bool { - self.flags & options::TEXT_EDITOR_V3 == options::TEXT_EDITOR_V3 + pub fn is_text_editor_v3(&self) -> bool { + self.flags & TEXT_EDITOR_V3 == TEXT_EDITOR_V3 } pub fn show_wasm_info(&self) -> bool { - self.flags & options::SHOW_WASM_INFO == options::SHOW_WASM_INFO + self.flags & SHOW_WASM_INFO == SHOW_WASM_INFO } } From 66ba097ba20388c953fe5216ac357e900ef4c9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Albeza?= Date: Wed, 18 Mar 2026 13:27:05 +0100 Subject: [PATCH 3/3] :bug: Fix not being able to enable wasm text editor via config flag --- frontend/src/app/render_wasm/api.cljs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/render_wasm/api.cljs b/frontend/src/app/render_wasm/api.cljs index 04546d9ef1..5ffc60a0bd 100644 --- a/frontend/src/app/render_wasm/api.cljs +++ b/frontend/src/app/render_wasm/api.cljs @@ -55,10 +55,11 @@ (defn text-editor-wasm? [] - (let [runtime-features (get @st/state :features-runtime) - enabled-features (get @st/state :features)] - (or (contains? runtime-features "text-editor-wasm/v1") - (contains? enabled-features "text-editor-wasm/v1")))) + (or (contains? cf/flags :feature-text-editor-wasm) + (let [runtime-features (get @st/state :features-runtime) + enabled-features (get @st/state :features)] + (or (contains? runtime-features "text-editor-wasm/v1") + (contains? enabled-features "text-editor-wasm/v1"))))) (def ^:const UUID-U8-SIZE 16) (def ^:const UUID-U32-SIZE (/ UUID-U8-SIZE 4))