Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebWorker backend support #5

Closed
fuzzie360 opened this issue Feb 19, 2016 · 9 comments
Closed

WebWorker backend support #5

fuzzie360 opened this issue Feb 19, 2016 · 9 comments

Comments

@fuzzie360
Copy link
Member

Use the WebWorker API to run the kernel on CPU cores.

Challenges:

@robertleeplummerjr
Copy link
Member

Couldn't one just load gpu in the webworker? Done!

@fuzzie360
Copy link
Member Author

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.

@robertleeplummerjr
Copy link
Member

I was more thinking just cpu fallback in webworker, but your recommendation is a touché to my angarde.

@ubernaut
Copy link

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

@robertleeplummerjr
Copy link
Member

agreed. I have a feeling that will be the case for only a short time. It is just too good of a feature.

@robertleeplummerjr
Copy link
Member

wait a tick... basic support?
offscreencanvas - web apis mdn

@feljx
Copy link

feljx commented Apr 15, 2020

Is gpu.js usable in a web worker?

@robertleeplummerjr
Copy link
Member

Unit tests:

function testOffscreenCanvas(mode, done) {

@robertleeplummerjr
Copy link
Member

I believe this to be working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants