You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a downstream experimental project that requires building Slint for wasm32-unknown-unknown with the renderer-femtovg-wgpu and unstable-wgpu-28 features enabled. However, the current codebase has feature gates that explicitly exclude target_family = "wasm" from the WGPU FemtoVG renderer path, preventing compilation.
Current Status
The existing code contains several feature gates that prevent WGPU-based FemtoVG rendering on WebAssembly:
To unblock our downstream project, we experimentally modified the feature gates. These changes work for our specific use case, but we want to understand if they align with Slint's architecture and roadmap:
1. Remove wasm exclusion from WGPUFemtoVGRenderer (femtovg.rs)
Texture interop: The WGPU texture import path (ImageInner::WGPUTexture) now compiles and can work on wasm when textures are provided externally
Compilation gates: Feature gates no longer block wasm target builds
Practical rendering: Our downstream use case (with specific configurations) renders successfully
Potential Issues
Asynchronous initialization assumption conflict
The code in internal/core/graphics/wgpu_28.rs contains explicit comments stating:
// wgpu uses async here, but the returned future is ready on first poll on all platforms except WASM,// which we don't support right now.
The Risk: On wasm, these futures may return Poll::Pending, causing the .expect() to panic. The current implementation assumes first-poll readiness, which is not guaranteed on WebAssembly.
Questions for the Slint Team
Was wasm intentionally excluded from femtovg-wgpu? We noticed the comments about async WGPU initialization not being supported on wasm, but in our testing it appears to work. Are there specific failure scenarios we might not have encountered?
Is there an existing plan for wasm support? We'd like to understand:
Whether wasm support for femtovg-wgpu is on the roadmap
If there are technical barriers we're not aware of
Whether our approach could be useful or if a different architecture is preferred
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Background
We have a downstream experimental project that requires building Slint for
wasm32-unknown-unknownwith therenderer-femtovg-wgpuandunstable-wgpu-28features enabled. However, the current codebase has feature gates that explicitly excludetarget_family = "wasm"from the WGPU FemtoVG renderer path, preventing compilation.Current Status
The existing code contains several feature gates that prevent WGPU-based FemtoVG rendering on WebAssembly:
internal/backends/winit/renderer/femtovg.rs:internal/renderers/femtovg/images.rs:internal/renderers/femtovg/images.rs:Changes We Tried
To unblock our downstream project, we experimentally modified the feature gates. These changes work for our specific use case, but we want to understand if they align with Slint's architecture and roadmap:
1. Remove wasm exclusion from WGPUFemtoVGRenderer (femtovg.rs)
2. Enable WGPU texture import on wasm (images.rs)
3. Early return for wasm in adapter detection (wgpu_28.rs)
Some(RequestedGraphicsAPI::WGPU28(api::WGPUConfiguration::Manual { instance, .. })) => { + if cfg!(target_family = "wasm") { + return true; + } (instance, wgpu::Backends::all()) }Analysis and Concerns
What Works
ImageInner::WGPUTexture) now compiles and can work on wasm when textures are provided externallyPotential Issues
Asynchronous initialization assumption conflict
The code in
internal/core/graphics/wgpu_28.rscontains explicit comments stating:The Risk: On wasm, these futures may return
Poll::Pending, causing the.expect()to panic. The current implementation assumes first-poll readiness, which is not guaranteed on WebAssembly.Questions for the Slint Team
Was wasm intentionally excluded from femtovg-wgpu? We noticed the comments about async WGPU initialization not being supported on wasm, but in our testing it appears to work. Are there specific failure scenarios we might not have encountered?
Is there an existing plan for wasm support? We'd like to understand:
Related Files:
internal/backends/winit/renderer/femtovg.rsinternal/renderers/femtovg/images.rsinternal/core/graphics/wgpu_28.rsinternal/backends/winit/Cargo.toml(feature definition)Beta Was this translation helpful? Give feedback.
All reactions