I've been trying to get a wasm -> asm.js fallback where browsers are getting the best solution automatically. Short of building both independently and picking the right one myself, I have not got it to work across the board.
***************************************************************************** 1) emcc -s BINARYEN=1 hello.c -o hello.js Firefox/Chrome loads wasm without any boilerplate Safari: [Warning] no native wasm support detected (hello.js, line 190) No attempt to fall back to hello.asm.js, despite the fact one is always generated. This is obviously when I found BINARYEN_METHOD. Result for the html output: 2) emcc -s BINARYEN=1 hello.c -o hello.html ***************************************************************************** 3) emcc -s BINARYEN=1 -s "BINARYEN_METHOD='native-wasm,asmjs'" hello.c -o hello.js Safari: successfully loaded asm.js Firefox/Chrome Fail: on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS) Okay, I'll try that, but I don't understand why it didn't just work like #1. ***************************************************************************** 4) emcc -s BINARYEN=1 -s "BINARYEN_METHOD='native-wasm,asmjs'" hello.c -o hello.html Safari: successfully loading asm.js Firefox: successfully loading wasm Chrome: Fail: failed to compile wasm module: RangeError: WebAssembly.Compile is disallowed on the main thread, if the buffer size is larger than 4KB. Use WebAssembly.compile, or compile on a worker thread. It also complained about a deprecated use of a synchronous XHR call, though it never succeeded. ***************************************************************************** I see the bootstrap code that is generated, so emcc is aware that it is doing things differently if BINARYEN_METHOD is specified. But it has some bugs, and it doesn't seem like it should require doing this manual manipulation of the various files. But anyway, are there other flags I should try, or anything else to get this wasm -> asm.js fallback to work consistently across browsers? Thanks, -Adam -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.