web: Detect and log whether WebAssembly extensions are actually used

This commit is contained in:
TÖRÖK Attila 2022-01-08 04:49:18 +01:00 committed by Mike Welsh
parent 44e59a0012
commit db6731be2c
2 changed files with 14 additions and 1 deletions

View File

@ -427,7 +427,11 @@ export class RufflePlayer extends HTMLElement {
this,
config
);
console.log("New Ruffle instance created.");
console.log(
"New Ruffle instance created (WebAssembly extensions: " +
(ruffleConstructor.is_wasm_simd_used() ? "ON" : "OFF") +
")"
);
// In Firefox, AudioContext.state is always "suspended" when the object has just been created.
// It may change by itself to "running" some milliseconds later. So we need to wait a little

View File

@ -454,6 +454,15 @@ impl Ruffle {
})
.unwrap_or_default()
}
/// Returns whether the `simd128` target feature was enabled at build time.
/// This is intended to discriminate between the two WebAssembly module
/// versions, one of which uses WebAssembly extensions, and the other one
/// being "vanilla". `simd128` is used as proxy for most extensions, since
/// no other WebAssembly target feature is exposed to `cfg!`.
pub fn is_wasm_simd_used() -> bool {
cfg!(target_feature = "simd128")
}
}
impl Ruffle {