-
-
Notifications
You must be signed in to change notification settings - Fork 838
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: Make npm run build:dual-wasm create an MVP vanilla WASM module and make the default WASM module be with extensions #18528
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-. |
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-14.8, 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-14.8 on iOS has a <1% market share among iOS users. |
33e1656
to
b4a616f
Compare
This now updates CI as well and doesn't use Nightly, instead using |
fcf3dd6
to
78a80af
Compare
42568f1
to
4c16a67
Compare
4c16a67
to
399264c
Compare
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.
Thank you! 🎉
Just spotted in the Rust 1.84 release notes: rust-lang/rust#131080 |
I assume that means we'll stop getting this warning: https://github.com/ruffle-rs/ruffle/actions/runs/12700598943/job/35403591847#step:9:713 I was wondering about that warning. It didn't make sense to me that it would exist considering reference-types was already enabled by default. |
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.Edit: New scope of this PR is to make
npm run build:dual-wasm
andnpm run build:repro
build the vanilla WASM modules as MVPs so they can support more browsers. It does this by building std, which it does stably by settingRUSTC_BOOTSTRAP
to1
to use Nightly features with stable Rust when building the vanilla module. Any CI scripts that use either of those commands (Nightly release, Dockerfile, dockerfile test) also now need to install the rust-src component. The environment variable used by those commands is now called BUILD_WASM_MVP=true instead of ENABLE_WASM_EXTENSIONS=true, to reflect the new purpose.This also changes
npm run build
from building only the vanilla WASM module to building only the extensions WASM module.