WebWorker backend support
Use the WebWorker API to run the kernel on CPU cores.
Challenges:
- WebWorkers are purely asynchronous. Blocked by #4 for API parity among all backends which might break graceful fallback.
Couldn't one just load gpu in the webworker? Done!
As a general update to this enhancement, I think API-wise, maybe we should just return a Promise just like how we just return a Texture object anyway. To support graceful fallback, we could implement an async unrwraper to turn our different output types (Arrays, Promises, Textures) into Arrays.
@robertleeplummerjr what you are describing requires this tho https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas It would actually improve the user experience for our normal GPU kernels by allowing JavaScript to execute something while awaiting for a response from GPU, But, WebWorkers also improve CPU performance which is something we could try and achieve too.
I was more thinking just cpu fallback in webworker, but your recommendation is a touché to my angarde.
Just chiming in to say I would love to be able to run GPU.js in a webworker on a GPU. Too bad only Firefox supports webgl in a webworker at this point https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas#Browser_compatibility
agreed. I have a feeling that will be the case for only a short time. It is just too good of a feature.
wait a tick... basic support?

Is gpu.js usable in a web worker?
Unit tests: https://github.com/gpujs/gpu.js/blob/5397186a7ae1e901f504f7682be684cc5572d2c5/test/features/offscreen-canvas.js#L19
I believe this to be working.