add non SIMD test
diff --git a/Cargo.lock b/Cargo.lock
index 8f9656c..3da95d4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -919,8 +919,9 @@
[[package]]
name = "fearless_simd"
version = "0.2.0"
-source = "git+https://github.com/raphlinus/fearless_simd?rev=e46bcfd#e46bcfd622dbd7edd8538c836d9b100b6101aa15"
+source = "git+https://github.com/raphlinus/fearless_simd?rev=1c658f7#1c658f79db9eb4014d5bb14ed08c5fb91c44a230"
dependencies = [
+ "bytemuck",
"libm",
]
@@ -1302,6 +1303,7 @@
"allocator-api2",
"equivalent",
"foldhash",
+ "serde",
]
[[package]]
@@ -3837,7 +3839,9 @@
"vello_dev_macros",
"vello_hybrid",
"wasm-bindgen",
+ "wasm-bindgen-futures",
"wasm-bindgen-test",
+ "wasmparser 0.235.0",
"web-sys",
"wgpu",
]
@@ -3895,7 +3899,7 @@
"rayon",
"walrus-macro",
"wasm-encoder",
- "wasmparser",
+ "wasmparser 0.214.0",
]
[[package]]
@@ -4085,7 +4089,7 @@
"leb128",
"log",
"walrus",
- "wasmparser",
+ "wasmparser 0.214.0",
]
[[package]]
@@ -4124,6 +4128,19 @@
]
[[package]]
+name = "wasmparser"
+version = "0.235.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917"
+dependencies = [
+ "bitflags 2.9.1",
+ "hashbrown 0.15.3",
+ "indexmap 2.9.0",
+ "semver",
+ "serde",
+]
+
+[[package]]
name = "wayland-backend"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index b43823f..2db11ab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -114,7 +114,7 @@
thread_local = "1.1.8"
crossbeam-channel = "0.5.15"
ordered-channel = { version = "1.2.0", features = ["crossbeam-channel"] }
-fearless_simd = { git = "https://github.com/raphlinus/fearless_simd", rev = "e46bcfd", default-features = false }
+fearless_simd = { git = "https://github.com/raphlinus/fearless_simd", rev = "1c658f7", default-features = false }
# The below crates are experimental!
vello_api = { path = "sparse_strips/vello_api", default-features = false }
diff --git a/sparse_strips/vello_sparse_tests/Cargo.toml b/sparse_strips/vello_sparse_tests/Cargo.toml
index 538dd16..6dc66d2 100644
--- a/sparse_strips/vello_sparse_tests/Cargo.toml
+++ b/sparse_strips/vello_sparse_tests/Cargo.toml
@@ -41,8 +41,12 @@
"Blob",
"BlobPropertyBag",
"Url",
+ "Response",
] }
wasm-bindgen = "0.2.100"
+wasm-bindgen-futures = "0.4.50"
+# Required for introspecting the built WASM binary.
+wasmparser = "0.235.0"
[features]
webgl = ["vello_hybrid/webgl"]
diff --git a/sparse_strips/vello_sparse_tests/tests/mod.rs b/sparse_strips/vello_sparse_tests/tests/mod.rs
index 6f5658e..759b456 100644
--- a/sparse_strips/vello_sparse_tests/tests/mod.rs
+++ b/sparse_strips/vello_sparse_tests/tests/mod.rs
@@ -39,3 +39,5 @@
mod renderer;
#[macro_use]
mod util;
+#[cfg(target_arch = "wasm32")]
+mod wasm_binary_invariants;
diff --git a/sparse_strips/vello_sparse_tests/tests/wasm_binary_invariants.rs b/sparse_strips/vello_sparse_tests/tests/wasm_binary_invariants.rs
new file mode 100644
index 0000000..3ed6ab7
--- /dev/null
+++ b/sparse_strips/vello_sparse_tests/tests/wasm_binary_invariants.rs
@@ -0,0 +1,38 @@
+// Copyright 2025 the Vello Authors
+// SPDX-License-Identifier: Apache-2.0 OR MIT
+
+use wasm_bindgen_test::*;
+
+#[cfg(not(target_feature = "simd128"))]
+#[wasm_bindgen_test]
+async fn no_simd_instruction_inclusion() {
+ // Unless the WASM binary is explicitly built with `RUSTFLAGS=-Ctarget-feature=+simd128` then it
+ // is imperative that there isn't a single SIMD instruction in the resulting binary. These can
+ // accidentally creep into the binary due to usage of `#![cfg(target_feature = "simd128")]`. Any
+ // inclusion of a SIMD instruction in a non-SIMD WASM binary can invalidate the whole binary for
+ // browsers that do not have SIMD support.
+ //
+ // This test runs when simd128 is not enabled, and self-introspects the binary to ensure no SIMD
+ // instructions are included.
+
+ use wasm_bindgen::JsCast;
+ use wasm_bindgen_futures::JsFuture;
+ use wasmparser::{Validator, WasmFeatures};
+
+ let window = web_sys::window().unwrap();
+ let url = "/wasm-bindgen-test_bg.wasm";
+ let response = JsFuture::from(window.fetch_with_str(&url)).await.unwrap();
+ let response: web_sys::Response = response.dyn_into().unwrap();
+ assert!(response.ok(), "binary could not be fetched");
+ let buffer = JsFuture::from(response.array_buffer().unwrap())
+ .await
+ .unwrap();
+ let bytes = web_sys::js_sys::Uint8Array::new(&buffer).to_vec();
+
+ // Create the default wasm featureset, and explicitly subtract SIMD.
+ let mut wasm_non_simd_validator =
+ Validator::new_with_features(WasmFeatures::default().difference(WasmFeatures::SIMD));
+
+ // If validation is ok then no simd128 instructions were encountered.
+ assert!(wasm_non_simd_validator.validate_all(&bytes).is_ok());
+}