WorkerSolver: Update worker solver to use a basic ArrayBuffer rather than SharedArrayBuffer
gkjohnson opened this issue · comments
SharedArrayBuffers are not always available on all platforms including Chrome on Android
Not available in Safari, either, but they have been reenabled behind a flag in the latest technology preview. And it sounds like there's a plan to get them enabled again on Chrome Android.
Trading the buffers back and forth would be a bit complicated and performance may suffer a bit, as well. We could just transfer results the IK is converged? Or the solver can continue to iterate in the background while the buffer is transferred, applied, and then immediately transferred back.
Instead we should automatically fall back ArrayBuffers and swap them back and forth:
const useSharedArrayBuffer = ( typeof SharedArrayBuffer ) !== 'undefined';