mkeeter/fidget

WASM support

bkrmendy opened this issue · 1 comments

First off, amazing library, thanks for all the work!

I tried to build fidget for the wasm32-unknown-unknown target. After fixing some easy problems (installing getrandom with the js feature and removing jit from the default features of fidget), I was faced with this error:

error[E0080]: evaluation of constant value failed
  --> fidget/src/mesh/cell.rs:44:1
   |
44 | / static_assertions::const_assert_eq!(
45 | |     std::mem::size_of::<usize>(),
46 | |     std::mem::size_of::<u64>()
47 | | );
   | |_^ attempt to compute `0_usize - 1_usize`, which would overflow
   |
   = note: this error originates in the macro `const_assert` which comes from the expansion of the macro `static_assertions::const_assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

I assume the reason for this is that in WASM, the pointer size is 32 bits. After commenting out the assertion, I saw that some bitshift operations break (and I gave up here).

Is WASM support planned or is this a total dead end?

Supporting WASM is definitely a goal, but truly first-class support is farther out.

That being said, fixing the build for the wasm32-unknown-unknown target wasn't too hard, so I've done that (and added a CI check) in #14. I believe this should let you use the fidget crate in WASM-based applications; let me know if there are any issues!