I found a way to detect but it's not work on my computer with the latest chrome enabling simd flag:
var simd = async () => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 9, 1, 7, 0, 65, 0, 253, 4, 26, 11]));
await simd();
Is there another way to detect?
There is an opensource library for wasm feature detection here:
https://github.com/GoogleChromeLabs/wasm-feature-detect
The way it works is that it attempts to instantiate a wasm module with the given features, catching an error should it arise (which indicates that the feature is not supported).
Here's the SIMD module it attempts to create:
https://github.com/GoogleChromeLabs/wasm-feature-detect/blob/master/src/detectors/simd/module.wat
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.