Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM support #13

Closed
bkrmendy opened this issue Feb 21, 2024 · 1 comment
Closed

WASM support #13

bkrmendy opened this issue Feb 21, 2024 · 1 comment

Comments

@bkrmendy
Copy link

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?

@mkeeter
Copy link
Owner

mkeeter commented Feb 21, 2024

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!

@mkeeter mkeeter closed this as completed Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants