Remove SIMD for now (#1025)

This is by no means a proper fix, but Chrome 91 (stable tomorrow) brings some breaking changes to SIMD, and I'd rather disable SIMD for now to avoid breaking Squoosh altogether once it hits stable, and work on a proper fix in a separate branch.
This commit is contained in:
Ingvar Stepanyan
2021-05-24 12:50:48 +01:00
committed by GitHub
parent af80643809
commit f779e13bc8
4 changed files with 7 additions and 69 deletions

View File

@@ -14,28 +14,17 @@ import type { WP2Module } from 'codecs/wp2/enc/wp2_enc';
import type { EncodeOptions } from '../shared/meta';
import { initEmscriptenModule } from 'features/worker-utils';
import { threads, simd } from 'wasm-feature-detect';
import { threads } from 'wasm-feature-detect';
import wasmUrl from 'url:codecs/wp2/enc/wp2_enc.wasm';
import wasmUrlWithMT from 'url:codecs/wp2/enc/wp2_enc_mt.wasm';
import workerUrl from 'omt:codecs/wp2/enc/wp2_enc_mt.worker.js';
import wasmUrlWithMTAndSIMD from 'url:codecs/wp2/enc/wp2_enc_mt_simd.wasm';
import workerUrlWithSIMD from 'omt:codecs/wp2/enc/wp2_enc_mt_simd.worker.js';
let emscriptenModule: Promise<WP2Module>;
async function init() {
if (await threads()) {
if (await simd()) {
const wp2Encoder = await import('codecs/wp2/enc/wp2_enc_mt_simd');
return initEmscriptenModule(
wp2Encoder.default,
wasmUrlWithMTAndSIMD,
workerUrlWithSIMD,
);
}
const wp2Encoder = await import('codecs/wp2/enc/wp2_enc_mt');
return initEmscriptenModule(wp2Encoder.default, wasmUrlWithMT, workerUrl);
}