amethyst / shred

Shared resource dispatcher
Apache License 2.0
236 stars 66 forks source link

Disable parallel for wasm32 target by default? #158

Closed AThilenius closed 5 years ago

AThilenius commented 5 years ago

Rust thread support isn't there yet for WASM (as far as I understand) 😢

Normally this wouldn't be a problem because shred seems to work just fine with WASM as long as you default-features = false in the Cargo.toml. Sadly this is not possible for me because default-features doesn't affect transitive deps and I'm using amethyst_core which is pulling in specs which pulls in shred. (Aka because of a lot of RFCs and issues related to Cargo, I don't think I have a way to compile shred with default-features = false)

Using the DispatcherBuilder causes a panic: backend.js:1 Panic error message: Invalid configuration: ThreadPoolBuildError { kind: IOError(Custom { kind: Other, error: "operation not supported on wasm yet" }) }

Should parallel be disabled by default for wasm32? I'm not even sure how to add something like that to the Cargo.toml.

AThilenius commented 5 years ago

After more digging and a few forks later I've realized this issue is more complicated for the amethyst_core case because it pulls in Rayon directly. Both specs and specs-hierarchy have default-features = false for shred, so adding the same to amethyst_core should take care of that part. Going to close this, but it might still be worth considering?