engine
engine copied to clipboard
Investigate implementation of OffscreenCanvas API
Investigate implementation of https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas. This would give us:
- possible additional performance for the application, as playcanvas part of the application including webgl would execute on separate thread
- ability to use Atomics library https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics on both webgl and worker threads, allowing us to write a job system which can execute jobs triggered on webgl thread and get results back inside the same frame, without using messages for synchronization.
Hi guys, Is there any update regarding to implement this feature?
Hi @issacclee, we've not spent time investigating this yet. Probably not high priority until there is support in Safari?
@mvaligursky wondering whether webgpu supports this out of the box?
it does not in the initial release, but the support is expected later.
Thanks for answering guys, am I right to assume that this probably won't get implemented unless Safari starts to support the spec?
It will be implemented, when somebody has some time and considers this a high priority, regardless of the Safari (and Firefox by the way) support. Benefits on the android platform which is mostly using Chrome browser could be very nice. Perhaps somebody from our community of contributors could implement this as well, as this is an open source engine.
https://webkit.org/blog/13686/release-notes-for-safari-technology-preview-161/ FYI, safari will be getting offscreencanvas as shown here in the new tech review release announcement.
Based on this: https://www.construct.net/en/blogs/ashleys-blog-2/safari-releases-development-1616
Safari 16.4 rolled out in March 2023. Safari 16.4 adds support for OffscreenCanvas, but only the "2d" context - WebGL remains unsupported.
This fall webgl context will be added for offscreencanvas to Safari. https://webkit.org/blog/14205/news-from-wwdc23-webkit-features-in-safari-17-beta/
related: https://github.com/playcanvas/engine/pull/5168