-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
web: Allow building an MVP vanilla WASM module #18528
base: master
Are you sure you want to change the base?
Conversation
We had wanted to wait for a wasm-bindgen update, but rustwasm/wasm-bindgen#4213 was replaced by rustwasm/wasm-bindgen#4235, which only disables reference type transformations for the bundler target (and updates CI to Rust v1.82). rustwasm/wasm-bindgen#4227 was closed as not planned. On that issue, daxpedda suggested
However, getting wgpu With that in mind, we're back to the issue of either using nightly Rust, or dropping support for Safari versions 15 or below and Pale Moon daxpedda doesn't want to disable the transformations because:
|
The former will only get less and less relevant over time, while the latter may (?) end up having this support added...? |
If we're dropping support for Safari 15 officially, there's an extra consideration we haven't talked about. All the current features are Safari 16+, right? Do we need dual-wasm then? |
Interestingly, if we go the |
That's down to whether https://repo.palemoon.org/MoonchildProductions/UXP/issues/2647 gets fixed. Also worth considering, although I said "all the current features are Safari 16+", I don't know which other ones are unsupported by Pale Moon. |
The general consensus is that this should at most be a temporary solution. macOS Catalina and iPhone models 7 and below can't upgrade to Safari 16+. Do we have any ideas on market share there? |
It's impossible to know market shares for macOS: https://gs.statcounter.com/os-version-market-share/macos/desktop/worldwide |
Downloaded this as a CSV, did some calculations: https://gs.statcounter.com/os-version-market-share/ios/mobile-tablet/worldwide "Percent of iOS supported" represents what percent of iOS users Ruffle currently supports.
|
I guess linking this here couldn't hurt: https://blog.rust-lang.org/2024/09/24/webassembly-targets-change-in-default-target-features.html#disabling-on-by-default-webassembly-proposals |
Pale Moon logs this when I log individual extension support:
Also, when I add diff --git a/web/packages/core/src/load-ruffle.ts b/web/packages/core/src/load-ruffle.ts
index 6b474f61a..f0aadac41 100644
--- a/web/packages/core/src/load-ruffle.ts
+++ b/web/packages/core/src/load-ruffle.ts
@@ -35,15 +35,31 @@ async function fetchRuffle(
setPolyfillsOnLoad();
// NOTE: Keep this list in sync with $RUSTFLAGS in the CI build config!
- const extensionsSupported: boolean = (
- await Promise.all([
- bulkMemory(),
- simd(),
- saturatedFloatToInt(),
- signExtensions(),
- referenceTypes(),
- ])
- ).every(Boolean);
+ const extensions = [
+ { name: "Bulk Memory", check: bulkMemory },
+ { name: "SIMD", check: simd },
+ { name: "Saturated Float-to-Int", check: saturatedFloatToInt },
+ { name: "Sign Extensions", check: signExtensions },
+ { name: "Reference Types", check: referenceTypes },
+ ];
+
+ const extensionsSupport = await Promise.all(
+ extensions.map(async (extension) => ({
+ name: extension.name,
+ supported: await extension.check(),
+ }))
+ );
+
+ let extensionsSupported = true;
+
+ extensionsSupport.forEach(({ name, supported }) => {
+ if (!supported) {
+ console.log(`WebAssembly extension "${name}" is NOT supported.`);
+ extensionsSupported = false;
+ } else {
+ console.log(`WebAssembly extension "${name}" is supported.`);
+ }
+ });
if (!extensionsSupported) {
console.log( |
Note that in testing, iOS 16.3 and below don't work with Rust 1.82+ without this workaround, so it's not just iOS 15-. |
? [ | ||
process.env["NIGHTLY_VERSION"] | ||
? `+nightly-${process.env["NIGHTLY_VERSION"]}` | ||
: "+nightly", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is the following commands should work in CI:
rustup install nightly-2024-12-02
rustup target add wasm32-unknown-unknown --toolchain nightly-2024-12-02
BUILD_WASM_MVP=1 NIGHTLY_VERSION=2024-12-02 npm run build:repro
df4553c
to
694c3b1
Compare
It appears that following the most recent wasm-bindgen update this PR is only necessary on browsers which do not have reference-types support. From what I know, of the browsers we currently support, that only eliminates support for Safari 14.1, Pale Moon, and Basilisk. Pale Moon and Basilisk can currently support Flash anyway. On sites which use the polyfill they won't use Ruffle. Sites which use the Ruffle API or sites which use the polyfill if the user hasn't installed Flash will break on those browsers without this PR if we bump Rust back to stable. We can merge #18838 to add an appropriate error message. Safari 14.1 on iOS has an ~1% market share among iOS users. |
I'm not sure whether this itself will be controversial. By itself, this update changes nothing in the development or CI pipelines by default.
Instead, it adds an environment variable,
BUILD_WASM_MVP
, which when set will causenpm run build:dual-wasm
and/ornpm run build:repro
to create a truly vanilla WASM module by using nightly Rust to disable all the WebAssembly extensions. With this set, the version of Ruffle that gets built can run on Pale Moon and Safari versions as old as 14.1.What this doesn't do (yet) is use this environment variable on CI or in the Firefox Docker script. Doing that is a matter of debate. Once we unpin CI from Rust 1.81, if we don't use this environment variable on CI, Ruffle will stop working on those older browsers. We can use this on CI temporarily as long as we want to keep supporting those browsers.