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

Rendering to OffscreenCanvas on non-yielding workers #403

Closed
awtcode opened this issue Aug 9, 2019 · 8 comments
Closed

Rendering to OffscreenCanvas on non-yielding workers #403

awtcode opened this issue Aug 9, 2019 · 8 comments

Comments

@awtcode
Copy link

awtcode commented Aug 9, 2019

Hi,

I currently execute my code in a Web Worker and does not yield the context back to the browser because everything happens in a while loop. As such, I need to pass the OffScreen Canvas back to the main thread for rendering.

Here are my questions:

  1. Will WebGPU support the OffScreenCanvas API?
  2. Can we have an API to support rendering from a Worker even if the context is not yielded back to the Worker?
@kainino0x
Copy link
Contributor

  1. Yes, you will be able to use it similarly to WebGL with transferControlToOffscreen (though WebGPU's exact presentation API may change between now and then).
  2. I think we will be able to support this. It's not entirely solved yet. WebGL OffscreenCanvas commit() was rejected as a web platform feature, but we continue to keep this use case in mind as it is critical for ports of native code to WebAssembly.

@kainino0x kainino0x changed the title Support for OffScreenCanvas in WebGPU Rendering to OffscreenCanvas on non-yielding workers Aug 9, 2019
@awtcode
Copy link
Author

awtcode commented Aug 10, 2019

Thanks for the prompt reply @kainino0x :) It will be great if we can have (2) because I am currently working on porting AutoCAD to Wasm and being able to render directly from the Worker without having to transfer control back to the main thread would be a huge plus.

@awtcode
Copy link
Author

awtcode commented Nov 21, 2019

@kainino0x and @Kangz , can I check if OffScreenCanvas is currently available for WebGPU in Chrome Canary on Windows now? If not, is there an estimate on when it will be ready? Thanks.

@Kangz
Copy link
Contributor

Kangz commented Nov 21, 2019

@awtcode I don't think any of the WebGPU implementations have OffscreenCanvas right now. In Chromium it is blocked on some internal code refactor so it won't be available at least until the end of the year, maybe more.

@awtcode
Copy link
Author

awtcode commented Nov 22, 2019

Thanks for your reply @Kangz .

@stefan-pdx
Copy link

Hi @kainino0x -- do you happen to know the status of the internal refactor? I'm really looking forward to accessing WebGPU from Web Workers.

Thanks!

@Kangz
Copy link
Contributor

Kangz commented Aug 12, 2020

@s11k It's still ongoing (but had recent progress). You can follow along this Chromium bug.

@Kangz
Copy link
Contributor

Kangz commented Sep 2, 2021

FYI offscreen canvas is completely working in WebGPU in Chromium now. Closing now since this was more of a question on WebGPU than a spec discussion.

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

No branches or pull requests

4 participants