fall back to wasm rather than asmjs if pnacl fails

Unlike PNaCl WASM is very reliable if the initial feature check passes.
This commit is contained in:
Niklas Fiekas 2018-03-10 00:31:33 +01:00
parent 87aa66753e
commit d8b2818ef1
2 changed files with 3 additions and 3 deletions

View file

@ -578,10 +578,10 @@ export default class AnalyseCtrl {
console.log('Local eval failed after depth ' + (ceval && ceval.depth), lastError);
if (this.ceval.pnaclSupported) {
if (ceval && ceval.depth >= 20 && !ceval.retried) {
console.log('Remain on native stockfish for now');
console.log('Remain on native Stockfish for now');
ceval.retried = true;
} else {
console.log('Fallback to ASMJS now');
console.log('Fallback to WASM/ASMJS now');
this.instanciateCeval(true);
this.startCeval();
}

View file

@ -14,7 +14,7 @@ export default function(opts: CevalOpts): CevalCtrl {
};
const pnaclSupported: boolean = !opts.failsafe && 'application/x-pnacl' in navigator.mimeTypes;
const wasmSupported = !opts.failsafe && typeof WebAssembly === 'object' && WebAssembly.validate(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
const wasmSupported = typeof WebAssembly === 'object' && WebAssembly.validate(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
const minDepth = 6;
const maxDepth = storedProp<number>(storageKey('ceval.max-depth'), 18);
const multiPv = storedProp(storageKey('ceval.multipv'), opts.multiPvDefault || 1);