diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-22 16:48:37 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-22 16:48:37 +0200 |
| commit | cceb835a84c125990ad8e49784e01a7c52636bb3 (patch) | |
| tree | 8520cce9a203c72c7bcdc72ca138a36316a5a110 /rust/crates/gpu/src/context.rs | |
| parent | f1b45b4328cff6a016720ce7b38b87ac2992dc2d (diff) | |
| download | opencut-cceb835a84c125990ad8e49784e01a7c52636bb3.tar.gz | |
perf: improve rendering performance by ~20x
Diffstat (limited to 'rust/crates/gpu/src/context.rs')
| -rw-r--r-- | rust/crates/gpu/src/context.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/rust/crates/gpu/src/context.rs b/rust/crates/gpu/src/context.rs index e38eff8c..0fcb2e8c 100644 --- a/rust/crates/gpu/src/context.rs +++ b/rust/crates/gpu/src/context.rs @@ -353,6 +353,14 @@ impl GpuContext { self.supports_external_texture_copies } + /// The HTML canvas that owns the backing WebGL context, if running on the + /// WebGL fallback. Callers on that path can mount this canvas directly + /// instead of copying pixels out of it every frame. + #[cfg(all(feature = "wasm", target_arch = "wasm32"))] + pub fn gl_canvas(&self) -> Option<&web_sys::HtmlCanvasElement> { + self.gl_canvas.as_ref() + } + pub fn render_texture_to_surface( &self, texture: &wgpu::Texture, @@ -571,7 +579,7 @@ impl GpuContext { } #[cfg(all(feature = "wasm", target_arch = "wasm32"))] - fn render_texture_to_gl_canvas_surface( + pub fn render_texture_to_gl_canvas_surface( &self, texture: &wgpu::Texture, width: u32, |
