-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Is OffscreenCanvas rendering supported in WebGPU context? #17776
Comments
@sbc100 and @kainino0x FYI, I managed to overcome this issue in my prototype by setting |
Sorry, I forgot to reply to this. We haven't put any work specifically into getting OffscreenCanvas to work. I never tried it but thought it would work with emscripten/src/library_html5.js Line 333 in 44fd8b1
However it looks like this is only for transferControlToOffscreen and not for raw OffscreenCanvases. Thanks for reporting your workaround! |
@kainino0x Thanks for your attention on this issue. I just realized that the approach that I described above with specialHTMLTargets is mentioned in emscripten documentation. I assume that its well verified working with WebGL and it's great that this works seamlessly for WebGPU for me :) |
@kainino0x This ASSERT line is failing for me when working with offscreen canvas in debug build (works well in release build). Any chance that its possible to update this line for the check to allow canvas of offscreen (non-html) type? |
@kainino0x Thanks for the prompt fix! Really appreciate it. |
I am facing a similar issue: #19225 I would like to run webgpu off the main thread in a separate thread while rendering on an offscreen canvas passed from the main thread. @kainino0x Is this possible with emscripten? I am using proxy to pthread but i am unable to retrieve the canvas context. |
I see that webgpu OffscreenCanvas rendering is already available in chromium with this bug fix:
Looking at current implementation of wgpuInstanceCreateSurface(), it appears to me that rendering to OffscreenCanvas is currently not available in native webgpu API.
This code section shows that wgpuInstanceCreateSurface() asserts expect webgpu surface to be associated only to HTML canvas element?
https://github.com/emscripten-core/emscripten/blob/main/src/library_webgpu.js#L2410
Is my understanding correct?
If so, is there any known alternatives to render to canvas on webworker then transfer rendered output to main thread for chrome browser display?
In my prototype code, I am trying to configure OffscreenCanvas in the HTML and referencing this canvas in wgpuInstanceCreateSurface() call to be used for subsequent rendering.
It appears mandatory to define WGPUSurfaceDescriptorFromCanvasHTMLSelector when creating webgpu surface.
https://github.com/emscripten-core/emscripten/blob/main/src/library_webgpu.js#L2399
The text was updated successfully, but these errors were encountered: