Right now there is a Send + Sync
trait bound for types implementing shader::Primitive
as well as for the types that can be stored in the shader::Storage
.
Unfortunately when targeting WebAssembly
most wgpu
type are not Send + Sync
(Don't implement `Send` or `Sync` on Wasm by daxpedda · Pull Request #3691 · gfx-rs/wgpu · GitHub) which is practically preventing implementing custom shaders for that target, e.g. the custom_shader
example does not compile for wasm32-unknown-unknown
.
Looking at the code I did not see an obvious reason for the Send + Sync
trait bound in the way that shader::Storage
and shader::Primitive
is used internally by Iced
. I’d like to propose to lift those restrictions (at least when targeting WASM) and have tested this successfully on my private fork. I’d be happy to file an issue and accompanying PR that solves it if people think this is a good idea as I don’t know all the implications that this change would have.